]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/colour.h
Make wxUString compilable with VC6.
[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 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_COLOUR_H_
13 #define _WX_COLOUR_H_
14
15 #include "wx/object.h"
16 #include "wx/string.h"
17
18 // Colour
19 class WXDLLIMPEXP_CORE wxColour : public wxColourBase
20 {
21 DECLARE_DYNAMIC_CLASS(wxColour)
22 public:
23 // constructors
24 // ------------
25 DEFINE_STD_WXCOLOUR_CONSTRUCTORS
26
27 // copy ctors and assignment operators
28 wxColour( const wxColour& col );
29 wxColour& operator = ( const wxColour& col );
30
31 // dtor
32 virtual ~wxColour();
33
34
35 // accessors
36 virtual bool IsOk() const {return m_isInit; }
37 unsigned char Red() const { return m_red; }
38 unsigned char Green() const { return m_green; }
39 unsigned char Blue() const { return m_blue; }
40
41 WXPixel GetPixel() const { return m_pixel; };
42 void SetPixel(WXPixel pixel) { m_pixel = pixel; m_isInit = true; };
43
44 inline bool operator == (const wxColour& colour) const { return (m_red == colour.m_red && m_green == colour.m_green && m_blue == colour.m_blue); }
45
46 inline bool operator != (const wxColour& colour) const { return (!(m_red == colour.m_red && m_green == colour.m_green && m_blue == colour.m_blue)); }
47
48 // Allocate a colour, or nearest colour, using the given display.
49 // If realloc is true, ignore the existing pixel, otherwise just return
50 // the existing one.
51 // Returns the allocated pixel.
52
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.
55
56 WXPixel AllocColour(WXDisplay* display, bool realloc = false);
57
58 protected:
59 // Helper function
60 void Init();
61
62 virtual void
63 InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
64
65 private:
66 bool m_isInit;
67 unsigned char m_red;
68 unsigned char m_blue;
69 unsigned char m_green;
70
71 public:
72 WXPixel m_pixel;
73 };
74
75 #endif
76 // _WX_COLOUR_H_