]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/generic/colour.h | |
3 | // Purpose: wxColour class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_GENERIC_COLOUR_H_ | |
13 | #define _WX_GENERIC_COLOUR_H_ | |
14 | ||
15 | #include "wx/object.h" | |
16 | ||
17 | // Colour | |
18 | class WXDLLEXPORT wxColour: public wxColourBase | |
19 | { | |
20 | public: | |
21 | // constructors | |
22 | // ------------ | |
23 | ||
24 | // default | |
25 | wxColour(); | |
26 | DEFINE_STD_WXCOLOUR_CONSTRUCTORS | |
27 | ||
28 | // copy ctors and assignment operators | |
29 | wxColour(const wxColour& col); | |
30 | wxColour& operator=(const wxColour& col); | |
31 | ||
32 | // dtor | |
33 | virtual ~wxColour(); | |
34 | ||
35 | // accessors | |
36 | bool IsOk() const { return m_isInit; } | |
37 | ||
38 | unsigned char Red() const { return m_red; } | |
39 | unsigned char Green() const { return m_green; } | |
40 | unsigned char Blue() const { return m_blue; } | |
41 | unsigned char Alpha() const { return m_alpha; } | |
42 | ||
43 | // comparison | |
44 | bool operator==(const wxColour& colour) const | |
45 | { | |
46 | return (m_red == colour.m_red && | |
47 | m_green == colour.m_green && | |
48 | m_blue == colour.m_blue && | |
49 | m_alpha == colour.m_alpha && | |
50 | m_isInit == colour.m_isInit); | |
51 | } | |
52 | ||
53 | bool operator!=(const wxColour& colour) const { return !(*this == colour); } | |
54 | ||
55 | protected: | |
56 | ||
57 | // Helper function | |
58 | void Init(); | |
59 | ||
60 | virtual void | |
61 | InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a); | |
62 | ||
63 | private: | |
64 | bool m_isInit; | |
65 | unsigned char m_red; | |
66 | unsigned char m_blue; | |
67 | unsigned char m_green; | |
68 | unsigned char m_alpha; | |
69 | ||
70 | private: | |
71 | DECLARE_DYNAMIC_CLASS(wxColour) | |
72 | }; | |
73 | ||
74 | #endif // _WX_GENERIC_COLOUR_H_ |