]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/colour.h
take const address objects in wxSocketClient::Connect() and wxSocketBase::SetLocal()
[wxWidgets.git] / include / wx / cocoa / colour.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/colour.h
3 // Purpose: wxColour class
4 // Author: David Elliott
5 // Modified by:
6 // Created: 2003/06/17
7 // RCS-ID: $Id$
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __WX_COCOA_COLOUR_H__
13 #define __WX_COCOA_COLOUR_H__
14
15 #include "wx/object.h"
16 #include "wx/string.h"
17
18 // ========================================================================
19 // wxColour
20 // ========================================================================
21
22 class WXDLLIMPEXP_CORE wxColour : public wxColourBase
23 {
24 public:
25 // constructors
26 // ------------
27 DEFINE_STD_WXCOLOUR_CONSTRUCTORS
28
29 // initialization using existing NSColor
30 wxColour( WX_NSColor aColor );
31
32 // copy ctors and assignment operators
33 wxColour( const wxColour& col );
34 wxColour& operator = ( const wxColour& col );
35
36 virtual ~wxColour();
37
38 // accessors
39 virtual bool IsOk() const { return m_cocoaNSColor; }
40 WX_NSColor GetNSColor() { return m_cocoaNSColor; }
41 WX_NSColor GetNSColor() const { return m_cocoaNSColor; }
42
43 unsigned char Red() const { return m_red; }
44 unsigned char Green() const { return m_green; }
45 unsigned char Blue() const { return m_blue; }
46 unsigned char Alpha() const { return m_alpha; }
47
48 // comparison
49 bool operator == (const wxColour& colour) const
50 {
51 return m_cocoaNSColor == colour.m_cocoaNSColor ||
52 (m_red == colour.m_red &&
53 m_green == colour.m_green &&
54 m_blue == colour.m_blue &&
55 m_alpha == colour.m_alpha);
56 }
57 bool operator != (const wxColour& colour) const
58 { return !(*this == colour); }
59
60 // Set() functions
61 void Set( WX_NSColor aColor );
62
63 // reroute the inherited ones
64 void Set(unsigned char red,
65 unsigned char green,
66 unsigned char blue,
67 unsigned char alpha = wxALPHA_OPAQUE)
68 { wxColourBase::Set(red, green, blue, alpha); }
69
70 bool Set(const wxString &str)
71 { return wxColourBase::Set(str); }
72
73 void Set(unsigned long colRGB)
74 { wxColourBase::Set(colRGB); }
75
76 protected:
77 // puts the object in an invalid, uninitialized state
78 void Init();
79
80 virtual void
81 InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
82
83 private:
84 WX_NSColor m_cocoaNSColor;
85 unsigned char m_red;
86 unsigned char m_green;
87 unsigned char m_blue;
88 unsigned char m_alpha;
89
90 DECLARE_DYNAMIC_CLASS(wxColour)
91 };
92
93 #endif // __WX_COCOA_COLOUR_H__