]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/_sizers.i
Removed calls to wx.InitAllImageHandlers.
[wxWidgets.git] / wxPython / src / _sizers.i
index 9263606e546608c11b450abb586d859ef9ba27f2..3bd200a57f2afb18ba7cb56feb0990988538e7a2 100644 (file)
@@ -51,6 +51,8 @@ public:
 
     void SetProportion( int proportion );
     int GetProportion();
+    %pythoncode { SetOption = SetProportion}
+    %pythoncode { GetOption = GetProportion}
     
     void SetFlag( int flag );
     int GetFlag();
@@ -174,11 +176,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 )
@@ -195,11 +197,11 @@ public:
                      int border=0, 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 Insert method if a valid item type was found
             if ( info.window )
@@ -217,11 +219,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 Prepend method if a valid item type was found
             if ( info.window )
@@ -235,9 +237,9 @@ public:
 
         
         bool Remove(PyObject* item) {
-            wxPyBeginBlockThreads();
+            bool blocked = wxPyBeginBlockThreads();
             wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, False, True);
-            wxPyEndBlockThreads();
+            wxPyEndBlockThreads(blocked);
             if ( info.window )
                 return self->Remove(info.window);
             else if ( info.sizer )
@@ -249,10 +251,25 @@ public:
         }
 
         
+        bool Detach(PyObject* item) {
+            bool blocked = wxPyBeginBlockThreads();
+            wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, False, True);
+            wxPyEndBlockThreads(blocked);
+            if ( info.window )
+                return self->Detach(info.window);
+            else if ( info.sizer )
+                return self->Detach(info.sizer);
+            else if ( info.gotPos )
+                return self->Detach(info.pos);
+            else 
+                return False;
+        }
+
+        
         void _SetItemMinSize(PyObject* item, const wxSize& size) {
-            wxPyBeginBlockThreads();
+            bool blocked = wxPyBeginBlockThreads();
             wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, False, True);
-            wxPyEndBlockThreads();
+            wxPyEndBlockThreads(blocked);
             if ( info.window )
                 self->SetItemMinSize(info.window, size);
             else if ( info.sizer )
@@ -269,16 +286,30 @@ public:
 
     %pythoncode {
     def AddMany(self, widgets):
+        """
+        AddMany is a convenience method for adding several items
+        to a sizer at one time.  Simply pass it a list of tuples,
+        where each tuple consists of the parameters that you
+        would normally pass to the `Add` method.
+        """
         for childinfo in widgets:
             if type(childinfo) != type(()) or (len(childinfo) == 2 and type(childinfo[0]) == type(1)):
                 childinfo = (childinfo, )
             self.Add(*childinfo)
 
     %# for backwards compatibility only, please do not use in new code
-    AddWindow = AddSizer = AddSpacer = Add
-    PrependWindow = PrependSizer = PrependSpacer = Prepend
-    InsertWindow = InsertSizer = InsertSpacer = Insert
-    RemoveWindow = RemoveSizer = RemovePos = Remove
+    AddWindow     = wx._deprecated(Add, "AddWindow is deprecated, use `Add` instead.")
+    AddSizer      = wx._deprecated(Add, "AddSizer is deprecated, use `Add` instead.")
+    AddSpacer     = wx._deprecated(Add, "AddSpacer is deprecated, use `Add` instead.")
+    PrependWindow = wx._deprecated(Prepend, "PrependWindow is deprecated, use `Prepend` instead.")
+    PrependSizer  = wx._deprecated(Prepend, "PrependSizer is deprecated, use `Prepend` instead.")
+    PrependSpacer = wx._deprecated(Prepend, "PrependSpacer is deprecated, use `Prepend` instead.")
+    InsertWindow  = wx._deprecated(Insert, "InsertWindow is deprecated, use `Insert` instead.")
+    InsertSizer   = wx._deprecated(Insert, "InsertSizer is deprecated, use `Insert` instead.")
+    InsertSpacer  = wx._deprecated(Insert, "InsertSpacer is deprecated, use `Insert` instead.")
+    RemoveWindow  = wx._deprecated(Remove, "RemoveWindow is deprecated, use `Remove` instead.")
+    RemoveSizer   = wx._deprecated(Remove, "RemoveSizer is deprecated, use `Remove` instead.")
+    RemovePos     = wx._deprecated(Remove, "RemovePos is deprecated, use `Remove` instead.")
 
 
     def SetItemMinSize(self, item, *args):
@@ -298,11 +329,11 @@ public:
 
     %pythoncode {
     def GetSizeTuple(self):
-        return self.GetSize().asTuple()
+        return self.GetSize().Get()
     def GetPositionTuple(self):
-        return self.GetPosition().asTuple()
+        return self.GetPosition().Get()
     def GetMinSizeTuple(self):
-        return self.GetMinSize().asTuple()
+        return self.GetMinSize().Get()
     }
 
     virtual void RecalcSizes();
@@ -334,7 +365,9 @@ public:
 
     %extend {
         void Show(PyObject* item, bool show = True) {
+            bool blocked = wxPyBeginBlockThreads();
             wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, False, False);
+            wxPyEndBlockThreads(blocked);
             if ( info.window )
                 self->Show(info.window, show);
             else if ( info.sizer )
@@ -343,7 +376,9 @@ public:
 
         
         void Hide(PyObject* item) {
+            bool blocked = wxPyBeginBlockThreads();
             wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, False, False);
+            wxPyEndBlockThreads(blocked);
             if ( info.window )
                 self->Hide(info.window);
             else if ( info.sizer )
@@ -352,7 +387,9 @@ public:
 
         
         bool IsShown(PyObject* item) {
+            bool blocked = wxPyBeginBlockThreads();
             wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, False, False);
+            wxPyEndBlockThreads(blocked);
             if ( info.window ) 
                 return self->IsShown(info.window);
             else if ( info.sizer )