]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/colour.h
added wxColourBase::Init() and use DEFINE_STD_WXCOLOUR_CONSTRUCTORS() in all ports...
[wxWidgets.git] / include / wx / generic / colour.h
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 DEFINE_STD_WXCOLOUR_CONSTRUCTORS
24
25 // copy ctors and assignment operators
26 wxColour(const wxColour& col);
27 wxColour& operator=(const wxColour& col);
28
29 // dtor
30 virtual ~wxColour();
31
32 // accessors
33 virtual bool IsOk() const { return m_isInit; }
34
35 unsigned char Red() const { return m_red; }
36 unsigned char Green() const { return m_green; }
37 unsigned char Blue() const { return m_blue; }
38 unsigned char Alpha() const { return m_alpha; }
39
40 // comparison
41 bool operator==(const wxColour& colour) const
42 {
43 return (m_red == colour.m_red &&
44 m_green == colour.m_green &&
45 m_blue == colour.m_blue &&
46 m_alpha == colour.m_alpha &&
47 m_isInit == colour.m_isInit);
48 }
49
50 bool operator!=(const wxColour& colour) const { return !(*this == colour); }
51
52 protected:
53
54 // Helper function
55 void Init();
56
57 virtual void
58 InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
59
60 private:
61 bool m_isInit;
62 unsigned char m_red;
63 unsigned char m_blue;
64 unsigned char m_green;
65 unsigned char m_alpha;
66
67 private:
68 DECLARE_DYNAMIC_CLASS(wxColour)
69 };
70
71 #endif // _WX_GENERIC_COLOUR_H_