]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/colour.h
Added style flags for selection mode.
[wxWidgets.git] / include / wx / os2 / colour.h
CommitLineData
0e320a79 1/////////////////////////////////////////////////////////////////////////////
edc536d3 2// Name: wx/os2/colour.h
0e320a79 3// Purpose: wxColour class
37f214d5 4// Author: David Webster
0e320a79 5// Modified by:
37f214d5 6// Created: 10/13/99
0e320a79 7// RCS-ID: $Id$
37f214d5 8// Copyright: (c) David Webster
65571936 9// Licence: wxWindows licence
0e320a79
DW
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_COLOUR_H_
13#define _WX_COLOUR_H_
14
0e320a79 15#include "wx/object.h"
0e320a79
DW
16
17// Colour
18class WXDLLEXPORT wxColour: public wxObject
19{
20public:
edc536d3
WS
21 // constructors
22 // ------------
a0606634 23
edc536d3 24 // default
a0606634
DW
25 wxColour();
26
edc536d3
WS
27 // from separate RGB
28 wxColour( unsigned char cRed, unsigned char cGreen, unsigned char cBlue );
a0606634 29
edc536d3 30 // from packed RGB
19193a2c
KB
31 wxColour( unsigned long colRGB ) { Set(colRGB); }
32
a0606634 33 // Implicit conversion from the colour name
a0606634 34 wxColour(const wxString& rColourName) { InitFromName(rColourName); }
aad6765c 35 wxColour(const wxChar *zColourName) { InitFromName(zColourName); }
a0606634 36
a0606634 37 // Copy ctors and assignment operators
a0606634
DW
38 wxColour(const wxColour& rCol);
39 wxColour(const wxColour* pCol);
40 wxColour&operator = (const wxColour& rCol);
41
a0606634 42 // Dtor
a0606634
DW
43 ~wxColour();
44
a0606634 45 // Set functions
edc536d3
WS
46 void Set( unsigned char cRed, unsigned char cGreen, unsigned char cBlue);
47 void Set( unsigned long lColRGB)
a0606634 48 {
a0606634
DW
49 // We don't need to know sizeof(long) here because we assume that the three
50 // least significant bytes contain the R, G and B values
a0606634
DW
51 Set( (unsigned char)lColRGB
52 ,(unsigned char)(lColRGB >> 8)
53 ,(unsigned char)(lColRGB >> 16)
54 );
55 }
5a56a532
DW
56 void Set(const wxString& rsColour)
57 {
58 InitFromName(rsColour);
59 }
a0606634 60
a0606634
DW
61 // Accessors
62 bool Ok(void) const {return m_bIsInit; }
63
a0606634
DW
64 unsigned char Red(void) const { return m_cRed; }
65 unsigned char Green(void) const { return m_cGreen; }
66 unsigned char Blue(void) const { return m_cBlue; }
0e320a79 67
a0606634 68 // Comparison
a0606634
DW
69 bool operator == (const wxColour& rColour) const
70 {
edb8604f 71 return (m_bIsInit == rColour.m_bIsInit
aad6765c
JS
72 && m_cRed == rColour.m_cRed
73 && m_cGreen == rColour.m_cGreen
74 && m_cBlue == rColour.m_cBlue
a0606634
DW
75 );
76 }
aad6765c 77
a0606634 78 bool operator != (const wxColour& rColour) const { return !(*this == rColour); }
0e320a79 79
a0606634 80 WXCOLORREF GetPixel(void) const { return m_vPixel; };
0e320a79 81
aad6765c
JS
82 void InitFromName(const wxString& rCol);
83
0e320a79 84private:
aad6765c
JS
85
86 // Helper function
87 void Init();
88
a0606634
DW
89 bool m_bIsInit;
90 unsigned char m_cRed;
91 unsigned char m_cBlue;
92 unsigned char m_cGreen;
0e320a79
DW
93
94public:
a0606634 95 WXCOLORREF m_vPixel ;
0e320a79 96private:
edc536d3 97 DECLARE_DYNAMIC_CLASS(wxColour)
a0606634 98}; // end of class wxColour
0e320a79
DW
99
100#endif
101 // _WX_COLOUR_H_