]>
Commit | Line | Data |
---|---|---|
5c6eb3a8 SC |
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 WXDLLIMPEXP_CORE wxColour: public wxColourBase | |
24 | { | |
25 | public: | |
26 | // constructors | |
27 | // ------------ | |
28 | DEFINE_STD_WXCOLOUR_CONSTRUCTORS | |
29 | ||
30 | // default copy ctor and dtor are ok | |
31 | ||
32 | // accessors | |
33 | virtual bool IsOk() const { return m_cgColour; } | |
34 | ||
35 | ChannelType Red() const { return m_red; } | |
36 | ChannelType Green() const { return m_green; } | |
37 | ChannelType Blue() const { return m_blue; } | |
38 | ChannelType Alpha() const { return m_alpha; } | |
39 | ||
40 | // comparison | |
41 | bool operator == (const wxColour& colour) const; | |
42 | ||
43 | bool operator != (const wxColour& colour) const { return !(*this == colour); } | |
44 | ||
45 | CGColorRef GetPixel() const { return m_cgColour; }; | |
46 | ||
47 | CGColorRef GetCGColor() const { return m_cgColour; }; | |
48 | CGColorRef CreateCGColor() const { return wxCFRetain( (CGColorRef)m_cgColour ); }; | |
49 | ||
50 | #if wxMAC_USE_QUICKDRAW | |
51 | void GetRGBColor( RGBColor *col ) const; | |
52 | #endif | |
53 | ||
54 | // Mac-specific ctor and assignment operator from the native colour | |
55 | // assumes ownership of CGColorRef | |
56 | wxColour( CGColorRef col ); | |
57 | #if wxMAC_USE_QUICKDRAW | |
58 | wxColour(const RGBColor& col); | |
59 | wxColour& operator=(const RGBColor& col); | |
60 | #endif | |
61 | wxColour& operator=(CGColorRef col); | |
62 | wxColour& operator=(const wxColour& col); | |
63 | ||
64 | protected : | |
65 | virtual void | |
66 | InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a); | |
67 | #if wxMAC_USE_QUICKDRAW | |
68 | void InitRGBColor( const RGBColor& col ); | |
69 | #endif | |
70 | void InitCGColorRef( CGColorRef col ); | |
71 | private: | |
72 | wxCFRef<CGColorRef> m_cgColour; | |
73 | ||
74 | ChannelType m_red; | |
75 | ChannelType m_blue; | |
76 | ChannelType m_green; | |
77 | ChannelType m_alpha; | |
78 | ||
79 | DECLARE_DYNAMIC_CLASS(wxColour) | |
80 | }; | |
81 | ||
82 | #endif | |
83 | // _WX_COLOUR_H_ |