1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/motif/colour.h
3 // Purpose: wxColour class
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
14 #include "wx/object.h"
15 #include "wx/string.h"
18 class WXDLLIMPEXP_CORE wxColour
: public wxColourBase
20 DECLARE_DYNAMIC_CLASS(wxColour
)
24 DEFINE_STD_WXCOLOUR_CONSTRUCTORS
26 // copy ctors and assignment operators
27 wxColour( const wxColour
& col
);
28 wxColour
& operator = ( const wxColour
& col
);
35 virtual bool IsOk() const {return m_isInit
; }
36 unsigned char Red() const { return m_red
; }
37 unsigned char Green() const { return m_green
; }
38 unsigned char Blue() const { return m_blue
; }
40 WXPixel
GetPixel() const { return m_pixel
; }
41 void SetPixel(WXPixel pixel
) { m_pixel
= pixel
; m_isInit
= true; }
43 inline bool operator == (const wxColour
& colour
) const { return (m_red
== colour
.m_red
&& m_green
== colour
.m_green
&& m_blue
== colour
.m_blue
); }
45 inline bool operator != (const wxColour
& colour
) const { return (!(m_red
== colour
.m_red
&& m_green
== colour
.m_green
&& m_blue
== colour
.m_blue
)); }
47 // Allocate a colour, or nearest colour, using the given display.
48 // If realloc is true, ignore the existing pixel, otherwise just return
50 // Returns the allocated pixel.
52 // TODO: can this handle mono displays? If not, we should have an extra
53 // flag to specify whether this should be black or white by default.
55 WXPixel
AllocColour(WXDisplay
* display
, bool realloc
= false);
62 InitRGBA(unsigned char r
, unsigned char g
, unsigned char b
, unsigned char a
);
68 unsigned char m_green
;