]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/colour.h
As in 2.2.9, toolbars should not get the focus.
[wxWidgets.git] / include / wx / mac / colour.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: colour.h
3 // Purpose: wxColour class
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_COLOUR_H_
13 #define _WX_COLOUR_H_
14
15 #ifdef __GNUG__
16 #pragma interface "colour.h"
17 #endif
18
19 #include "wx/object.h"
20 #include "wx/string.h"
21
22 // Colour
23 class WXDLLEXPORT wxColour: public wxObject
24 {
25 public:
26 // ctors
27 // default
28 wxColour();
29 // from RGB
30 wxColour( unsigned char red, unsigned char green, unsigned char blue );
31 wxColour( unsigned long colRGB ) { Set(colRGB); }
32
33 // implicit conversion from the colour name
34 wxColour( const wxString &colourName ) { InitFromName(colourName); }
35 wxColour( const char *colourName ) { InitFromName(colourName); }
36
37 // copy ctors and assignment operators
38 wxColour( const wxColour& col );
39 wxColour( const wxColour* col );
40 wxColour& operator = ( const wxColour& col );
41
42 // dtor
43 ~wxColour();
44
45 // Set() functions
46 void Set( unsigned char red, unsigned char green, unsigned char blue );
47 void Set( unsigned long colRGB )
48 {
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
51 Set((unsigned char)colRGB,
52 (unsigned char)(colRGB >> 8),
53 (unsigned char)(colRGB >> 16));
54 }
55
56 // accessors
57 bool Ok() const {return m_isInit; }
58
59 // Let's remove this inelegant function
60 #if WXWIN_COMPATIBILITY
61 void Get(unsigned char *r, unsigned char *g, unsigned char *b) const;
62 #endif
63
64 unsigned char Red() const { return m_red; }
65 unsigned char Green() const { return m_green; }
66 unsigned char Blue() const { return m_blue; }
67
68 // comparison
69 bool operator == (const wxColour& colour) const
70 {
71 return (m_isInit == colour.m_isInit &&
72 m_red == colour.m_red &&
73 m_green == colour.m_green &&
74 m_blue == colour.m_blue);
75 }
76 bool operator != (const wxColour& colour) { return !(*this == colour); }
77
78 void InitFromName(const wxString& col);
79
80 const WXCOLORREF& GetPixel() const { return m_pixel; };
81
82 private:
83 bool m_isInit;
84 unsigned char m_red;
85 unsigned char m_blue;
86 unsigned char m_green;
87
88 public:
89 WXCOLORREF m_pixel ;
90 void Set( const WXCOLORREF* color ) ;
91
92 private:
93 DECLARE_DYNAMIC_CLASS(wxColour)
94 };
95
96 #endif
97 // _WX_COLOUR_H_