X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0274a7973da59746c55bc91ebceac64f622b6a34..8669431addfb4e91de06493bd708496bc45cbe9e:/interface/wx/sizer.h diff --git a/interface/wx/sizer.h b/interface/wx/sizer.h index 1423c6d485..1cfe3c0edc 100644 --- a/interface/wx/sizer.h +++ b/interface/wx/sizer.h @@ -291,13 +291,15 @@ public: wxObject* userData = NULL); /** - Adds non-stretchable space to the sizer. + This base function adds non-stretchable space to both the horizontal + and vertical orientation of the sizer. More readable way of calling: @code wxSizer::Add(size, size, 0). @endcode + @see wxBoxSizer::AddSpacer() */ - wxSizerItem* AddSpacer(int size); + virtual wxSizerItem *AddSpacer(int size); /** Adds stretchable space to the sizer. @@ -1015,6 +1017,30 @@ public: */ virtual ~wxSizerItem(); + /** + Set the window to be tracked by this item. + + The old window isn't deleted as it is now owned by the sizer item. + */ + void AssignWindow(wxWindow *window); + + /** + Set the sizer tracked by this item. + + Old sizer, if any, is deleted. + */ + void AssignSizer(wxSizer *sizer); + + //@{ + /** + Set the size of the spacer tracked by this item. + + Old spacer, if any, is deleted. + */ + void AssignSpacer(const wxSize& size); + void AssignSpacer(int w, int h) { AssignSpacer(wxSize(w, h)); } + //@} + /** Calculates the minimum desired size for the item, including any space needed by borders. @@ -1184,13 +1210,17 @@ public: /** Set the sizer tracked by this item. - @deprecated @todo provide deprecation description + + @deprecated This function does not free the old sizer which may result + in memory leaks, use AssignSizer() which does free it instead. */ void SetSizer(wxSizer* sizer); /** Set the size of the spacer tracked by this item. - @deprecated @todo provide deprecation description + + @deprecated This function does not free the old spacer which may result + in memory leaks, use AssignSpacer() which does free it instead. */ void SetSpacer(const wxSize& size); @@ -1430,17 +1460,7 @@ public: /** wxFlexGridSizer constructors. - Usually only the number of columns in the flex grid sizer needs to be - specified using @a cols argument. The number of rows will be deduced - automatically depending on the number of the elements added to the - sizer. If the number of @a rows is explicitly specified (and not zero), - the sizer will check that it no more than @code cols*rows @endcode - elements are added to it. - - The @a gap (or @a vgap and @a hgap, which correspond to the height and - width of the wxSize object) argument defines the size of the padding - between the rows (its vertical component, or @a vgap) and columns - (its horizontal component, or @a hgap), in pixels. + Please see wxGridSizer::wxGridSizer documentation. @since 2.9.1 (except for the four argument overload) */ @@ -1583,18 +1603,27 @@ public: /** wxGridSizer constructors. - Usually only the number of columns in the grid sizer needs to be + Usually only the number of columns in the flex grid sizer needs to be specified using @a cols argument. The number of rows will be deduced automatically depending on the number of the elements added to the - sizer. If the number of @a rows is explicitly specified (and not zero), - the sizer will check that it no more than @code cols*rows @endcode - elements are added to it. + sizer. + + If a constructor form with @a rows parameter is used (and the value of + @a rows argument is not zero, meaning "unspecified") the sizer will + check that no more than @c cols*rows elements are added to it, i.e. + that no more than the given number of @a rows is used. Adding less than + maximally allowed number of items is not an error however. + + Finally, it is also possible to specify the number of rows and use 0 + for @a cols. In this case, the sizer will use the given fixed number of + rows and as many columns as necessary. - The @a gap (or @a vgap and @a hgap, which correspond to @c y and @c x - fields of the wxSize object) argument defines the size of the padding - between the grid rows (its vertical component, or @a vgap) and columns + The @a gap (or @a vgap and @a hgap, which correspond to the height and + width of the wxSize object) argument defines the size of the padding + between the rows (its vertical component, or @a vgap) and columns (its horizontal component, or @a hgap), in pixels. + @since 2.9.1 (except for the four argument overload) */ wxGridSizer( int cols, int vgap, int hgap ); @@ -1747,6 +1776,22 @@ public: */ wxBoxSizer(int orient); + /** + Adds non-stretchable space to the main orientation of the sizer only. + More readable way of calling: + @code + if ( wxBoxSizer::IsVertical() ) + { + wxBoxSizer::Add(0, size, 0). + } + else + { + wxBoxSizer::Add(size, 0, 0). + } + @endcode + */ + virtual wxSizerItem *AddSpacer(int size); + /** Implements the calculation of a box sizer's minimal.