2004-03-23 12:35:05 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2005-10-05 12:22:44 -04:00
|
|
|
// Name: wx/mac/carbon/colour.h
|
2004-03-23 12:35:05 -05:00
|
|
|
// Purpose: wxColour class
|
|
|
|
// Author: Stefan Csomor
|
|
|
|
// Modified by:
|
|
|
|
// Created: 1998-01-01
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Stefan Csomor
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
2004-03-23 12:35:05 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_COLOUR_H_
|
|
|
|
#define _WX_COLOUR_H_
|
|
|
|
|
|
|
|
#include "wx/object.h"
|
|
|
|
#include "wx/string.h"
|
|
|
|
|
2007-03-10 10:48:56 -05:00
|
|
|
struct RGBColor;
|
|
|
|
|
2004-03-23 12:35:05 -05:00
|
|
|
// Colour
|
2006-04-25 08:40:19 -04:00
|
|
|
class WXDLLEXPORT wxColour: public wxColourBase
|
2004-03-23 12:35:05 -05:00
|
|
|
{
|
|
|
|
public:
|
2005-10-05 12:22:44 -04:00
|
|
|
// constructors
|
|
|
|
// ------------
|
|
|
|
|
2004-03-23 12:35:05 -05:00
|
|
|
// default
|
2005-10-05 12:22:44 -04:00
|
|
|
wxColour() { Init(); }
|
2006-04-25 08:40:19 -04:00
|
|
|
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
|
2004-03-23 12:35:05 -05:00
|
|
|
|
|
|
|
// dtor
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxColour();
|
2005-10-05 12:22:44 -04:00
|
|
|
|
|
|
|
// accessors
|
2006-10-08 17:56:55 -04:00
|
|
|
bool Ok() const { return IsOk(); }
|
2006-12-19 00:43:19 -05:00
|
|
|
bool IsOk() const;
|
2005-10-05 12:22:44 -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-26 09:33:09 -04:00
|
|
|
unsigned char Alpha() const { return m_alpha; }
|
2005-10-05 12:22:44 -04:00
|
|
|
|
|
|
|
// comparison
|
|
|
|
bool operator == (const wxColour& colour) const
|
|
|
|
{
|
|
|
|
return (m_isInit == colour.m_isInit
|
|
|
|
&& m_red == colour.m_red
|
|
|
|
&& m_green == colour.m_green
|
2006-08-26 09:33:09 -04:00
|
|
|
&& m_blue == colour.m_blue
|
|
|
|
&& m_alpha == colour.m_alpha);
|
2005-10-05 12:22:44 -04:00
|
|
|
}
|
|
|
|
bool operator != (const wxColour& colour) const { return !(*this == colour); }
|
|
|
|
|
|
|
|
const WXCOLORREF& GetPixel() const { return m_pixel; };
|
2004-03-23 12:35:05 -05:00
|
|
|
|
2007-03-10 10:48:56 -05:00
|
|
|
// Mac-specific ctor and assignment operator from the native colour
|
|
|
|
wxColour(const RGBColor& col);
|
|
|
|
wxColour& operator=(const RGBColor& col);
|
|
|
|
|
2004-03-23 12:35:05 -05:00
|
|
|
protected :
|
|
|
|
|
|
|
|
// Helper function
|
|
|
|
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);
|
2006-04-25 08:40:19 -04:00
|
|
|
|
2004-03-23 12:35:05 -05:00
|
|
|
private:
|
2005-10-05 12:22:44 -04:00
|
|
|
bool m_isInit;
|
|
|
|
unsigned char m_red;
|
|
|
|
unsigned char m_blue;
|
|
|
|
unsigned char m_green;
|
2006-08-26 09:33:09 -04:00
|
|
|
unsigned char m_alpha;
|
2004-03-23 12:35:05 -05:00
|
|
|
|
|
|
|
public:
|
2005-10-05 12:22:44 -04:00
|
|
|
WXCOLORREF m_pixel ;
|
2006-11-10 11:03:03 -05:00
|
|
|
void FromRGBColor( WXCOLORREF* color ) ;
|
2006-09-09 22:00:24 -04:00
|
|
|
|
2004-03-23 12:35:05 -05:00
|
|
|
|
|
|
|
private:
|
2005-10-05 12:22:44 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxColour)
|
2004-03-23 12:35:05 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// _WX_COLOUR_H_
|