]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/core/colour.h
Replace 3 copies of wxListCtrl mode tests with a single one in wxListCtrlBase.
[wxWidgets.git] / include / wx / osx / core / colour.h
CommitLineData
17d65207 1/////////////////////////////////////////////////////////////////////////////
233f5738 2// Name: wx/osx/core/colour.h
17d65207
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
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/osx/core/cfref.h"
19
20struct RGBColor;
21
22// Colour
23class WXDLLIMPEXP_CORE wxColour: public wxColourBase
24{
25public:
26 // constructors
27 // ------------
28 DEFINE_STD_WXCOLOUR_CONSTRUCTORS
29
30 // default copy ctor and dtor are ok
31
32 // accessors
c4021a79 33 virtual bool IsOk() const { return m_cgColour != NULL; }
17d65207 34
74cc3ec1
SC
35 virtual WXDLLIMPEXP_INLINE_CORE ChannelType Red() const { return m_red; }
36 virtual WXDLLIMPEXP_INLINE_CORE ChannelType Green() const { return m_green; }
37 virtual WXDLLIMPEXP_INLINE_CORE ChannelType Blue() const { return m_blue; }
38 virtual WXDLLIMPEXP_INLINE_CORE ChannelType Alpha() const { return m_alpha; }
17d65207
SC
39
40 // comparison
41 bool operator == (const wxColour& colour) const;
42
43 bool operator != (const wxColour& colour) const { return !(*this == colour); }
44
6dd0883d 45 CGColorRef GetPixel() const { return m_cgColour; }
17d65207 46
6dd0883d
SN
47 CGColorRef GetCGColor() const { return m_cgColour; }
48 CGColorRef CreateCGColor() const { return wxCFRetain( (CGColorRef)m_cgColour ); }
17d65207 49
e630b0f0 50#if wxOSX_USE_COCOA_OR_CARBON
17d65207
SC
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 );
e630b0f0 57#if wxOSX_USE_COCOA_OR_CARBON
17d65207
SC
58 wxColour(const RGBColor& col);
59 wxColour& operator=(const RGBColor& col);
b478f242
KO
60#endif
61#if wxOSX_USE_COCOA
62 wxColour(WX_NSColor color);
83586c2a 63 WX_NSColor OSXGetNSColor() const;
17d65207
SC
64#endif
65 wxColour& operator=(CGColorRef col);
66 wxColour& operator=(const wxColour& col);
67
68protected :
69 virtual void
70 InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a);
e630b0f0 71#if wxOSX_USE_COCOA_OR_CARBON
17d65207
SC
72 void InitRGBColor( const RGBColor& col );
73#endif
74 void InitCGColorRef( CGColorRef col );
b478f242 75 void InitFromComponents(const CGFloat* components, size_t numComponents );
17d65207
SC
76private:
77 wxCFRef<CGColorRef> m_cgColour;
78
79 ChannelType m_red;
80 ChannelType m_blue;
81 ChannelType m_green;
82 ChannelType m_alpha;
83
84 DECLARE_DYNAMIC_CLASS(wxColour)
85};
86
87#endif
88 // _WX_COLOUR_H_