]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/_colour.i
Force integer values for positions and sizes
[wxWidgets.git] / wxPython / src / _colour.i
index a4382bf318636642c67e8737582d050206de8389..f16e701c48d928b147c27c40c1198e41aae8968a 100644 (file)
@@ -16,7 +16,6 @@
 //---------------------------------------------------------------------------
 %newgroup;
 
-%noautorepr wxColour;
 
 class wxColour : public wxObject {
 public:
@@ -31,11 +30,13 @@ public:
     unsigned char Blue();
     bool Ok();
     void Set(unsigned char red, unsigned char green, unsigned char blue);
-    %name(SetRBG) void Set(unsigned long colRGB);
+    %name(SetRGB) void Set(unsigned long colRGB);
 
     bool operator==(const wxColour& colour) const;
     bool operator != (const wxColour& colour) const;
 
+    void InitFromName(const wxString& colourName);
+
     %extend {
         PyObject* Get() {
             PyObject* rv = PyTuple_New(3);
@@ -55,17 +56,17 @@ public:
 //         bool __eq__(PyObject* obj) {
 //             wxColour  tmp;
 //             wxColour* ptr = &tmp;
-//             if (obj == Py_None)    return FALSE;
+//             if (obj == Py_None)    return False;
 //             wxPyBLOCK_THREADS(bool success = wxColour_helper(obj, &ptr); PyErr_Clear());
-//             if (! success)         return FALSE;
+//             if (! success)         return False;
 //             return *self == *ptr;
 //         }
 //         bool __ne__(PyObject* obj) {
 //             wxColour  tmp;
 //             wxColour* ptr = &tmp;
-//             if (obj == Py_None)    return TRUE;
+//             if (obj == Py_None)    return True;
 //             wxPyBLOCK_THREADS(bool success = wxColour_helper(obj, &ptr); PyErr_Clear());
-//             if (! success)         return TRUE;
+//             if (! success)         return True;
 //             return *self != *ptr;
 //         }
     }
@@ -74,13 +75,17 @@ public:
     %pythoncode {
         asTuple = Get
         def __str__(self):                  return str(self.asTuple())
-        def __repr__(self):                 return 'wxColour' + str(self.asTuple())
+        def __repr__(self):                 return 'wx.Colour' + str(self.asTuple())
         def __nonzero__(self):              return self.Ok()
-        def __getinitargs__(self):          return ()
-        def __getstate__(self):             return self.asTuple()
-        def __setstate__(self, state):      self.Set(*state)
+        __safe_for_unpickling__ = True
+        def __reduce__(self):               return (Colour, self.Get())
         }
 };
 
+// %pythoncode {
+//     Color = Colour
+//     NamedColor = NamedColour    
+// }
+
 //---------------------------------------------------------------------------