2008-07-31 06:22:23 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2010-07-13 09:29:58 -04:00
|
|
|
// Name: wx/osx/core/colour.h
|
2008-07-31 06:22:23 -04:00
|
|
|
// Purpose: wxColour class
|
|
|
|
// Author: Stefan Csomor
|
|
|
|
// Modified by:
|
|
|
|
// Created: 1998-01-01
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Stefan Csomor
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_COLOUR_H_
|
|
|
|
#define _WX_COLOUR_H_
|
|
|
|
|
|
|
|
#include "wx/object.h"
|
|
|
|
#include "wx/string.h"
|
|
|
|
|
|
|
|
#include "wx/osx/core/cfref.h"
|
|
|
|
|
|
|
|
struct RGBColor;
|
|
|
|
|
|
|
|
// Colour
|
|
|
|
class WXDLLIMPEXP_CORE wxColour: public wxColourBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// constructors
|
|
|
|
// ------------
|
|
|
|
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
|
|
|
|
|
|
|
|
// default copy ctor and dtor are ok
|
|
|
|
|
|
|
|
// accessors
|
2009-02-18 13:02:53 -05:00
|
|
|
virtual bool IsOk() const { return m_cgColour != NULL; }
|
2008-07-31 06:22:23 -04:00
|
|
|
|
2008-11-02 14:13:54 -05:00
|
|
|
virtual WXDLLIMPEXP_INLINE_CORE ChannelType Red() const { return m_red; }
|
|
|
|
virtual WXDLLIMPEXP_INLINE_CORE ChannelType Green() const { return m_green; }
|
|
|
|
virtual WXDLLIMPEXP_INLINE_CORE ChannelType Blue() const { return m_blue; }
|
|
|
|
virtual WXDLLIMPEXP_INLINE_CORE ChannelType Alpha() const { return m_alpha; }
|
2008-07-31 06:22:23 -04:00
|
|
|
|
|
|
|
// comparison
|
|
|
|
bool operator == (const wxColour& colour) const;
|
|
|
|
|
|
|
|
bool operator != (const wxColour& colour) const { return !(*this == colour); }
|
|
|
|
|
|
|
|
CGColorRef GetPixel() const { return m_cgColour; };
|
|
|
|
|
|
|
|
CGColorRef GetCGColor() const { return m_cgColour; };
|
|
|
|
CGColorRef CreateCGColor() const { return wxCFRetain( (CGColorRef)m_cgColour ); };
|
|
|
|
|
2008-09-06 12:32:00 -04:00
|
|
|
#if wxOSX_USE_COCOA_OR_CARBON
|
2008-07-31 06:22:23 -04:00
|
|
|
void GetRGBColor( RGBColor *col ) const;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Mac-specific ctor and assignment operator from the native colour
|
|
|
|
// assumes ownership of CGColorRef
|
|
|
|
wxColour( CGColorRef col );
|
2008-09-06 12:32:00 -04:00
|
|
|
#if wxOSX_USE_COCOA_OR_CARBON
|
2008-07-31 06:22:23 -04:00
|
|
|
wxColour(const RGBColor& col);
|
|
|
|
wxColour& operator=(const RGBColor& col);
|
2009-10-31 18:20:27 -04:00
|
|
|
#endif
|
|
|
|
#if wxOSX_USE_COCOA
|
|
|
|
wxColour(WX_NSColor color);
|
2011-02-27 07:48:42 -05:00
|
|
|
WX_NSColor OSXGetNSColor() const;
|
2008-07-31 06:22:23 -04:00
|
|
|
#endif
|
|
|
|
wxColour& operator=(CGColorRef col);
|
|
|
|
wxColour& operator=(const wxColour& col);
|
|
|
|
|
|
|
|
protected :
|
|
|
|
virtual void
|
|
|
|
InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a);
|
2008-09-06 12:32:00 -04:00
|
|
|
#if wxOSX_USE_COCOA_OR_CARBON
|
2008-07-31 06:22:23 -04:00
|
|
|
void InitRGBColor( const RGBColor& col );
|
|
|
|
#endif
|
|
|
|
void InitCGColorRef( CGColorRef col );
|
2009-10-31 18:20:27 -04:00
|
|
|
void InitFromComponents(const CGFloat* components, size_t numComponents );
|
2008-07-31 06:22:23 -04:00
|
|
|
private:
|
|
|
|
wxCFRef<CGColorRef> m_cgColour;
|
|
|
|
|
|
|
|
ChannelType m_red;
|
|
|
|
ChannelType m_blue;
|
|
|
|
ChannelType m_green;
|
|
|
|
ChannelType m_alpha;
|
|
|
|
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxColour)
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_COLOUR_H_
|