]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/colour.h
optimize rendering code by calling GetClientSize(), GetTextExtent() and CalculateAbsW...
[wxWidgets.git] / include / wx / generic / colour.h
CommitLineData
32b8ec41 1/////////////////////////////////////////////////////////////////////////////
3da12c22 2// Name: wx/generic/colour.h
32b8ec41
VZ
3// Purpose: wxColour class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
65571936 9// Licence: wxWindows licence
32b8ec41
VZ
10/////////////////////////////////////////////////////////////////////////////
11
3da12c22
VS
12#ifndef _WX_GENERIC_COLOUR_H_
13#define _WX_GENERIC_COLOUR_H_
32b8ec41 14
32b8ec41
VZ
15#include "wx/object.h"
16
17// Colour
53a2db12 18class WXDLLIMPEXP_CORE wxColour: public wxColourBase
32b8ec41
VZ
19{
20public:
edc536d3
WS
21 // constructors
22 // ------------
40989e46 23 DEFINE_STD_WXCOLOUR_CONSTRUCTORS
32b8ec41 24
edc536d3 25 // copy ctors and assignment operators
001828ed
VZ
26 wxColour(const wxColour& col)
27 {
28 *this = col;
29 }
32b8ec41 30
001828ed 31 wxColour& operator=(const wxColour& col);
32b8ec41 32
32b8ec41 33 // accessors
8f884a0d 34 virtual bool IsOk() const { return m_isInit; }
32b8ec41 35
32b8ec41
VZ
36 unsigned char Red() const { return m_red; }
37 unsigned char Green() const { return m_green; }
38 unsigned char Blue() const { return m_blue; }
7f5426f0 39 unsigned char Alpha() const { return m_alpha; }
32b8ec41
VZ
40
41 // comparison
7f5426f0 42 bool operator==(const wxColour& colour) const
32b8ec41 43 {
edc536d3
WS
44 return (m_red == colour.m_red &&
45 m_green == colour.m_green &&
46 m_blue == colour.m_blue &&
7f5426f0 47 m_alpha == colour.m_alpha &&
edc536d3 48 m_isInit == colour.m_isInit);
32b8ec41 49 }
32b8ec41 50
7f5426f0 51 bool operator!=(const wxColour& colour) const { return !(*this == colour); }
aad6765c
JS
52
53protected:
54
55 // Helper function
56 void Init();
57
aea95b1c
VZ
58 virtual void
59 InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
40989e46 60
32b8ec41
VZ
61private:
62 bool m_isInit;
63 unsigned char m_red;
64 unsigned char m_blue;
65 unsigned char m_green;
7f5426f0 66 unsigned char m_alpha;
32b8ec41 67
32b8ec41
VZ
68private:
69 DECLARE_DYNAMIC_CLASS(wxColour)
70};
71
3da12c22 72#endif // _WX_GENERIC_COLOUR_H_