]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/_gbsizer.i
reSWIGged
[wxWidgets.git] / wxPython / src / _gbsizer.i
index a1b12901b8c59158540bf9d65721d0222e685326..c522a7cabeb9dd393092ede12668a44cd575f664 100644 (file)
 %{
 bool wxGBPosition_helper(PyObject* source, wxGBPosition** obj)
 {
+    if (source == Py_None) {
+        **obj = wxGBPosition(-1,-1);
+        return True;
+    }
     return wxPyTwoIntItem_helper(source, obj, wxT("wxGBPosition"));
 }
 
 bool wxGBSpan_helper(PyObject* source, wxGBSpan** obj)
 {
+    if (source == Py_None) {
+        **obj = wxGBSpan(-1,-1);
+        return True;
+    }
     return wxPyTwoIntItem_helper(source, obj, wxT("wxGBSpan"));
 }
 
@@ -64,10 +72,15 @@ public:
     int GetCol() const;
     void SetRow(int row);
     void SetCol(int col);
-    
-    bool operator==(const wxGBPosition& p) const;
-    bool operator!=(const wxGBPosition& p) const;
 
+//     %extend {
+//         bool __eq__(const wxGBPosition* other) { return other ? (*self == *other) : False; }
+//         bool __ne__(const wxGBPosition* other) { return other ? (*self != *other) : True;  }
+//     }
+
+    bool operator==(const wxGBPosition& other);
+    bool operator!=(const wxGBPosition& other);
+    
     %extend {
         void Set(int row=0, int col=0) {
             self->SetRow(row);
@@ -75,16 +88,16 @@ public:
         }
         
         PyObject* Get() {
-            wxPyBeginBlockThreads();
+            bool blocked = wxPyBeginBlockThreads();
             PyObject* tup = PyTuple_New(2);
             PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetRow()));
             PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetCol()));
-            wxPyEndBlockThreads();
+            wxPyEndBlockThreads(blocked);
             return tup;
         }
     }
     %pythoncode {
-    asTuple = Get
+    asTuple = wx._deprecated(Get, "asTuple is deprecated, use `Get` instead")
     def __str__(self):                   return str(self.Get())
     def __repr__(self):                  return 'wx.GBPosition'+str(self.Get())
     def __len__(self):                   return len(self.Get())
@@ -94,9 +107,8 @@ public:
         elif index == 1: self.SetCol(val)
         else: raise IndexError
     def __nonzero__(self):               return self.Get() != (0,0)
-    def __getinitargs__(self):           return ()
-    def __getstate__(self):              return self.Get()
-    def __setstate__(self, state):       self.Set(*state)
+    __safe_for_unpickling__ = True
+    def __reduce__(self):                return (wx.GBPosition, self.Get())
     }
 
     %pythoncode {
@@ -118,8 +130,13 @@ public:
     void SetRowspan(int rowspan);
     void SetColspan(int colspan);
     
-    bool operator==(const wxGBSpan& o) const;
-    bool operator!=(const wxGBSpan& o) const;
+//     %extend {
+//         bool __eq__(const wxGBSpan* other) { return other ? (*self == *other) : False; }
+//         bool __ne__(const wxGBSpan* other) { return other ? (*self != *other) : True;  }
+//     }
+    bool operator==(const wxGBSpan& other);
+    bool operator!=(const wxGBSpan& other);
+    
 
     %extend {
         void Set(int rowspan=1, int colspan=1) {
@@ -128,16 +145,16 @@ public:
         }
         
         PyObject* Get() {
-            wxPyBeginBlockThreads();
+            bool blocked = wxPyBeginBlockThreads();
             PyObject* tup = PyTuple_New(2);
             PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetRowspan()));
             PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetColspan()));
-            wxPyEndBlockThreads();
+            wxPyEndBlockThreads(blocked);
             return tup;
         }
     }
     %pythoncode {
-    asTuple = Get
+    asTuple = wx._deprecated(Get, "asTuple is deprecated, use `Get` instead")
     def __str__(self):                   return str(self.Get())
     def __repr__(self):                  return 'wx.GBSpan'+str(self.Get())
     def __len__(self):                   return len(self.Get())
@@ -147,9 +164,8 @@ public:
         elif index == 1: self.SetColspan(val)
         else: raise IndexError
     def __nonzero__(self):               return self.Get() != (0,0)
-    def __getinitargs__(self):           return ()
-    def __getstate__(self):              return self.Get()
-    def __setstate__(self, state):       self.Set(*state)
+    __safe_for_unpickling__ = True
+    def __reduce__(self):                return (wx.GBSpan, self.Get())
     }
 
     %pythoncode {
@@ -252,11 +268,11 @@ public:
                   PyObject* userData = NULL ) {
 
             wxPyUserData* data = NULL;
-            wxPyBeginBlockThreads();
+            bool blocked = wxPyBeginBlockThreads();
             wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, True, False);
             if ( userData && (info.window || info.sizer || info.gotSize) )
                 data = new wxPyUserData(userData);
-            wxPyEndBlockThreads();
+            wxPyEndBlockThreads(blocked);
             
             // Now call the real Add method if a valid item type was found
             if ( info.window )