]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/colour.h
changing to wxDC, so that wxGCDC can be used as well
[wxWidgets.git] / include / wx / mac / carbon / colour.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mac/carbon/colour.h
3 // Purpose: wxColour class
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_COLOUR_H_
13 #define _WX_COLOUR_H_
14
15 #include "wx/object.h"
16 #include "wx/string.h"
17
18 #include "wx/mac/corefoundation/cfref.h"
19
20 struct RGBColor;
21
22 // Colour
23 class WXDLLEXPORT wxColour: public wxColourBase
24 {
25 public:
26 // constructors
27 // ------------
28
29 // default
30 wxColour() { }
31 wxColour( const wxColour& col );
32 DEFINE_STD_WXCOLOUR_CONSTRUCTORS
33
34 // dtor
35 virtual ~wxColour();
36
37 // accessors
38 virtual bool IsOk() const { return m_cgColour; }
39
40 ChannelType Red() const { return m_red; }
41 ChannelType Green() const { return m_green; }
42 ChannelType Blue() const { return m_blue; }
43 ChannelType Alpha() const { return m_alpha; }
44
45 // comparison
46 bool operator == (const wxColour& colour) const;
47
48 bool operator != (const wxColour& colour) const { return !(*this == colour); }
49
50 CGColorRef GetPixel() const { return m_cgColour; };
51
52 CGColorRef GetCGColor() const { return m_cgColour; };
53 CGColorRef CreateCGColor() const { return wxCFRetain( (CGColorRef)m_cgColour ); };
54
55 void GetRGBColor( RGBColor *col ) const;
56
57 // Mac-specific ctor and assignment operator from the native colour
58 // assumes ownership of CGColorRef
59 wxColour( CGColorRef col );
60 wxColour(const RGBColor& col);
61 wxColour& operator=(const RGBColor& col);
62 wxColour& operator=(CGColorRef col);
63 wxColour& operator=(const wxColour& col);
64
65 protected :
66
67
68 virtual void
69 InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a);
70 void InitRGBColor( const RGBColor& col );
71 void InitCGColorRef( CGColorRef col );
72 private:
73 wxCFRef<CGColorRef> m_cgColour;
74
75 ChannelType m_red;
76 ChannelType m_blue;
77 ChannelType m_green;
78 ChannelType m_alpha;
79
80 DECLARE_DYNAMIC_CLASS(wxColour)
81 };
82
83 #endif
84 // _WX_COLOUR_H_