2003-03-22 02:56:04 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2005-10-05 16:22:44 +00:00
|
|
|
// Name: wx/cocoa/colour.h
|
2003-03-22 02:56:04 +00:00
|
|
|
// Purpose: wxColour class
|
2003-06-19 21:24:10 +00:00
|
|
|
// Author: David Elliott
|
2003-03-22 02:56:04 +00:00
|
|
|
// Modified by:
|
2003-06-19 21:24:10 +00:00
|
|
|
// Created: 2003/06/17
|
2003-03-22 02:56:04 +00:00
|
|
|
// RCS-ID: $Id$
|
2003-06-19 21:24:10 +00:00
|
|
|
// Copyright: (c) 2003 David Elliott
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
2003-03-22 02:56:04 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2003-06-19 21:24:10 +00:00
|
|
|
#ifndef __WX_COCOA_COLOUR_H__
|
|
|
|
#define __WX_COCOA_COLOUR_H__
|
2003-03-22 02:56:04 +00:00
|
|
|
|
|
|
|
#include "wx/object.h"
|
|
|
|
#include "wx/string.h"
|
|
|
|
|
2003-06-19 21:24:10 +00:00
|
|
|
// ========================================================================
|
|
|
|
// wxColour
|
|
|
|
// ========================================================================
|
2006-04-24 14:52:23 +00:00
|
|
|
|
|
|
|
class WXDLLEXPORT wxColour : public wxColourBase
|
2003-03-22 02:56:04 +00:00
|
|
|
{
|
|
|
|
public:
|
2005-10-05 16:22:44 +00:00
|
|
|
// constructors
|
|
|
|
// ------------
|
|
|
|
|
|
|
|
// default
|
2004-01-22 12:16:04 +00:00
|
|
|
wxColour() { Init(); }
|
2006-04-24 14:52:23 +00:00
|
|
|
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
|
2003-12-11 10:10:40 +00:00
|
|
|
|
2005-01-10 18:37:36 +00:00
|
|
|
// initialization using existing NSColor
|
|
|
|
wxColour( WX_NSColor aColor );
|
|
|
|
|
2003-03-22 02:56:04 +00:00
|
|
|
|
|
|
|
// copy ctors and assignment operators
|
2003-06-19 21:24:10 +00:00
|
|
|
wxColour( const wxColour& col );
|
|
|
|
wxColour& operator = ( const wxColour& col );
|
2003-03-22 02:56:04 +00:00
|
|
|
|
2004-01-22 12:16:04 +00:00
|
|
|
virtual ~wxColour();
|
2003-03-22 02:56:04 +00:00
|
|
|
|
2003-06-19 21:24:10 +00:00
|
|
|
// accessors
|
|
|
|
bool Ok() const { return m_cocoaNSColor; }
|
2004-01-22 12:16:04 +00:00
|
|
|
WX_NSColor GetNSColor() { return m_cocoaNSColor; }
|
2003-03-22 02:56:04 +00:00
|
|
|
|
2003-06-19 21:24:10 +00:00
|
|
|
unsigned char Red() const { return m_red; }
|
|
|
|
unsigned char Green() const { return m_green; }
|
|
|
|
unsigned char Blue() const { return m_blue; }
|
2003-03-22 02:56:04 +00:00
|
|
|
|
2003-06-19 21:24:10 +00:00
|
|
|
// comparison
|
|
|
|
bool operator == (const wxColour& colour) const
|
|
|
|
{
|
2005-01-10 18:37:36 +00:00
|
|
|
// TODO: Really compare the NSColor
|
2003-12-11 10:10:40 +00:00
|
|
|
return (m_cocoaNSColor == colour.m_cocoaNSColor
|
2005-01-10 18:37:36 +00:00
|
|
|
|| (m_red == colour.m_red
|
2003-12-11 10:10:40 +00:00
|
|
|
&& m_green == colour.m_green
|
2005-01-10 18:37:36 +00:00
|
|
|
&& m_blue == colour.m_blue));
|
2003-06-19 21:24:10 +00:00
|
|
|
}
|
|
|
|
bool operator != (const wxColour& colour) const
|
|
|
|
{ return !(*this == colour); }
|
2003-03-22 02:56:04 +00:00
|
|
|
|
2003-06-19 21:24:10 +00:00
|
|
|
// Set() functions
|
2005-01-10 18:37:36 +00:00
|
|
|
void Set( WX_NSColor aColor );
|
2006-07-05 13:10:46 +00:00
|
|
|
|
|
|
|
// reroute the inherited ones
|
|
|
|
void Set(unsigned char red, unsigned char green, unsigned char blue)
|
|
|
|
{ wxColourBase::Set(red,green,blue); }
|
|
|
|
|
|
|
|
// implemented in colourcmn.cpp
|
|
|
|
bool Set(const wxChar *str)
|
|
|
|
{ return wxColourBase::Set(str); }
|
|
|
|
|
|
|
|
bool Set(const wxString &str)
|
|
|
|
{ return wxColourBase::Set(str); }
|
|
|
|
|
|
|
|
void Set(unsigned long colRGB)
|
|
|
|
{ wxColourBase::Set(colRGB); }
|
|
|
|
|
2004-01-22 12:16:04 +00:00
|
|
|
protected:
|
|
|
|
// puts the object in an invalid, uninitialized state
|
|
|
|
void Init();
|
|
|
|
|
2006-04-24 14:52:23 +00:00
|
|
|
virtual void InitWith( unsigned char red, unsigned char green, unsigned char blue );
|
2003-03-22 02:56:04 +00:00
|
|
|
|
|
|
|
private:
|
2003-06-19 21:24:10 +00:00
|
|
|
WX_NSColor m_cocoaNSColor;
|
|
|
|
unsigned char m_red;
|
|
|
|
unsigned char m_green;
|
|
|
|
unsigned char m_blue;
|
2004-01-22 12:16:04 +00:00
|
|
|
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxColour)
|
2003-03-22 02:56:04 +00:00
|
|
|
};
|
|
|
|
|
2003-06-19 21:24:10 +00:00
|
|
|
#endif // __WX_COCOA_COLOUR_H__
|