]>
Commit | Line | Data |
---|---|---|
8cf73271 | 1 | ///////////////////////////////////////////////////////////////////////////// |
edc536d3 | 2 | // Name: wx/mac/carbon/colour.h |
8cf73271 SC |
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 | |
65571936 | 9 | // Licence: wxWindows licence |
8cf73271 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_COLOUR_H_ | |
13 | #define _WX_COLOUR_H_ | |
14 | ||
8cf73271 SC |
15 | #include "wx/object.h" |
16 | #include "wx/string.h" | |
17 | ||
efb19095 SC |
18 | #include "wx/mac/corefoundation/cfref.h" |
19 | ||
055de350 VZ |
20 | struct RGBColor; |
21 | ||
8cf73271 | 22 | // Colour |
ee19674c | 23 | class WXDLLEXPORT wxColour: public wxColourBase |
8cf73271 SC |
24 | { |
25 | public: | |
edc536d3 WS |
26 | // constructors |
27 | // ------------ | |
ee19674c | 28 | DEFINE_STD_WXCOLOUR_CONSTRUCTORS |
8cf73271 | 29 | |
9ef6890f | 30 | // default copy ctor and dtor are ok |
edc536d3 | 31 | |
edc536d3 | 32 | // accessors |
8f884a0d | 33 | virtual bool IsOk() const { return m_cgColour; } |
edc536d3 | 34 | |
efb19095 SC |
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; } | |
edc536d3 WS |
39 | |
40 | // comparison | |
efb19095 | 41 | bool operator == (const wxColour& colour) const; |
9ef6890f | 42 | |
edc536d3 WS |
43 | bool operator != (const wxColour& colour) const { return !(*this == colour); } |
44 | ||
efb19095 | 45 | CGColorRef GetPixel() const { return m_cgColour; }; |
9ef6890f | 46 | |
850df2d7 SC |
47 | CGColorRef GetCGColor() const { return m_cgColour; }; |
48 | CGColorRef CreateCGColor() const { return wxCFRetain( (CGColorRef)m_cgColour ); }; | |
9ef6890f | 49 | |
efb19095 | 50 | void GetRGBColor( RGBColor *col ) const; |
8cf73271 | 51 | |
055de350 | 52 | // Mac-specific ctor and assignment operator from the native colour |
efb19095 SC |
53 | // assumes ownership of CGColorRef |
54 | wxColour( CGColorRef col ); | |
055de350 VZ |
55 | wxColour(const RGBColor& col); |
56 | wxColour& operator=(const RGBColor& col); | |
efb19095 | 57 | wxColour& operator=(CGColorRef col); |
e8db0e1e | 58 | wxColour& operator=(const wxColour& col); |
055de350 | 59 | |
8cf73271 | 60 | protected : |
aea95b1c | 61 | virtual void |
efb19095 SC |
62 | InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a); |
63 | void InitRGBColor( const RGBColor& col ); | |
64 | void InitCGColorRef( CGColorRef col ); | |
8cf73271 | 65 | private: |
efb19095 | 66 | wxCFRef<CGColorRef> m_cgColour; |
8cf73271 | 67 | |
efb19095 SC |
68 | ChannelType m_red; |
69 | ChannelType m_blue; | |
70 | ChannelType m_green; | |
71 | ChannelType m_alpha; | |
aea95b1c | 72 | |
edc536d3 | 73 | DECLARE_DYNAMIC_CLASS(wxColour) |
8cf73271 SC |
74 | }; |
75 | ||
76 | #endif | |
77 | // _WX_COLOUR_H_ |