1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface for wxColour
7 // Created: 7-July-1997
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
16 //---------------------------------------------------------------------------
20 class wxColour : public wxObject {
22 wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0);
25 %name(NamedColour) wxColour( const wxString& colorName);
26 %name(ColourRGB) wxColour( unsigned long colRGB );
29 unsigned char Green();
32 void Set(unsigned char red, unsigned char green, unsigned char blue);
33 %name(SetRGB) void Set(unsigned long colRGB);
35 bool operator==(const wxColour& colour) const;
36 bool operator != (const wxColour& colour) const;
38 void InitFromName(const wxString& colourName);
42 PyObject* rv = PyTuple_New(3);
48 green = self->Green();
51 PyTuple_SetItem(rv, 0, PyInt_FromLong(red));
52 PyTuple_SetItem(rv, 1, PyInt_FromLong(green));
53 PyTuple_SetItem(rv, 2, PyInt_FromLong(blue));
56 // bool __eq__(PyObject* obj) {
58 // wxColour* ptr = &tmp;
59 // if (obj == Py_None) return False;
60 // wxPyBLOCK_THREADS(bool success = wxColour_helper(obj, &ptr); PyErr_Clear());
61 // if (! success) return False;
62 // return *self == *ptr;
64 // bool __ne__(PyObject* obj) {
66 // wxColour* ptr = &tmp;
67 // if (obj == Py_None) return True;
68 // wxPyBLOCK_THREADS(bool success = wxColour_helper(obj, &ptr); PyErr_Clear());
69 // if (! success) return True;
70 // return *self != *ptr;
77 def __str__(self): return str(self.asTuple())
78 def __repr__(self): return 'wx.Colour' + str(self.asTuple())
79 def __nonzero__(self): return self.Ok()
80 __safe_for_unpickling__ = True
81 def __reduce__(self): return (Colour, self.Get())
87 NamedColor = NamedColour
91 //---------------------------------------------------------------------------