]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/colour.h
synched Clear() and SetBackgroundColour()
[wxWidgets.git] / include / wx / gtk1 / colour.h
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: colour.h
3// Purpose:
4// Author: Robert Roebling
dbf858b5 5// Id: $Id$
01111366 6// Copyright: (c) 1998 Robert Roebling
8bbe427f 7// Licence: wxWindows licence
c801d85f
KB
8/////////////////////////////////////////////////////////////////////////////
9
10
11#ifndef __GTKCOLOURH__
12#define __GTKCOLOURH__
13
14#ifdef __GNUG__
15#pragma interface
16#endif
17
18#include "wx/defs.h"
19#include "wx/object.h"
20#include "wx/string.h"
21#include "wx/gdiobj.h"
401ec7b6 22#include "wx/palette.h"
c801d85f
KB
23
24//-----------------------------------------------------------------------------
25// classes
26//-----------------------------------------------------------------------------
27
28class wxDC;
29class wxPaintDC;
30class wxBitmap;
31class wxWindow;
32
33class wxColour;
34
35//-----------------------------------------------------------------------------
36// wxColour
37//-----------------------------------------------------------------------------
38
39class wxColour: public wxGDIObject
40{
e4a81a2e
VZ
41public:
42 // ctors
43 // default
44 wxColour();
45 // from RGB
31811e1a 46 wxColour( unsigned char red, unsigned char green, unsigned char blue );
5f83a454
RD
47 wxColour( unsigned long colRGB ) { Set(colRGB); }
48
e4a81a2e
VZ
49 // implicit conversion from the colour name
50 wxColour( const wxString &colourName ) { InitFromName(colourName); }
51 wxColour( const char *colourName ) { InitFromName(colourName); }
52
53 // copy ctors and assignment operators
54 wxColour( const wxColour& col );
e4a81a2e
VZ
55 wxColour& operator = ( const wxColour& col );
56
57 // dtor
58 ~wxColour();
59
60 // comparison
61 bool operator == ( const wxColour& col );
62 bool operator != ( const wxColour& col );
8bbe427f 63
e4a81a2e
VZ
64 // accessors
65 void Set( unsigned char red, unsigned char green, unsigned char blue );
5f83a454
RD
66 void Set( unsigned long colRGB )
67 {
68 // we don't need to know sizeof(long) here because we assume that the three
69 // least significant bytes contain the R, G and B values
70 Set((unsigned char)colRGB,
71 (unsigned char)(colRGB >> 8),
72 (unsigned char)(colRGB >> 16));
73 }
74
e4a81a2e
VZ
75 unsigned char Red() const;
76 unsigned char Green() const;
77 unsigned char Blue() const;
78 bool Ok() const;
79
80 // implementation
81 void CalcPixel( GdkColormap *cmap );
82 int GetPixel() const;
83 GdkColor *GetColor() const;
c0ac1c32 84
68dda785 85protected:
e4a81a2e
VZ
86 // helper functions
87 void InitFromName(const wxString& colourName);
68dda785
VZ
88
89private:
e4a81a2e 90 DECLARE_DYNAMIC_CLASS(wxColour)
c801d85f 91};
c0ac1c32 92
c801d85f 93#endif // __GTKCOLOURH__