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
27 DEFINE_STD_WXCOLOUR_CONSTRUCTORS
29 // initialization using existing NSColor
30 wxColour( WX_NSColor aColor
);
32 // copy ctors and assignment operators
33 wxColour( const wxColour
& col
);
34 wxColour
& operator = ( const wxColour
& col
);
39 virtual bool IsOk() const { return m_cocoaNSColor
; }
40 WX_NSColor
GetNSColor() { return m_cocoaNSColor
; }
42 unsigned char Red() const { return m_red
; }
43 unsigned char Green() const { return m_green
; }
44 unsigned char Blue() const { return m_blue
; }
45 unsigned char Alpha() const { return m_alpha
; }
48 bool operator == (const wxColour
& colour
) const
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
);
56 bool operator != (const wxColour
& colour
) const
57 { return !(*this == colour
); }
60 void Set( WX_NSColor aColor
);
62 // reroute the inherited ones
63 void Set(unsigned char red
,
66 unsigned char alpha
= wxALPHA_OPAQUE
)
67 { wxColourBase::Set(red
, green
, blue
, alpha
); }
69 bool Set(const wxString
&str
)
70 { return wxColourBase::Set(str
); }
72 void Set(unsigned long colRGB
)
73 { wxColourBase::Set(colRGB
); }
76 // puts the object in an invalid, uninitialized state
80 InitRGBA(unsigned char r
, unsigned char g
, unsigned char b
, unsigned char a
);
83 WX_NSColor m_cocoaNSColor
;
85 unsigned char m_green
;
87 unsigned char m_alpha
;
89 DECLARE_DYNAMIC_CLASS(wxColour
)
92 #endif // __WX_COCOA_COLOUR_H__