Add CalcRowsCols
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37691 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1179,6 +1179,25 @@ define extra space between all children.", "");
|
||||
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)
|
||||
}
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user