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 //---------------------------------------------------------------------------
21 class wxColour : public wxObject {
23 wxColour(unsigned char red=0, unsigned char green=0, unsigned char blue=0);
26 %name(NamedColour) wxColour( const wxString& colorName);
27 %name(ColourRGB) wxColour( unsigned long colRGB );
30 unsigned char Green();
33 void Set(unsigned char red, unsigned char green, unsigned char blue);
34 %name(SetRBG) void Set(unsigned long colRGB);
36 bool operator==(const wxColour& colour) const;
37 bool operator != (const wxColour& colour) const;
41 PyObject* rv = PyTuple_New(3);
47 green = self->Green();
50 PyTuple_SetItem(rv, 0, PyInt_FromLong(red));
51 PyTuple_SetItem(rv, 1, PyInt_FromLong(green));
52 PyTuple_SetItem(rv, 2, PyInt_FromLong(blue));
55 // bool __eq__(PyObject* obj) {
57 // wxColour* ptr = &tmp;
58 // if (obj == Py_None) return FALSE;
59 // wxPyBLOCK_THREADS(bool success = wxColour_helper(obj, &ptr); PyErr_Clear());
60 // if (! success) return FALSE;
61 // return *self == *ptr;
63 // bool __ne__(PyObject* obj) {
65 // wxColour* ptr = &tmp;
66 // if (obj == Py_None) return TRUE;
67 // wxPyBLOCK_THREADS(bool success = wxColour_helper(obj, &ptr); PyErr_Clear());
68 // if (! success) return TRUE;
69 // return *self != *ptr;
76 def __str__(self): return str(self.asTuple())
77 def __repr__(self): return 'wxColour' + str(self.asTuple())
78 def __nonzero__(self): return self.Ok()
79 def __getinitargs__(self): return ()
80 def __getstate__(self): return self.asTuple()
81 def __setstate__(self, state): self.Set(*state)
85 //---------------------------------------------------------------------------