]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/motif/colour.h
fixed wxGTK1 compilation after wxDC changes (still doesn't work)
[wxWidgets.git] / include / wx / motif / colour.h
... / ...
CommitLineData
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
19class WXDLLEXPORT wxColour : public wxColourBase
20{
21 DECLARE_DYNAMIC_CLASS(wxColour)
22public:
23 // constructors
24 // ------------
25
26 // default
27 wxColour() { Init(); }
28 DEFINE_STD_WXCOLOUR_CONSTRUCTORS
29
30 // copy ctors and assignment operators
31 wxColour( const wxColour& col );
32 wxColour& operator = ( const wxColour& col );
33
34 // dtor
35 virtual ~wxColour();
36
37
38 // accessors
39 virtual bool IsOk() const {return m_isInit; }
40 unsigned char Red() const { return m_red; }
41 unsigned char Green() const { return m_green; }
42 unsigned char Blue() const { return m_blue; }
43
44 WXPixel GetPixel() const { return m_pixel; };
45 void SetPixel(WXPixel pixel) { m_pixel = pixel; m_isInit = true; };
46
47 inline bool operator == (const wxColour& colour) const { return (m_red == colour.m_red && m_green == colour.m_green && m_blue == colour.m_blue); }
48
49 inline bool operator != (const wxColour& colour) const { return (!(m_red == colour.m_red && m_green == colour.m_green && m_blue == colour.m_blue)); }
50
51 // Allocate a colour, or nearest colour, using the given display.
52 // If realloc is true, ignore the existing pixel, otherwise just return
53 // the existing one.
54 // Returns the allocated pixel.
55
56 // TODO: can this handle mono displays? If not, we should have an extra
57 // flag to specify whether this should be black or white by default.
58
59 WXPixel AllocColour(WXDisplay* display, bool realloc = false);
60
61protected:
62 // Helper function
63 void Init();
64
65 virtual void
66 InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
67
68private:
69 bool m_isInit;
70 unsigned char m_red;
71 unsigned char m_blue;
72 unsigned char m_green;
73
74public:
75 WXPixel m_pixel;
76};
77
78#endif
79// _WX_COLOUR_H_