]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/msw/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_COLOUR_H_ | |
13 | #define _WX_COLOUR_H_ | |
14 | ||
15 | #include "wx/object.h" | |
16 | ||
17 | // ---------------------------------------------------------------------------- | |
18 | // Colour | |
19 | // ---------------------------------------------------------------------------- | |
20 | ||
21 | class WXDLLEXPORT wxColour : public wxColourBase | |
22 | { | |
23 | public: | |
24 | // constructors | |
25 | // ------------ | |
26 | ||
27 | // default | |
28 | wxColour() { Init(); } | |
29 | DEFINE_STD_WXCOLOUR_CONSTRUCTORS | |
30 | ||
31 | ||
32 | // dtor | |
33 | virtual ~wxColour(); | |
34 | ||
35 | ||
36 | // accessors | |
37 | // --------- | |
38 | ||
39 | bool IsOk() const { return m_isInit; } | |
40 | ||
41 | unsigned char Red() const { return m_red; } | |
42 | unsigned char Green() const { return m_green; } | |
43 | unsigned char Blue() const { return m_blue; } | |
44 | unsigned char Alpha() const { return m_alpha ; } | |
45 | ||
46 | // comparison | |
47 | bool operator==(const wxColour& colour) const | |
48 | { | |
49 | return m_isInit == colour.m_isInit | |
50 | && m_red == colour.m_red | |
51 | && m_green == colour.m_green | |
52 | && m_blue == colour.m_blue | |
53 | && m_alpha == colour.m_alpha; | |
54 | } | |
55 | ||
56 | bool operator != (const wxColour& colour) const { return !(*this == colour); } | |
57 | ||
58 | WXCOLORREF GetPixel() const { return m_pixel; } | |
59 | ||
60 | ||
61 | public: | |
62 | WXCOLORREF m_pixel; | |
63 | ||
64 | protected: | |
65 | // Helper function | |
66 | void Init(); | |
67 | ||
68 | virtual void | |
69 | InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a); | |
70 | ||
71 | private: | |
72 | bool m_isInit; | |
73 | unsigned char m_red; | |
74 | unsigned char m_blue; | |
75 | unsigned char m_green; | |
76 | unsigned char m_alpha; | |
77 | ||
78 | private: | |
79 | DECLARE_DYNAMIC_CLASS(wxColour) | |
80 | }; | |
81 | ||
82 | #endif | |
83 | // _WX_COLOUR_H_ |