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