1. more accurate conversion from 8-bit wx color to 16-bit GDK color
[wxWidgets.git] / include / wx / gtk / colour.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/colour.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef __GTKCOLOURH__
11 #define __GTKCOLOURH__
12
13 #include "wx/defs.h"
14 #include "wx/object.h"
15 #include "wx/string.h"
16 #include "wx/gdiobj.h"
17 #include "wx/palette.h"
18
19 //-----------------------------------------------------------------------------
20 // classes
21 //-----------------------------------------------------------------------------
22
23 class WXDLLIMPEXP_CORE wxDC;
24 class WXDLLIMPEXP_CORE wxPaintDC;
25 class WXDLLIMPEXP_CORE wxBitmap;
26 class WXDLLIMPEXP_CORE wxWindow;
27
28 class WXDLLIMPEXP_CORE wxColour;
29
30 //-----------------------------------------------------------------------------
31 // wxColour
32 //-----------------------------------------------------------------------------
33
34 class WXDLLIMPEXP_CORE wxColour : public wxColourBase
35 {
36 public:
37 // constructors
38 // ------------
39
40 // default
41 wxColour() {}
42 DEFINE_STD_WXCOLOUR_CONSTRUCTORS
43 wxColour(const GdkColor& gdkColor);
44
45 ~wxColour();
46
47 bool Ok() const { return m_refData != NULL; }
48
49 bool operator == ( const wxColour& col ) const;
50 bool operator != ( const wxColour& col ) const { return !(*this == col); }
51
52 unsigned char Red() const;
53 unsigned char Green() const;
54 unsigned char Blue() const;
55
56 // Implementation part
57 void CalcPixel( GdkColormap *cmap );
58 int GetPixel() const;
59 const GdkColor *GetColor() const;
60
61 protected:
62 virtual bool FromString(const wxChar *str);
63 virtual void InitWith( unsigned char red, unsigned char green, unsigned char blue );
64
65 private:
66 DECLARE_DYNAMIC_CLASS(wxColour)
67 };
68
69 #endif // __GTKCOLOURH__