]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/colour.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/colour.h
3 // Purpose: wxColour class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #include "wx/object.h"
17 // ----------------------------------------------------------------------------
19 // ----------------------------------------------------------------------------
21 class WXDLLEXPORT wxColour
: public wxObject
28 wxColour() { Init(); }
31 wxColour( unsigned char red
, unsigned char green
, unsigned char blue
)
32 { Set(red
, green
, blue
); }
35 wxColour( unsigned long colRGB
) { Set(colRGB
); }
37 // implicit conversion from the colour name
38 wxColour(const wxString
&colourName
) { InitFromName(colourName
); }
39 wxColour(const wxChar
*colourName
) { InitFromName(colourName
); }
48 // to have the matching Create also for this class
49 void Create( unsigned char red
, unsigned char green
, unsigned char blue
)
50 { Set(red
, green
, blue
); }
53 void Set(unsigned char red
, unsigned char green
, unsigned char blue
);
54 void Set(unsigned long colRGB
)
56 // we don't need to know sizeof(long) here because we assume that the three
57 // least significant bytes contain the R, G and B values
58 Set((unsigned char)colRGB
,
59 (unsigned char)(colRGB
>> 8),
60 (unsigned char)(colRGB
>> 16));
66 bool Ok() const { return m_isInit
; }
68 unsigned char Red() const { return m_red
; }
69 unsigned char Green() const { return m_green
; }
70 unsigned char Blue() const { return m_blue
; }
73 bool operator==(const wxColour
& colour
) const
75 return m_isInit
== colour
.m_isInit
76 && m_red
== colour
.m_red
77 && m_green
== colour
.m_green
78 && m_blue
== colour
.m_blue
;
81 bool operator != (const wxColour
& colour
) const { return !(*this == colour
); }
83 WXCOLORREF
GetPixel() const { return m_pixel
; };
85 void InitFromName(const wxString
& colourName
);
98 unsigned char m_green
;
101 DECLARE_DYNAMIC_CLASS(wxColour
)