]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/colour.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/os2/colour.h
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
28 wxColour( unsigned char cRed
, unsigned char cGreen
, unsigned char cBlue
);
31 wxColour( unsigned long colRGB
) { Set(colRGB
); }
33 // Implicit conversion from the colour name
34 wxColour(const wxString
& rColourName
) { InitFromName(rColourName
); }
35 wxColour(const wxChar
*zColourName
) { InitFromName(zColourName
); }
37 // Copy ctors and assignment operators
38 wxColour(const wxColour
& rCol
);
39 wxColour(const wxColour
* pCol
);
40 wxColour
&operator = (const wxColour
& rCol
);
46 void Set( unsigned char cRed
, unsigned char cGreen
, unsigned char cBlue
);
47 void Set( unsigned long lColRGB
)
49 // We don't need to know sizeof(long) here because we assume that the three
50 // least significant bytes contain the R, G and B values
51 Set( (unsigned char)lColRGB
52 ,(unsigned char)(lColRGB
>> 8)
53 ,(unsigned char)(lColRGB
>> 16)
56 void Set(const wxString
& rsColour
)
58 InitFromName(rsColour
);
62 bool Ok(void) const {return m_bIsInit
; }
64 unsigned char Red(void) const { return m_cRed
; }
65 unsigned char Green(void) const { return m_cGreen
; }
66 unsigned char Blue(void) const { return m_cBlue
; }
69 bool operator == (const wxColour
& rColour
) const
71 return (m_bIsInit
== rColour
.m_bIsInit
72 && m_cRed
== rColour
.m_cRed
73 && m_cGreen
== rColour
.m_cGreen
74 && m_cBlue
== rColour
.m_cBlue
78 bool operator != (const wxColour
& rColour
) const { return !(*this == rColour
); }
80 WXCOLORREF
GetPixel(void) const { return m_vPixel
; };
82 void InitFromName(const wxString
& rCol
);
91 unsigned char m_cBlue
;
92 unsigned char m_cGreen
;
97 DECLARE_DYNAMIC_CLASS(wxColour
)
98 }; // end of class wxColour