1
/////////////////////////////////////////////////////////////////////////////
2
// Name: wx/osx/core/colour.h
3
// Purpose: wxColour class
4
// Author: Stefan Csomor
7
// RCS-ID: $Id: colour.h 70165 2011-12-29 14:42:13Z SN $
8
// Copyright: (c) Stefan Csomor
9
// Licence: wxWindows licence
10
/////////////////////////////////////////////////////////////////////////////
15
#include "wx/object.h"
16
#include "wx/string.h"
18
#include "wx/osx/core/cfref.h"
23
class WXDLLIMPEXP_CORE wxColour: public wxColourBase
28
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
30
// default copy ctor and dtor are ok
33
virtual bool IsOk() const { return m_cgColour != NULL; }
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; }
41
bool operator == (const wxColour& colour) const;
43
bool operator != (const wxColour& colour) const { return !(*this == colour); }
45
CGColorRef GetPixel() const { return m_cgColour; }
47
CGColorRef GetCGColor() const { return m_cgColour; }
48
CGColorRef CreateCGColor() const { return wxCFRetain( (CGColorRef)m_cgColour ); }
50
#if wxOSX_USE_COCOA_OR_CARBON
51
void GetRGBColor( RGBColor *col ) const;
54
// Mac-specific ctor and assignment operator from the native colour
55
// assumes ownership of CGColorRef
56
wxColour( CGColorRef col );
57
#if wxOSX_USE_COCOA_OR_CARBON
58
wxColour(const RGBColor& col);
59
wxColour& operator=(const RGBColor& col);
62
wxColour(WX_NSColor color);
63
WX_NSColor OSXGetNSColor() const;
65
wxColour& operator=(CGColorRef col);
66
wxColour& operator=(const wxColour& col);
70
InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a);
71
#if wxOSX_USE_COCOA_OR_CARBON
72
void InitRGBColor( const RGBColor& col );
74
void InitCGColorRef( CGColorRef col );
75
void InitFromComponents(const CGFloat* components, size_t numComponents );
77
wxCFRef<CGColorRef> m_cgColour;
84
DECLARE_DYNAMIC_CLASS(wxColour)