]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/_sizers.i
another merge from WX_2_6_BRANCH
[wxWidgets.git] / wxPython / src / _sizers.i
index 526a646c887b07ab24b858d7677cfbfb5a17594b..26e7c75cb476d28930ef21767ee54178e027012c 100644 (file)
@@ -261,6 +261,18 @@ isn't any.", "");
                 return Py_None;
             }
         }
+
+        DocStr(SetUserData,
+               "Associate a Python object with this sizer item.", "");
+        void SetUserData(PyObject* userData) {
+            wxPyUserData* data = NULL;
+            if ( userData ) {
+                wxPyBlock_t blocked = wxPyBeginBlockThreads();
+                data = new wxPyUserData(userData);
+                wxPyEndBlockThreads(blocked);
+            }
+            self->SetUserData(data);
+        }
     }
 };
 
@@ -318,14 +330,14 @@ static wxPySizerItemInfo wxPySizerItemTypeHelper(PyObject* item, bool checkSize,
     if ( !(info.window || info.sizer || (checkSize && info.gotSize) || (checkIdx && info.gotPos)) ) {
         // no expected type, figure out what kind of error message to generate
         if ( !checkSize && !checkIdx )
-            PyErr_SetString(PyExc_TypeError, "wxWindow or wxSizer expected for item");
+            PyErr_SetString(PyExc_TypeError, "wx.Window or wx.Sizer expected for item");
         else if ( checkSize && !checkIdx )
-            PyErr_SetString(PyExc_TypeError, "wxWindow, wxSizer, wxSize, or (w,h) expected for item");
+            PyErr_SetString(PyExc_TypeError, "wx.Window, wx.Sizer, wx.Size, or (w,h) expected for item");
         else if ( !checkSize && checkIdx)
-            PyErr_SetString(PyExc_TypeError, "wxWindow, wxSizer or int (position) expected for item");
+            PyErr_SetString(PyExc_TypeError, "wx.Window, wx.Sizer or int (position) expected for item");
         else
             // can this one happen?
-            PyErr_SetString(PyExc_TypeError, "wxWindow, wxSizer, wxSize, or (w,h) or int (position) expected for item");
+            PyErr_SetString(PyExc_TypeError, "wx.Window, wx.Sizer, wx.Size, or (w,h) or int (position) expected for item");
     }
 
     return info;
@@ -364,6 +376,12 @@ standard font as well as the overall design of Mac widgets requires
 more space than on Windows, then the initial size of a dialog using a
 sizer will automatically be bigger on Mac than on Windows.", "
 
+Sizers may also be used to control the layout of custom drawn items on
+the window.  The `Add`, `Insert`, and `Prepend` functions return a
+pointer to the newly added `wx.SizerItem`. Just add empty space of the
+desired size and attributes, and then use the `wx.SizerItem.GetRect`
+method to determine where the drawing operations should take place.
+
 :note: If you wish to create a custom sizer class in wxPython you
     should derive the class from `wx.PySizer` in order to get
     Python-aware capabilities for the various virtual methods.
@@ -450,7 +468,7 @@ public:
         |- wx.ALL                    |                                          |
         |                            |                                          |
         +----------------------------+------------------------------------------+
-        |- wx.EXAPAND                |The item will be expanded to fill         |
+        |- wx.EXPAND                 |The item will be expanded to fill         |
         |                            |the space allotted to the item.           |
         +----------------------------+------------------------------------------+
         |- wx.SHAPED                 |The item will be expanded as much as      |
@@ -629,7 +647,7 @@ was found and detached.", "");
                 "GetItem(self, item) -> wx.SizerItem",
                 "Returns the `wx.SizerItem` which holds the *item* given.  The *item*
 parameter can be either a window, a sizer, or the zero-based index of
-the item to be detached.", "");
+the item to be found.", "");
         wxSizerItem* GetItem(PyObject* item) {
             wxPyBlock_t blocked = wxPyBeginBlockThreads();
             wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true);
@@ -926,7 +944,7 @@ the item.", "");
     %pythoncode {
     def Hide(self, item, recursive=False):
         """
-        A convenience method for `Show`(item, False, recursive).
+        A convenience method for `Show` (item, False, recursive).
         """
         return self.Show(item, False, recursive)
     }