]>
Commit | Line | Data |
---|---|---|
a24aff65 | 1 | ///////////////////////////////////////////////////////////////////////////// |
edc536d3 | 2 | // Name: wx/cocoa/colour.h |
a24aff65 | 3 | // Purpose: wxColour class |
683b185d | 4 | // Author: David Elliott |
a24aff65 | 5 | // Modified by: |
683b185d | 6 | // Created: 2003/06/17 |
a24aff65 | 7 | // RCS-ID: $Id$ |
683b185d | 8 | // Copyright: (c) 2003 David Elliott |
65571936 | 9 | // Licence: wxWindows licence |
a24aff65 DE |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
683b185d DE |
12 | #ifndef __WX_COCOA_COLOUR_H__ |
13 | #define __WX_COCOA_COLOUR_H__ | |
a24aff65 DE |
14 | |
15 | #include "wx/object.h" | |
16 | #include "wx/string.h" | |
17 | ||
683b185d DE |
18 | // ======================================================================== |
19 | // wxColour | |
20 | // ======================================================================== | |
40989e46 WS |
21 | |
22 | class WXDLLEXPORT wxColour : public wxColourBase | |
a24aff65 DE |
23 | { |
24 | public: | |
edc536d3 WS |
25 | // constructors |
26 | // ------------ | |
27 | ||
28 | // default | |
211436b6 | 29 | wxColour() { Init(); } |
40989e46 | 30 | DEFINE_STD_WXCOLOUR_CONSTRUCTORS |
aad6765c | 31 | |
d8fdd58f DE |
32 | // initialization using existing NSColor |
33 | wxColour( WX_NSColor aColor ); | |
34 | ||
a24aff65 DE |
35 | |
36 | // copy ctors and assignment operators | |
683b185d DE |
37 | wxColour( const wxColour& col ); |
38 | wxColour& operator = ( const wxColour& col ); | |
a24aff65 | 39 | |
211436b6 | 40 | virtual ~wxColour(); |
a24aff65 | 41 | |
683b185d DE |
42 | // accessors |
43 | bool Ok() const { return m_cocoaNSColor; } | |
211436b6 | 44 | WX_NSColor GetNSColor() { return m_cocoaNSColor; } |
a24aff65 | 45 | |
683b185d DE |
46 | unsigned char Red() const { return m_red; } |
47 | unsigned char Green() const { return m_green; } | |
48 | unsigned char Blue() const { return m_blue; } | |
71064979 | 49 | unsigned char Alpha() const { return m_alpha; } |
a24aff65 | 50 | |
683b185d DE |
51 | // comparison |
52 | bool operator == (const wxColour& colour) const | |
53 | { | |
71064979 VZ |
54 | return m_cocoaNSColor == colour.m_cocoaNSColor || |
55 | (m_red == colour.m_red && | |
56 | m_green == colour.m_green && | |
57 | m_blue == colour.m_blue && | |
58 | m_alpha == colour.m_alpha); | |
683b185d DE |
59 | } |
60 | bool operator != (const wxColour& colour) const | |
71064979 | 61 | { return !(*this == colour); } |
a24aff65 | 62 | |
683b185d | 63 | // Set() functions |
d8fdd58f | 64 | void Set( WX_NSColor aColor ); |
71064979 | 65 | |
747592e7 | 66 | // reroute the inherited ones |
71064979 VZ |
67 | void Set(unsigned char red, |
68 | unsigned char green, | |
69 | unsigned char blue, | |
70 | unsigned char alpha = wxALPHA_OPAQUE) | |
71 | { wxColourBase::Set(red, green, blue, alpha); } | |
72 | ||
747592e7 | 73 | bool Set(const wxChar *str) |
71064979 VZ |
74 | { return wxColourBase::Set(str); } |
75 | ||
747592e7 | 76 | bool Set(const wxString &str) |
71064979 VZ |
77 | { return wxColourBase::Set(str); } |
78 | ||
747592e7 | 79 | void Set(unsigned long colRGB) |
71064979 VZ |
80 | { wxColourBase::Set(colRGB); } |
81 | ||
211436b6 VZ |
82 | protected: |
83 | // puts the object in an invalid, uninitialized state | |
84 | void Init(); | |
85 | ||
71064979 VZ |
86 | virtual void InitWith(unsigned char red, |
87 | unsigned char green, | |
88 | unsigned char blue, | |
89 | unsigned char alpha); | |
a24aff65 DE |
90 | |
91 | private: | |
683b185d DE |
92 | WX_NSColor m_cocoaNSColor; |
93 | unsigned char m_red; | |
94 | unsigned char m_green; | |
95 | unsigned char m_blue; | |
71064979 | 96 | unsigned char m_alpha; |
211436b6 VZ |
97 | |
98 | DECLARE_DYNAMIC_CLASS(wxColour) | |
a24aff65 DE |
99 | }; |
100 | ||
683b185d | 101 | #endif // __WX_COCOA_COLOUR_H__ |