X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e5251d4f78176837e2eb857fae246435207ccaf2..f973828cd9b31d3b80386fab5e6f7c4a106d97fc:/docs/latex/wx/tsizer.tex diff --git a/docs/latex/wx/tsizer.tex b/docs/latex/wx/tsizer.tex index 4f60169188..1a21f8fb14 100644 --- a/docs/latex/wx/tsizer.tex +++ b/docs/latex/wx/tsizer.tex @@ -3,7 +3,8 @@ Classes: \helpref{wxSizer}{wxsizer}, \helpref{wxGridSizer}{wxgridsizer}, \helpref{wxFlexGridSizer}{wxflexgridsizer}, \helpref{wxBoxSizer}{wxboxsizer}, \helpref{wxStaticBoxSizer}{wxstaticboxsizer}, -\helpref{wxNotebookSizer}{wxnotebooksizer} +\helpref{wxNotebookSizer}{wxnotebooksizer}, +\helpref{CreateButtonSizer}{createbuttonsizer} Sizers, as represented by the wxSizer class and its descendants in the wxWindows class hierarchy, have become the method of choice to @@ -11,7 +12,7 @@ define the layout of controls in dialogs in wxWindows because of their ability to create visually appealing dialogs independent of the platform, taking into account the differences in size and style of the individual controls. Unlike the original wxWindows Dialog Editor, -editors such as wxDesigner, wxrcedit, XRCed and wxWorkshop create dialogs based exclusively on sizers, +editors such as wxDesigner, DialogBlocks, wxrcedit, XRCed and wxWorkshop create dialogs based exclusively on sizers, practically forcing the user to create platform independent layouts without compromises. The next section describes and shows what can be done with sizers. @@ -112,6 +113,21 @@ initial width: Within wxDesigner, this stretch factor gets set from the {\it Option} menu. +\subsubsection{Hiding controls using sizers}\label{sizershiding} + +You can hide controls contained in sizers the same way you would hide any control, +using the \helpref{wxWindow::Show}{wxwindowshow} method. + +However, wxSizer also offers a separate method which can tell the sizer not to +consider that control in its size calculations. To hide a window using the sizer, +call \helpref{wxSizer::Show}{wxsizershow}. You must then call Layout on the sizer +to force an update. + +This is useful when hiding parts of the interface, since you can avoid removing +the controls from the sizer and having to add them back later. + +Note: This is supported only by wxBoxSizer and wxFlexGridSizer. + \wxheading{wxBoxSizer} \helpref{wxBoxSizer}{wxboxsizer} can lay out its children either vertically @@ -192,7 +208,7 @@ the buttons shall be centred as the width of the dialog changes. It is the unique feature of a box sizer, that it can grow in both directions (height and width) but can distribute its growth in the main direction (horizontal for a row) {\it unevenly} among its children. In our example case, the vertical sizer is supposed to propagate all its -height changes to only the text area, not to the button area. This is determined by the {\it option} parameter +height changes to only the text area, not to the button area. This is determined by the {\it proportion} parameter when adding a window (or another sizer) to a sizer. It is interpreted as a weight factor, i.e. it can be zero, indicating that the window may not be resized at all, or above zero. If several windows have a value above zero, the value is interpreted @@ -285,7 +301,7 @@ sizer. In order to query the size of notebook page, this page needs to have its own sizer, otherwise the wxNotebookSizer will ignore it. Notebook pages get their sizer by assigning one to them using \helpref{wxWindow::SetSizer}{wxwindowsetsizer} -and setting the auto-layout option to TRUE using +and setting the auto-layout option to true using \helpref{wxWindow::SetAutoLayout}{wxwindowsetautolayout}. Here is one example showing how to add a notebook page that the notebook sizer is aware of: @@ -302,7 +318,7 @@ aware of: // Add controls to panel and panelsizer here... - panel->SetAutoLayout( TRUE ); + panel->SetAutoLayout( true ); panel->SetSizer( panelsizer ); \end{verbatim} @@ -312,3 +328,25 @@ aware of: box around the sizer. Note that this static box has to be created separately. +\subsection{CreateButtonSizer}\label{createbuttonsizer} + +As a convenience, CreateButtonSizer ( long flags ) can be used to create a standard button sizer +in which standard buttons are displayed. The following flags can be passed to this function: + + +\begin{verbatim} + wxYES_NO // Add Yes/No subpanel + wxYES // return wxID_YES + wxNO // return wxID_NO + wxNO_DEFAULT // make the wxNO button the default, otherwise wxYES or wxOK button will be default + + wxOK // return wxID_OK + wxCANCEL // return wxID_CANCEL + wxHELP // return wxID_HELP + + wxFORWARD // return wxID_FORWARD + wxBACKWARD // return wxID_BACKWARD + wxSETUP // return wxID_SETUP + wxMORE // return wxID_MORE + +\end{verbatim}