]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/palmos/colour.h
9bd926c3726b538131b93b6ce7b10c1aa8205e71
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 #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
); }
42 // copy ctors and assignment operators
43 wxColour(const wxColour
& col
);
44 wxColour
& operator=( const wxColour
& col
);
53 // to have the matching Create also for this class
54 void Create( unsigned char red
, unsigned char green
, unsigned char blue
)
55 { Set(red
, green
, blue
); }
58 void Set(unsigned char red
, unsigned char green
, unsigned char blue
);
59 void Set(unsigned long colRGB
)
61 // we don't need to know sizeof(long) here because we assume that the three
62 // least significant bytes contain the R, G and B values
63 Set((unsigned char)colRGB
,
64 (unsigned char)(colRGB
>> 8),
65 (unsigned char)(colRGB
>> 16));
71 bool Ok() const { return m_isInit
; }
73 unsigned char Red() const { return m_red
; }
74 unsigned char Green() const { return m_green
; }
75 unsigned char Blue() const { return m_blue
; }
78 bool operator==(const wxColour
& colour
) const
80 return m_isInit
== colour
.m_isInit
81 && m_red
== colour
.m_red
82 && m_green
== colour
.m_green
83 && m_blue
== colour
.m_blue
;
86 bool operator != (const wxColour
& colour
) const { return !(*this == colour
); }
88 WXCOLORREF
GetPixel() const { return m_pixel
; };
90 void InitFromName(const wxString
& colourName
);
102 unsigned char m_blue
;
103 unsigned char m_green
;
106 DECLARE_DYNAMIC_CLASS(wxColour
)