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