]>
Commit | Line | Data |
---|---|---|
9b6dbb09 | 1 | ///////////////////////////////////////////////////////////////////////////// |
edc536d3 | 2 | // Name: wx/motif/colour.h |
9b6dbb09 JS |
3 | // Purpose: wxColour class |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
edc536d3 | 9 | // Licence: wxWindows licence |
9b6dbb09 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_COLOUR_H_ | |
13 | #define _WX_COLOUR_H_ | |
14 | ||
9b6dbb09 JS |
15 | #include "wx/object.h" |
16 | #include "wx/string.h" | |
17 | ||
18 | // Colour | |
40989e46 | 19 | class WXDLLEXPORT wxColour : public wxColourBase |
9b6dbb09 | 20 | { |
83df96d6 | 21 | DECLARE_DYNAMIC_CLASS(wxColour) |
9b6dbb09 | 22 | public: |
edc536d3 WS |
23 | // constructors |
24 | // ------------ | |
40989e46 | 25 | DEFINE_STD_WXCOLOUR_CONSTRUCTORS |
aad6765c | 26 | |
e4a81a2e | 27 | // copy ctors and assignment operators |
83df96d6 JS |
28 | wxColour( const wxColour& col ); |
29 | wxColour& operator = ( const wxColour& col ); | |
aad6765c | 30 | |
e4a81a2e | 31 | // dtor |
d3c7fc99 | 32 | virtual ~wxColour(); |
aad6765c | 33 | |
aad6765c | 34 | |
83df96d6 | 35 | // accessors |
8f884a0d | 36 | virtual bool IsOk() const {return m_isInit; } |
83df96d6 JS |
37 | unsigned char Red() const { return m_red; } |
38 | unsigned char Green() const { return m_green; } | |
39 | unsigned char Blue() const { return m_blue; } | |
aad6765c | 40 | |
3e0071d9 MB |
41 | WXPixel GetPixel() const { return m_pixel; }; |
42 | void SetPixel(WXPixel pixel) { m_pixel = pixel; m_isInit = true; }; | |
aad6765c | 43 | |
83df96d6 | 44 | inline bool operator == (const wxColour& colour) const { return (m_red == colour.m_red && m_green == colour.m_green && m_blue == colour.m_blue); } |
aad6765c | 45 | |
83df96d6 | 46 | inline bool operator != (const wxColour& colour) const { return (!(m_red == colour.m_red && m_green == colour.m_green && m_blue == colour.m_blue)); } |
c0a83c51 | 47 | |
83df96d6 | 48 | // Allocate a colour, or nearest colour, using the given display. |
aad6765c | 49 | // If realloc is true, ignore the existing pixel, otherwise just return |
83df96d6 JS |
50 | // the existing one. |
51 | // Returns the allocated pixel. | |
aad6765c | 52 | |
83df96d6 JS |
53 | // TODO: can this handle mono displays? If not, we should have an extra |
54 | // flag to specify whether this should be black or white by default. | |
aad6765c | 55 | |
3e0071d9 | 56 | WXPixel AllocColour(WXDisplay* display, bool realloc = false); |
aad6765c | 57 | |
aad6765c JS |
58 | protected: |
59 | // Helper function | |
60 | void Init(); | |
61 | ||
aea95b1c VZ |
62 | virtual void |
63 | InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a); | |
40989e46 | 64 | |
e4a81a2e | 65 | private: |
83df96d6 JS |
66 | bool m_isInit; |
67 | unsigned char m_red; | |
68 | unsigned char m_blue; | |
69 | unsigned char m_green; | |
aad6765c | 70 | |
e4a81a2e | 71 | public: |
3e0071d9 | 72 | WXPixel m_pixel; |
9b6dbb09 JS |
73 | }; |
74 | ||
9b6dbb09 | 75 | #endif |
83df96d6 | 76 | // _WX_COLOUR_H_ |