[ 1473731 ] 'wxColourBase and wxString <-> wxColour implementation' with minor modifi...
[wxWidgets.git] / include / wx / msw / colour.h
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 ~wxColour();
34
35
36 // accessors
37 // ---------
38
39 bool Ok() 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
45 // comparison
46 bool operator==(const wxColour& colour) const
47 {
48 return m_isInit == colour.m_isInit
49 && m_red == colour.m_red
50 && m_green == colour.m_green
51 && m_blue == colour.m_blue;
52 }
53
54 bool operator != (const wxColour& colour) const { return !(*this == colour); }
55
56 WXCOLORREF GetPixel() const { return m_pixel; };
57
58
59 public:
60 WXCOLORREF m_pixel;
61
62 protected:
63 // Helper function
64 void Init();
65
66 virtual void InitWith(unsigned char red, unsigned char green, unsigned char blue);
67
68 private:
69 bool m_isInit;
70 unsigned char m_red;
71 unsigned char m_blue;
72 unsigned char m_green;
73
74 private:
75 DECLARE_DYNAMIC_CLASS(wxColour)
76 };
77
78 #endif
79 // _WX_COLOUR_H_