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