]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/palmos/colour.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/palmos/colour.h
3 // Purpose: wxColour class
4 // Author: William Osborne - minimal working wxPalmOS port
8 // Copyright: (c) William Osborne
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "colour.h"
19 #include "wx/object.h"
21 // ----------------------------------------------------------------------------
23 // ----------------------------------------------------------------------------
25 class WXDLLEXPORT wxColour
: public wxObject
32 wxColour() { Init(); }
35 wxColour( unsigned char red
, unsigned char green
, unsigned char blue
)
36 { Set(red
, green
, blue
); }
39 wxColour( unsigned long colRGB
) { Set(colRGB
); }
41 // implicit conversion from the colour name
42 wxColour(const wxString
&colourName
) { InitFromName(colourName
); }
43 wxColour(const wxChar
*colourName
) { InitFromName(colourName
); }
46 // copy ctors and assignment operators
47 wxColour(const wxColour
& col
);
48 wxColour
& operator=( const wxColour
& col
);
57 // to have the matching Create also for this class
58 void Create( unsigned char red
, unsigned char green
, unsigned char blue
)
59 { Set(red
, green
, blue
); }
62 void Set(unsigned char red
, unsigned char green
, unsigned char blue
);
63 void Set(unsigned long colRGB
)
65 // we don't need to know sizeof(long) here because we assume that the three
66 // least significant bytes contain the R, G and B values
67 Set((unsigned char)colRGB
,
68 (unsigned char)(colRGB
>> 8),
69 (unsigned char)(colRGB
>> 16));
75 bool Ok() const { return m_isInit
; }
77 unsigned char Red() const { return m_red
; }
78 unsigned char Green() const { return m_green
; }
79 unsigned char Blue() const { return m_blue
; }
82 bool operator==(const wxColour
& colour
) const
84 return m_isInit
== colour
.m_isInit
85 && m_red
== colour
.m_red
86 && m_green
== colour
.m_green
87 && m_blue
== colour
.m_blue
;
90 bool operator != (const wxColour
& colour
) const { return !(*this == colour
); }
92 WXCOLORREF
GetPixel() const { return m_pixel
; };
94 void InitFromName(const wxString
& colourName
);
106 unsigned char m_blue
;
107 unsigned char m_green
;
110 DECLARE_DYNAMIC_CLASS(wxColour
)