]>
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() { } |
ee19674c | 31 | DEFINE_STD_WXCOLOUR_CONSTRUCTORS |
8cf73271 | 32 | |
8cf73271 | 33 | // dtor |
d3c7fc99 | 34 | virtual ~wxColour(); |
edc536d3 | 35 | |
edc536d3 | 36 | // accessors |
b7cacb43 | 37 | bool Ok() const { return IsOk(); } |
f84a986c | 38 | bool IsOk() const; |
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 SC |
50 | CGColorRef GetPixel() const { return m_cgColour; }; |
51 | void GetRGBColor( RGBColor *col ) const; | |
8cf73271 | 52 | |
055de350 | 53 | // Mac-specific ctor and assignment operator from the native colour |
efb19095 SC |
54 | // assumes ownership of CGColorRef |
55 | wxColour( CGColorRef col ); | |
055de350 VZ |
56 | wxColour(const RGBColor& col); |
57 | wxColour& operator=(const RGBColor& col); | |
efb19095 | 58 | wxColour& operator=(CGColorRef col); |
055de350 | 59 | |
8cf73271 SC |
60 | protected : |
61 | ||
8cf73271 | 62 | |
aea95b1c | 63 | virtual void |
efb19095 SC |
64 | InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a); |
65 | void InitRGBColor( const RGBColor& col ); | |
66 | void InitCGColorRef( CGColorRef col ); | |
8cf73271 | 67 | private: |
efb19095 | 68 | wxCFRef<CGColorRef> m_cgColour; |
8cf73271 | 69 | |
efb19095 SC |
70 | ChannelType m_red; |
71 | ChannelType m_blue; | |
72 | ChannelType m_green; | |
73 | ChannelType m_alpha; | |
aea95b1c | 74 | |
edc536d3 | 75 | DECLARE_DYNAMIC_CLASS(wxColour) |
8cf73271 SC |
76 | }; |
77 | ||
78 | #endif | |
79 | // _WX_COLOUR_H_ |