1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: colour.h
|
|
|
|
// Purpose:
|
|
|
|
// Author: Robert Roebling
|
1998-10-26 10:56:58 +00:00
|
|
|
// Id: $Id$
|
1998-10-24 17:12:05 +00:00
|
|
|
// Copyright: (c) 1998 Robert Roebling
|
1998-12-09 17:30:17 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:01:55 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __GTKCOLOURH__
|
|
|
|
#define __GTKCOLOURH__
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
|
|
|
#include "wx/object.h"
|
|
|
|
#include "wx/string.h"
|
|
|
|
#include "wx/gdiobj.h"
|
1998-07-11 09:53:58 +00:00
|
|
|
#include "wx/palette.h"
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// classes
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxDC;
|
|
|
|
class wxPaintDC;
|
|
|
|
class wxBitmap;
|
|
|
|
class wxWindow;
|
|
|
|
|
|
|
|
class wxColour;
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// wxColour
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class wxColour: public wxGDIObject
|
|
|
|
{
|
1998-10-20 14:35:22 +00:00
|
|
|
public:
|
|
|
|
// ctors
|
|
|
|
// default
|
|
|
|
wxColour();
|
|
|
|
// from RGB
|
1998-10-27 17:09:42 +00:00
|
|
|
wxColour( unsigned char red, unsigned char green, unsigned char blue );
|
1999-02-04 19:03:55 +00:00
|
|
|
wxColour( unsigned long colRGB ) { Set(colRGB); }
|
|
|
|
|
1998-10-20 14:35:22 +00:00
|
|
|
// implicit conversion from the colour name
|
|
|
|
wxColour( const wxString &colourName ) { InitFromName(colourName); }
|
|
|
|
wxColour( const char *colourName ) { InitFromName(colourName); }
|
|
|
|
|
|
|
|
// copy ctors and assignment operators
|
|
|
|
wxColour( const wxColour& col );
|
|
|
|
wxColour& operator = ( const wxColour& col );
|
|
|
|
|
|
|
|
// dtor
|
|
|
|
~wxColour();
|
|
|
|
|
|
|
|
// comparison
|
1999-02-18 14:55:34 +00:00
|
|
|
bool operator == ( const wxColour& col ) const;
|
|
|
|
bool operator != ( const wxColour& col ) const;
|
1998-12-09 17:30:17 +00:00
|
|
|
|
1998-10-20 14:35:22 +00:00
|
|
|
// accessors
|
|
|
|
void Set( unsigned char red, unsigned char green, unsigned char blue );
|
1999-02-04 19:03:55 +00:00
|
|
|
void Set( unsigned long colRGB )
|
|
|
|
{
|
|
|
|
// we don't need to know sizeof(long) here because we assume that the three
|
|
|
|
// least significant bytes contain the R, G and B values
|
|
|
|
Set((unsigned char)colRGB,
|
|
|
|
(unsigned char)(colRGB >> 8),
|
|
|
|
(unsigned char)(colRGB >> 16));
|
|
|
|
}
|
|
|
|
|
1998-10-20 14:35:22 +00:00
|
|
|
unsigned char Red() const;
|
|
|
|
unsigned char Green() const;
|
|
|
|
unsigned char Blue() const;
|
|
|
|
bool Ok() const;
|
|
|
|
|
|
|
|
// implementation
|
|
|
|
void CalcPixel( GdkColormap *cmap );
|
|
|
|
int GetPixel() const;
|
|
|
|
GdkColor *GetColor() const;
|
1998-10-20 02:10:29 +00:00
|
|
|
|
1998-10-19 14:18:56 +00:00
|
|
|
protected:
|
1998-10-20 14:35:22 +00:00
|
|
|
// helper functions
|
|
|
|
void InitFromName(const wxString& colourName);
|
1998-10-19 14:18:56 +00:00
|
|
|
|
|
|
|
private:
|
1998-10-20 14:35:22 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxColour)
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
1998-10-20 02:10:29 +00:00
|
|
|
|
1998-05-20 14:01:55 +00:00
|
|
|
#endif // __GTKCOLOURH__
|