]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/colour.h
788466d8e96b94dd79b665853191fa8ee7269fe2
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #ifndef __GTKCOLOURH__
12 #define __GTKCOLOURH__
14 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
19 #include "wx/object.h"
20 #include "wx/string.h"
21 #include "wx/gdiobj.h"
22 #include "wx/palette.h"
24 //-----------------------------------------------------------------------------
26 //-----------------------------------------------------------------------------
35 //-----------------------------------------------------------------------------
37 //-----------------------------------------------------------------------------
39 class wxColour
: public wxGDIObject
45 wxColour( unsigned char red
, unsigned char green
, unsigned char blue
);
46 wxColour( unsigned long colRGB
) { Set(colRGB
); }
48 // Implicit conversion from the colour name
49 wxColour( const wxString
&colourName
) { InitFromName(colourName
); }
50 wxColour( const char *colourName
) { InitFromName( wxString::FromAscii(colourName
) ); }
52 wxColour( const wxChar
*colourName
) { InitFromName( wxString(colourName
) ); }
56 wxColour( const wxColour
& col
)
59 wxColour
& operator = ( const wxColour
& col
) { Ref(col
); return *this; }
63 bool Ok() const { return m_refData
!= NULL
; }
65 bool operator == ( const wxColour
& col
) const;
66 bool operator != ( const wxColour
& col
) const { return !(*this == col
); }
68 void Set( unsigned char red
, unsigned char green
, unsigned char blue
);
69 void Set( unsigned long colRGB
)
71 // We don't need to know sizeof(long) here because we assume that the three
72 // least significant bytes contain the R, G and B values
73 Set((unsigned char)colRGB
,
74 (unsigned char)(colRGB
>> 8),
75 (unsigned char)(colRGB
>> 16));
78 unsigned char Red() const;
79 unsigned char Green() const;
80 unsigned char Blue() const;
83 // Get colour from name or wxNullColour
84 static wxColour
CreateByName(const wxString
& name
);
86 // Implementation part
87 void CalcPixel( GdkColormap
*cmap
);
89 GdkColor
*GetColor() const;
91 void InitFromName(const wxString
& colourName
);
95 virtual wxObjectRefData
*CreateRefData() const;
96 virtual wxObjectRefData
*CloneRefData(const wxObjectRefData
*data
) const;
100 DECLARE_DYNAMIC_CLASS(wxColour
)
103 #endif // __GTKCOLOURH__