]> git.saurik.com Git - wxWidgets.git/blame - include/wx/mac/carbon/colour.h
Solaris /usr/bin/tr requires [] around character ranges
[wxWidgets.git] / include / wx / mac / carbon / colour.h
CommitLineData
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
20struct RGBColor;
21
8cf73271 22// Colour
ee19674c 23class WXDLLEXPORT wxColour: public wxColourBase
8cf73271
SC
24{
25public:
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
f84a986c 37 bool IsOk() const;
edc536d3 38
efb19095
SC
39 ChannelType Red() const { return m_red; }
40 ChannelType Green() const { return m_green; }
41 ChannelType Blue() const { return m_blue; }
42 ChannelType Alpha() const { return m_alpha; }
edc536d3
WS
43
44 // comparison
efb19095
SC
45 bool operator == (const wxColour& colour) const;
46
edc536d3
WS
47 bool operator != (const wxColour& colour) const { return !(*this == colour); }
48
efb19095 49 CGColorRef GetPixel() const { return m_cgColour; };
850df2d7
SC
50
51 CGColorRef GetCGColor() const { return m_cgColour; };
52 CGColorRef CreateCGColor() const { return wxCFRetain( (CGColorRef)m_cgColour ); };
53
efb19095 54 void GetRGBColor( RGBColor *col ) const;
8cf73271 55
055de350 56 // Mac-specific ctor and assignment operator from the native colour
efb19095
SC
57 // assumes ownership of CGColorRef
58 wxColour( CGColorRef col );
055de350
VZ
59 wxColour(const RGBColor& col);
60 wxColour& operator=(const RGBColor& col);
efb19095 61 wxColour& operator=(CGColorRef col);
055de350 62
8cf73271
SC
63protected :
64
8cf73271 65
aea95b1c 66 virtual void
efb19095
SC
67 InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a);
68 void InitRGBColor( const RGBColor& col );
69 void InitCGColorRef( CGColorRef col );
8cf73271 70private:
efb19095 71 wxCFRef<CGColorRef> m_cgColour;
8cf73271 72
efb19095
SC
73 ChannelType m_red;
74 ChannelType m_blue;
75 ChannelType m_green;
76 ChannelType m_alpha;
aea95b1c 77
edc536d3 78 DECLARE_DYNAMIC_CLASS(wxColour)
8cf73271
SC
79};
80
81#endif
82 // _WX_COLOUR_H_