wxMessageBox off the main thread lost result code.
[wxWidgets.git] / include / wx / motif / colour.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/motif/colour.h
3 // Purpose: wxColour class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_COLOUR_H_
12 #define _WX_COLOUR_H_
13
14 #include "wx/object.h"
15 #include "wx/string.h"
16
17 // Colour
18 class WXDLLIMPEXP_CORE wxColour : public wxColourBase
19 {
20 DECLARE_DYNAMIC_CLASS(wxColour)
21 public:
22 // constructors
23 // ------------
24 DEFINE_STD_WXCOLOUR_CONSTRUCTORS
25
26 // copy ctors and assignment operators
27 wxColour( const wxColour& col );
28 wxColour& operator = ( const wxColour& col );
29
30 // dtor
31 virtual ~wxColour();
32
33
34 // accessors
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; }
39
40 WXPixel GetPixel() const { return m_pixel; }
41 void SetPixel(WXPixel pixel) { m_pixel = pixel; m_isInit = true; }
42
43 inline bool operator == (const wxColour& colour) const { return (m_red == colour.m_red && m_green == colour.m_green && m_blue == colour.m_blue); }
44
45 inline bool operator != (const wxColour& colour) const { return (!(m_red == colour.m_red && m_green == colour.m_green && m_blue == colour.m_blue)); }
46
47 // Allocate a colour, or nearest colour, using the given display.
48 // If realloc is true, ignore the existing pixel, otherwise just return
49 // the existing one.
50 // Returns the allocated pixel.
51
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.
54
55 WXPixel AllocColour(WXDisplay* display, bool realloc = false);
56
57 protected:
58 // Helper function
59 void Init();
60
61 virtual void
62 InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
63
64 private:
65 bool m_isInit;
66 unsigned char m_red;
67 unsigned char m_blue;
68 unsigned char m_green;
69
70 public:
71 WXPixel m_pixel;
72 };
73
74 #endif
75 // _WX_COLOUR_H_