]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/_sizers.i
Update __DocFilter to skip functions that are duplicates of static
[wxWidgets.git] / wxPython / src / _sizers.i
index f3482de61e4d652c6fcbe8d429016178ea62766c..9726d7b4fc245cc2d3ca96f50bfe8ca35c6ec392 100644 (file)
 
 DocStr(wxSizerItem,
 "The wx.SizerItem class is used to track the position, size and other
 
 DocStr(wxSizerItem,
 "The wx.SizerItem class is used to track the position, size and other
-attributes of each item managed by a `wx.Sizer`. In normal usage user
-code should never need to deal directly with a wx.SizerItem, but
-custom classes derived from `wx.PySizer` will probably need to use the
-collection of wx.SizerItems held by wx.Sizer when calculating layout.
+attributes of each item managed by a `wx.Sizer`. It is not usually
+necessary to use this class because the sizer elements can also be
+identified by their positions or window or sizer references but
+sometimes it may be more convenient to use wx.SizerItem directly.
+Also, custom classes derived from `wx.PySizer` will probably need to
+use the collection of wx.SizerItems held by wx.Sizer when calculating
+layout.
 
 :see: `wx.Sizer`, `wx.GBSizerItem`", "");
 
 
 :see: `wx.Sizer`, `wx.GBSizerItem`", "");
 
@@ -357,8 +360,8 @@ DocStr(wxSizer,
 "wx.Sizer is the abstract base class used for laying out subwindows in
 a window.  You cannot use wx.Sizer directly; instead, you will have to
 use one of the sizer classes derived from it such as `wx.BoxSizer`,
 "wx.Sizer is the abstract base class used for laying out subwindows in
 a window.  You cannot use wx.Sizer directly; instead, you will have to
 use one of the sizer classes derived from it such as `wx.BoxSizer`,
-`wx.StaticBoxSizer`, `wx.NotebookSizer`, `wx.GridSizer`,  `wx.FlexGridSizer`
-and `wx.GridBagSizer`.
+`wx.StaticBoxSizer`, `wx.GridSizer`, `wx.FlexGridSizer` and
+`wx.GridBagSizer`.
 
 The concept implemented by sizers in wxWidgets is closely related to
 layout tools in other GUI toolkits, such as Java's AWT, the GTK
 
 The concept implemented by sizers in wxWidgets is closely related to
 layout tools in other GUI toolkits, such as Java's AWT, the GTK
@@ -1179,6 +1182,25 @@ define extra space between all children.", "");
         int , GetHGap(),
         "Returns the horizontal gap (in pixels) between cells in the sizer.", "");
 
         int , GetHGap(),
         "Returns the horizontal gap (in pixels) between cells in the sizer.", "");
 
+    %pythoncode {
+        def CalcRowsCols(self):
+            """
+            CalcRowsCols() -> (rows, cols)
+
+            Calculates how many rows and columns will be in the sizer based
+            on the current number of items and also the rows, cols specified
+            in the constructor.
+            """
+            nitems = len(self.GetChildren())
+            rows = self.GetRows()
+            cols = self.GetCols()
+            assert rows != 0 or cols != 0, "Grid sizer must have either rows or columns fixed"
+            if cols != 0:
+                rows = (nitems + cols - 1) / cols
+            elif rows != 0:
+                cols = (nitems + rows - 1) / rows
+            return (rows, cols)
+    }
 };
 
 //---------------------------------------------------------------------------
 };
 
 //---------------------------------------------------------------------------