2003-03-21 21:56:04 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2005-10-05 12:22:44 -04:00
|
|
|
// Name: wx/cocoa/colour.h
|
2003-03-21 21:56:04 -05:00
|
|
|
// Purpose: wxColour class
|
2003-06-19 17:24:10 -04:00
|
|
|
// Author: David Elliott
|
2003-03-21 21:56:04 -05:00
|
|
|
// Modified by:
|
2003-06-19 17:24:10 -04:00
|
|
|
// Created: 2003/06/17
|
2003-03-21 21:56:04 -05:00
|
|
|
// RCS-ID: $Id$
|
2003-06-19 17:24:10 -04:00
|
|
|
// Copyright: (c) 2003 David Elliott
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
2003-03-21 21:56:04 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2003-06-19 17:24:10 -04:00
|
|
|
#ifndef __WX_COCOA_COLOUR_H__
|
|
|
|
#define __WX_COCOA_COLOUR_H__
|
2003-03-21 21:56:04 -05:00
|
|
|
|
|
|
|
#include "wx/object.h"
|
|
|
|
#include "wx/string.h"
|
|
|
|
|
2003-06-19 17:24:10 -04:00
|
|
|
// ========================================================================
|
|
|
|
// wxColour
|
|
|
|
// ========================================================================
|
2006-04-24 10:52:23 -04:00
|
|
|
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxColour : public wxColourBase
|
2003-03-21 21:56:04 -05:00
|
|
|
{
|
|
|
|
public:
|
2005-10-05 12:22:44 -04:00
|
|
|
// constructors
|
|
|
|
// ------------
|
2007-12-22 10:03:58 -05:00
|
|
|
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
|
2003-12-11 05:10:40 -05:00
|
|
|
|
2005-01-10 13:37:36 -05:00
|
|
|
// initialization using existing NSColor
|
|
|
|
wxColour( WX_NSColor aColor );
|
|
|
|
|
2003-03-21 21:56:04 -05:00
|
|
|
// copy ctors and assignment operators
|
2003-06-19 17:24:10 -04:00
|
|
|
wxColour( const wxColour& col );
|
|
|
|
wxColour& operator = ( const wxColour& col );
|
2003-03-21 21:56:04 -05:00
|
|
|
|
2004-01-22 07:16:04 -05:00
|
|
|
virtual ~wxColour();
|
2003-03-21 21:56:04 -05:00
|
|
|
|
2003-06-19 17:24:10 -04:00
|
|
|
// accessors
|
2007-12-15 12:54:20 -05:00
|
|
|
virtual bool IsOk() const { return m_cocoaNSColor; }
|
2004-01-22 07:16:04 -05:00
|
|
|
WX_NSColor GetNSColor() { return m_cocoaNSColor; }
|
2008-06-11 15:17:41 -04:00
|
|
|
WX_NSColor GetNSColor() const { return m_cocoaNSColor; }
|
2003-03-21 21:56:04 -05:00
|
|
|
|
2003-06-19 17:24:10 -04:00
|
|
|
unsigned char Red() const { return m_red; }
|
|
|
|
unsigned char Green() const { return m_green; }
|
|
|
|
unsigned char Blue() const { return m_blue; }
|
2006-08-28 05:53:33 -04:00
|
|
|
unsigned char Alpha() const { return m_alpha; }
|
2003-03-21 21:56:04 -05:00
|
|
|
|
2003-06-19 17:24:10 -04:00
|
|
|
// comparison
|
|
|
|
bool operator == (const wxColour& colour) const
|
|
|
|
{
|
2006-08-28 05:53:33 -04:00
|
|
|
return m_cocoaNSColor == colour.m_cocoaNSColor ||
|
|
|
|
(m_red == colour.m_red &&
|
|
|
|
m_green == colour.m_green &&
|
|
|
|
m_blue == colour.m_blue &&
|
|
|
|
m_alpha == colour.m_alpha);
|
2003-06-19 17:24:10 -04:00
|
|
|
}
|
|
|
|
bool operator != (const wxColour& colour) const
|
2006-08-28 05:53:33 -04:00
|
|
|
{ return !(*this == colour); }
|
2003-03-21 21:56:04 -05:00
|
|
|
|
2003-06-19 17:24:10 -04:00
|
|
|
// Set() functions
|
2005-01-10 13:37:36 -05:00
|
|
|
void Set( WX_NSColor aColor );
|
2006-08-28 05:53:33 -04:00
|
|
|
|
2006-07-05 09:10:46 -04:00
|
|
|
// reroute the inherited ones
|
2006-08-28 05:53:33 -04:00
|
|
|
void Set(unsigned char red,
|
|
|
|
unsigned char green,
|
|
|
|
unsigned char blue,
|
|
|
|
unsigned char alpha = wxALPHA_OPAQUE)
|
|
|
|
{ wxColourBase::Set(red, green, blue, alpha); }
|
|
|
|
|
2006-07-05 09:10:46 -04:00
|
|
|
bool Set(const wxString &str)
|
2006-08-28 05:53:33 -04:00
|
|
|
{ return wxColourBase::Set(str); }
|
|
|
|
|
2006-07-05 09:10:46 -04:00
|
|
|
void Set(unsigned long colRGB)
|
2006-08-28 05:53:33 -04:00
|
|
|
{ wxColourBase::Set(colRGB); }
|
|
|
|
|
2004-01-22 07:16:04 -05:00
|
|
|
protected:
|
|
|
|
// puts the object in an invalid, uninitialized state
|
|
|
|
void Init();
|
|
|
|
|
2006-09-09 22:00:24 -04:00
|
|
|
virtual void
|
|
|
|
InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
|
2003-03-21 21:56:04 -05:00
|
|
|
|
|
|
|
private:
|
2003-06-19 17:24:10 -04:00
|
|
|
WX_NSColor m_cocoaNSColor;
|
|
|
|
unsigned char m_red;
|
|
|
|
unsigned char m_green;
|
|
|
|
unsigned char m_blue;
|
2006-08-28 05:53:33 -04:00
|
|
|
unsigned char m_alpha;
|
2004-01-22 07:16:04 -05:00
|
|
|
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxColour)
|
2003-03-21 21:56:04 -05:00
|
|
|
};
|
|
|
|
|
2003-06-19 17:24:10 -04:00
|
|
|
#endif // __WX_COCOA_COLOUR_H__
|