]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/colour.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxColour class
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #include "wx/object.h"
18 class WXDLLEXPORT wxColour
: public wxObject
33 wxColour( unsigned char cRed
38 wxColour( unsigned long colRGB
) { Set(colRGB
); }
41 // Implicit conversion from the colour name
43 wxColour(const wxString
& rColourName
) { InitFromName(rColourName
); }
44 wxColour(const wxChar
*zColourName
) { InitFromName(zColourName
); }
47 // Copy ctors and assignment operators
49 wxColour(const wxColour
& rCol
);
50 wxColour(const wxColour
* pCol
);
51 wxColour
&operator = (const wxColour
& rCol
);
61 void Set( unsigned char cRed
65 void Set(unsigned long lColRGB
)
68 // We don't need to know sizeof(long) here because we assume that the three
69 // least significant bytes contain the R, G and B values
71 Set( (unsigned char)lColRGB
72 ,(unsigned char)(lColRGB
>> 8)
73 ,(unsigned char)(lColRGB
>> 16)
76 void Set(const wxString
& rsColour
)
78 InitFromName(rsColour
);
84 bool Ok(void) const {return m_bIsInit
; }
86 unsigned char Red(void) const { return m_cRed
; }
87 unsigned char Green(void) const { return m_cGreen
; }
88 unsigned char Blue(void) const { return m_cBlue
; }
93 bool operator == (const wxColour
& rColour
) const
95 return (m_bIsInit
== rColour
.m_bIsInit
96 && m_cRed
== rColour
.m_cRed
97 && m_cGreen
== rColour
.m_cGreen
98 && m_cBlue
== rColour
.m_cBlue
102 bool operator != (const wxColour
& rColour
) const { return !(*this == rColour
); }
104 WXCOLORREF
GetPixel(void) const { return m_vPixel
; };
106 void InitFromName(const wxString
& rCol
);
114 unsigned char m_cRed
;
115 unsigned char m_cBlue
;
116 unsigned char m_cGreen
;
119 WXCOLORREF m_vPixel
;
121 DECLARE_DYNAMIC_CLASS(wxColour
)
122 }; // end of class wxColour