]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/colour.h
Made some treectrl sample icons transparent; added toolbar.h to wx.h
[wxWidgets.git] / include / wx / os2 / colour.h
CommitLineData
0e320a79
DW
1/////////////////////////////////////////////////////////////////////////////
2// Name: colour.h
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
0e320a79
DW
9// Licence: wxWindows licence
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:
21 // ctors
22 // default
23 wxColour();
24 // from RGB
25 wxColour( unsigned char red, unsigned char green, unsigned char blue );
26 // implicit conversion from the colour name
27 wxColour( const wxString &colourName ) { InitFromName(colourName); }
28 wxColour( const char *colourName ) { InitFromName(colourName); }
29
30 // copy ctors and assignment operators
31 wxColour( const wxColour& col );
32 wxColour( const wxColour* col );
33 wxColour& operator = ( const wxColour& col );
34
35 // dtor
36 ~wxColour();
37
38 // Set() functions
39 void Set( unsigned char red, unsigned char green, unsigned char blue );
40 void Set( unsigned long colRGB )
41 {
42 // we don't need to know sizeof(long) here because we assume that the three
43 // least significant bytes contain the R, G and B values
44 Set((unsigned char)colRGB,
45 (unsigned char)(colRGB >> 8),
46 (unsigned char)(colRGB >> 16));
47 }
48
49 // accessors
50 bool Ok() const {return m_isInit; }
51
52 // Let's remove this inelegant function
53#if WXWIN_COMPATIBILITY
54 void Get(unsigned char *r, unsigned char *g, unsigned char *b) const;
55#endif
56
57 unsigned char Red() const { return m_red; }
58 unsigned char Green() const { return m_green; }
59 unsigned char Blue() const { return m_blue; }
60
61 // comparison
62 bool operator == (const wxColour& colour) const
63 {
37f214d5
DW
64 return (m_red == colour.m_red &&
65 m_green == colour.m_green &&
0e320a79
DW
66 m_blue == colour.m_blue);
67 }
68 bool operator != (const wxColour& colour) const { return !(*this == colour); }
69
70 void InitFromName(const wxString& col);
71
72/* TODO
73 WXCOLORREF GetPixel() const { return m_pixel; };
74*/
75
76private:
77 bool m_isInit;
78 unsigned char m_red;
79 unsigned char m_blue;
80 unsigned char m_green;
81
82public:
0e320a79 83 WXCOLORREF m_pixel ;
0e320a79
DW
84private:
85 DECLARE_DYNAMIC_CLASS(wxColour)
86};
87
88#endif
89 // _WX_COLOUR_H_