]>
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
39 // Implicit conversion from the colour name
41 wxColour(const wxString
& rColourName
) { InitFromName(rColourName
); }
42 wxColour(const char* zColourName
) { InitFromName(zColourName
); }
45 // Copy ctors and assignment operators
47 wxColour(const wxColour
& rCol
);
48 wxColour(const wxColour
* pCol
);
49 wxColour
&operator = (const wxColour
& rCol
);
59 void Set( unsigned char cRed
63 void Set(unsigned long lColRGB
)
66 // We don't need to know sizeof(long) here because we assume that the three
67 // least significant bytes contain the R, G and B values
69 Set( (unsigned char)lColRGB
70 ,(unsigned char)(lColRGB
>> 8)
71 ,(unsigned char)(lColRGB
>> 16)
78 bool Ok(void) const {return m_bIsInit
; }
81 // Let's remove this inelegant function
83 #if WXWIN_COMPATIBILITY
84 void Get( unsigned char* pRed
85 ,unsigned char* pGreen
90 unsigned char Red(void) const { return m_cRed
; }
91 unsigned char Green(void) const { return m_cGreen
; }
92 unsigned char Blue(void) const { return m_cBlue
; }
97 bool operator == (const wxColour
& rColour
) const
99 return (m_cRed
== rColour
.m_cRed
&&
100 m_cGreen
== rColour
.m_cGreen
&&
101 m_cBlue
== rColour
.m_cBlue
104 bool operator != (const wxColour
& rColour
) const { return !(*this == rColour
); }
106 void InitFromName(const wxString
& rCol
);
107 WXCOLORREF
GetPixel(void) const { return m_vPixel
; };
111 unsigned char m_cRed
;
112 unsigned char m_cBlue
;
113 unsigned char m_cGreen
;
116 WXCOLORREF m_vPixel
;
118 DECLARE_DYNAMIC_CLASS(wxColour
)
119 }; // end of class wxColour