]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/colour.h
Adds mimietype.h to OS/2 port
[wxWidgets.git] / include / wx / os2 / colour.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: colour.h
3 // Purpose: wxColour class
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/13/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_COLOUR_H_
13 #define _WX_COLOUR_H_
14
15 #include "wx/object.h"
16
17 // Colour
18 class WXDLLEXPORT wxColour: public wxObject
19 {
20 public:
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 {
64 return (m_red == colour.m_red &&
65 m_green == colour.m_green &&
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
76 private:
77 bool m_isInit;
78 unsigned char m_red;
79 unsigned char m_blue;
80 unsigned char m_green;
81
82 public:
83 WXCOLORREF m_pixel ;
84 private:
85 DECLARE_DYNAMIC_CLASS(wxColour)
86 };
87
88 #endif
89 // _WX_COLOUR_H_