1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/colour.h
3 // Purpose: wxColour class
4 // Author: David Elliott
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __WX_COCOA_COLOUR_H__
13 #define __WX_COCOA_COLOUR_H__
15 #include "wx/object.h"
16 #include "wx/string.h"
18 // ========================================================================
20 // ========================================================================
22 class WXDLLEXPORT wxColour
: public wxColourBase
29 wxColour() { Init(); }
30 DEFINE_STD_WXCOLOUR_CONSTRUCTORS
32 // initialization using existing NSColor
33 wxColour( WX_NSColor aColor
);
36 // copy ctors and assignment operators
37 wxColour( const wxColour
& col
);
38 wxColour
& operator = ( const wxColour
& col
);
43 bool Ok() const { return m_cocoaNSColor
; }
44 WX_NSColor
GetNSColor() { return m_cocoaNSColor
; }
46 unsigned char Red() const { return m_red
; }
47 unsigned char Green() const { return m_green
; }
48 unsigned char Blue() const { return m_blue
; }
51 bool operator == (const wxColour
& colour
) const
53 // TODO: Really compare the NSColor
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
));
59 bool operator != (const wxColour
& colour
) const
60 { return !(*this == colour
); }
63 void Set( WX_NSColor aColor
);
65 // reroute the inherited ones
66 void Set(unsigned char red
, unsigned char green
, unsigned char blue
)
67 { wxColourBase::Set(red
,green
,blue
); }
69 // implemented in colourcmn.cpp
70 bool Set(const wxChar
*str
)
71 { return wxColourBase::Set(str
); }
73 bool Set(const wxString
&str
)
74 { return wxColourBase::Set(str
); }
76 void Set(unsigned long colRGB
)
77 { wxColourBase::Set(colRGB
); }
80 // puts the object in an invalid, uninitialized state
83 virtual void InitWith( unsigned char red
, unsigned char green
, unsigned char blue
);
86 WX_NSColor m_cocoaNSColor
;
88 unsigned char m_green
;
91 DECLARE_DYNAMIC_CLASS(wxColour
)
94 #endif // __WX_COCOA_COLOUR_H__