]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/colour.h
Prevent seg fault for older GTK+
[wxWidgets.git] / include / wx / gtk1 / colour.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/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
44 virtual ~wxColour();
45
46 virtual bool FromString(const wxString& str);
47
48 bool Ok() const { return IsOk(); }
49 bool IsOk() const { return m_refData != NULL; }
50
51 bool operator == ( const wxColour& col ) const;
52 bool operator != ( const wxColour& col ) const { return !(*this == col); }
53
54 unsigned char Red() const;
55 unsigned char Green() const;
56 unsigned char Blue() const;
57
58
59 // Implementation part
60 void CalcPixel( GdkColormap *cmap );
61 int GetPixel() const;
62 GdkColor *GetColor() const;
63
64 protected:
65 // ref counting code
66 virtual wxObjectRefData *CreateRefData() const;
67 virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
68
69 virtual void
70 InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);
71
72 private:
73 DECLARE_DYNAMIC_CLASS(wxColour)
74 };
75
76 #endif // __GTKCOLOURH__