2004-03-23 17:35:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2005-10-05 16:22:44 +00:00
|
|
|
// Name: wx/mac/carbon/colour.h
|
2004-03-23 17:35:05 +00:00
|
|
|
// Purpose: wxColour class
|
|
|
|
// Author: Stefan Csomor
|
|
|
|
// Modified by:
|
|
|
|
// Created: 1998-01-01
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Stefan Csomor
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
2004-03-23 17:35:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_COLOUR_H_
|
|
|
|
#define _WX_COLOUR_H_
|
|
|
|
|
|
|
|
#include "wx/object.h"
|
|
|
|
#include "wx/string.h"
|
|
|
|
|
2007-11-22 17:45:58 +00:00
|
|
|
#include "wx/mac/corefoundation/cfref.h"
|
|
|
|
|
2007-03-10 15:48:56 +00:00
|
|
|
struct RGBColor;
|
|
|
|
|
2004-03-23 17:35:05 +00:00
|
|
|
// Colour
|
2006-04-25 12:40:19 +00:00
|
|
|
class WXDLLEXPORT wxColour: public wxColourBase
|
2004-03-23 17:35:05 +00:00
|
|
|
{
|
|
|
|
public:
|
2005-10-05 16:22:44 +00:00
|
|
|
// constructors
|
|
|
|
// ------------
|
2006-04-25 12:40:19 +00:00
|
|
|
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
|
2004-03-23 17:35:05 +00:00
|
|
|
|
2007-12-22 15:03:58 +00:00
|
|
|
// default copy ctor and dtor are ok
|
2005-10-05 16:22:44 +00:00
|
|
|
|
|
|
|
// accessors
|
2007-12-15 17:54:20 +00:00
|
|
|
virtual bool IsOk() const { return m_cgColour; }
|
2005-10-05 16:22:44 +00:00
|
|
|
|
2007-11-22 17:45:58 +00:00
|
|
|
ChannelType Red() const { return m_red; }
|
|
|
|
ChannelType Green() const { return m_green; }
|
|
|
|
ChannelType Blue() const { return m_blue; }
|
|
|
|
ChannelType Alpha() const { return m_alpha; }
|
2005-10-05 16:22:44 +00:00
|
|
|
|
|
|
|
// comparison
|
2007-11-22 17:45:58 +00:00
|
|
|
bool operator == (const wxColour& colour) const;
|
2007-12-22 15:03:58 +00:00
|
|
|
|
2005-10-05 16:22:44 +00:00
|
|
|
bool operator != (const wxColour& colour) const { return !(*this == colour); }
|
|
|
|
|
2007-11-22 17:45:58 +00:00
|
|
|
CGColorRef GetPixel() const { return m_cgColour; };
|
2007-12-22 15:03:58 +00:00
|
|
|
|
2007-11-23 09:23:54 +00:00
|
|
|
CGColorRef GetCGColor() const { return m_cgColour; };
|
|
|
|
CGColorRef CreateCGColor() const { return wxCFRetain( (CGColorRef)m_cgColour ); };
|
2007-12-22 15:03:58 +00:00
|
|
|
|
2007-11-22 17:45:58 +00:00
|
|
|
void GetRGBColor( RGBColor *col ) const;
|
2004-03-23 17:35:05 +00:00
|
|
|
|
2007-03-10 15:48:56 +00:00
|
|
|
// Mac-specific ctor and assignment operator from the native colour
|
2007-11-22 17:45:58 +00:00
|
|
|
// assumes ownership of CGColorRef
|
|
|
|
wxColour( CGColorRef col );
|
2007-03-10 15:48:56 +00:00
|
|
|
wxColour(const RGBColor& col);
|
|
|
|
wxColour& operator=(const RGBColor& col);
|
2007-11-22 17:45:58 +00:00
|
|
|
wxColour& operator=(CGColorRef col);
|
2007-12-18 13:15:05 +00:00
|
|
|
wxColour& operator=(const wxColour& col);
|
2007-03-10 15:48:56 +00:00
|
|
|
|
2004-03-23 17:35:05 +00:00
|
|
|
protected :
|
2006-09-10 02:00:24 +00:00
|
|
|
virtual void
|
2007-11-22 17:45:58 +00:00
|
|
|
InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a);
|
|
|
|
void InitRGBColor( const RGBColor& col );
|
|
|
|
void InitCGColorRef( CGColorRef col );
|
2004-03-23 17:35:05 +00:00
|
|
|
private:
|
2007-11-22 17:45:58 +00:00
|
|
|
wxCFRef<CGColorRef> m_cgColour;
|
2004-03-23 17:35:05 +00:00
|
|
|
|
2007-11-22 17:45:58 +00:00
|
|
|
ChannelType m_red;
|
|
|
|
ChannelType m_blue;
|
|
|
|
ChannelType m_green;
|
|
|
|
ChannelType m_alpha;
|
2006-09-10 02:00:24 +00:00
|
|
|
|
2005-10-05 16:22:44 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxColour)
|
2004-03-23 17:35:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_COLOUR_H_
|