]>
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; } | |
a24aff65 | 49 | |
683b185d DE |
50 | // comparison |
51 | bool operator == (const wxColour& colour) const | |
52 | { | |
d8fdd58f | 53 | // TODO: Really compare the NSColor |
aad6765c | 54 | return (m_cocoaNSColor == colour.m_cocoaNSColor |
d8fdd58f | 55 | || (m_red == colour.m_red |
aad6765c | 56 | && m_green == colour.m_green |
d8fdd58f | 57 | && m_blue == colour.m_blue)); |
683b185d DE |
58 | } |
59 | bool operator != (const wxColour& colour) const | |
60 | { return !(*this == colour); } | |
a24aff65 | 61 | |
683b185d | 62 | // Set() functions |
d8fdd58f | 63 | void Set( WX_NSColor aColor ); |
a24aff65 | 64 | |
211436b6 VZ |
65 | protected: |
66 | // puts the object in an invalid, uninitialized state | |
67 | void Init(); | |
68 | ||
40989e46 | 69 | virtual void InitWith( unsigned char red, unsigned char green, unsigned char blue ); |
a24aff65 DE |
70 | |
71 | private: | |
683b185d DE |
72 | WX_NSColor m_cocoaNSColor; |
73 | unsigned char m_red; | |
74 | unsigned char m_green; | |
75 | unsigned char m_blue; | |
211436b6 VZ |
76 | |
77 | DECLARE_DYNAMIC_CLASS(wxColour) | |
a24aff65 DE |
78 | }; |
79 | ||
683b185d | 80 | #endif // __WX_COCOA_COLOUR_H__ |