1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/motif/colour.h
3 // Purpose: wxColour class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #include "wx/object.h"
16 #include "wx/string.h"
19 class WXDLLEXPORT wxColour
: public wxColourBase
21 DECLARE_DYNAMIC_CLASS(wxColour
)
27 wxColour() { Init(); }
28 DEFINE_STD_WXCOLOUR_CONSTRUCTORS
30 // copy ctors and assignment operators
31 wxColour( const wxColour
& col
);
32 wxColour
& operator = ( const wxColour
& col
);
39 bool Ok() const { return IsOk(); }
40 bool IsOk() const {return m_isInit
; }
41 unsigned char Red() const { return m_red
; }
42 unsigned char Green() const { return m_green
; }
43 unsigned char Blue() const { return m_blue
; }
45 WXPixel
GetPixel() const { return m_pixel
; };
46 void SetPixel(WXPixel pixel
) { m_pixel
= pixel
; m_isInit
= true; };
48 inline bool operator == (const wxColour
& colour
) const { return (m_red
== colour
.m_red
&& m_green
== colour
.m_green
&& m_blue
== colour
.m_blue
); }
50 inline bool operator != (const wxColour
& colour
) const { return (!(m_red
== colour
.m_red
&& m_green
== colour
.m_green
&& m_blue
== colour
.m_blue
)); }
52 // Allocate a colour, or nearest colour, using the given display.
53 // If realloc is true, ignore the existing pixel, otherwise just return
55 // Returns the allocated pixel.
57 // TODO: can this handle mono displays? If not, we should have an extra
58 // flag to specify whether this should be black or white by default.
60 WXPixel
AllocColour(WXDisplay
* display
, bool realloc
= false);
67 InitRGBA(unsigned char r
, unsigned char g
, unsigned char b
, unsigned char a
);
73 unsigned char m_green
;