]>
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 | // ------------ | |
28 | ||
8cf73271 | 29 | // default |
efb19095 | 30 | wxColour() { } |
e8db0e1e | 31 | wxColour( const wxColour& col ); |
ee19674c | 32 | DEFINE_STD_WXCOLOUR_CONSTRUCTORS |
8cf73271 | 33 | |
8cf73271 | 34 | // dtor |
d3c7fc99 | 35 | virtual ~wxColour(); |
edc536d3 | 36 | |
edc536d3 | 37 | // accessors |
8f884a0d | 38 | virtual bool IsOk() const { return m_cgColour; } |
edc536d3 | 39 | |
efb19095 SC |
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; } | |
edc536d3 WS |
44 | |
45 | // comparison | |
efb19095 SC |
46 | bool operator == (const wxColour& colour) const; |
47 | ||
edc536d3 WS |
48 | bool operator != (const wxColour& colour) const { return !(*this == colour); } |
49 | ||
efb19095 | 50 | CGColorRef GetPixel() const { return m_cgColour; }; |
850df2d7 SC |
51 | |
52 | CGColorRef GetCGColor() const { return m_cgColour; }; | |
53 | CGColorRef CreateCGColor() const { return wxCFRetain( (CGColorRef)m_cgColour ); }; | |
54 | ||
efb19095 | 55 | void GetRGBColor( RGBColor *col ) const; |
8cf73271 | 56 | |
055de350 | 57 | // Mac-specific ctor and assignment operator from the native colour |
efb19095 SC |
58 | // assumes ownership of CGColorRef |
59 | wxColour( CGColorRef col ); | |
055de350 VZ |
60 | wxColour(const RGBColor& col); |
61 | wxColour& operator=(const RGBColor& col); | |
efb19095 | 62 | wxColour& operator=(CGColorRef col); |
e8db0e1e | 63 | wxColour& operator=(const wxColour& col); |
055de350 | 64 | |
8cf73271 SC |
65 | protected : |
66 | ||
8cf73271 | 67 | |
aea95b1c | 68 | virtual void |
efb19095 SC |
69 | InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a); |
70 | void InitRGBColor( const RGBColor& col ); | |
71 | void InitCGColorRef( CGColorRef col ); | |
8cf73271 | 72 | private: |
efb19095 | 73 | wxCFRef<CGColorRef> m_cgColour; |
8cf73271 | 74 | |
efb19095 SC |
75 | ChannelType m_red; |
76 | ChannelType m_blue; | |
77 | ChannelType m_green; | |
78 | ChannelType m_alpha; | |
aea95b1c | 79 | |
edc536d3 | 80 | DECLARE_DYNAMIC_CLASS(wxColour) |
8cf73271 SC |
81 | }; |
82 | ||
83 | #endif | |
84 | // _WX_COLOUR_H_ |