%% Name: wizard.tex
%% Purpose: wxWizard class documentation
%% Author: Vadim Zeitlin
-%% Modified by:
+%% Modified by: Robert Vazan (sizers)
%% Created: 02.04.00
%% RCS-ID: $Id$
%% Copyright: (c) Vadim Zeitlin
\section{\class{wxWizard}}\label{wxwizard}
wxWizard is the central class for implementing `wizard-like' dialogs. These
-dialogs are mostly familiar to Windows users and are nothing else but a
-sequence of `pages' each of them displayed inside a dialog which has the
-buttons to pass to the next (and previous) pages.
+dialogs are mostly familiar to Windows users and are nothing other than a
+sequence of `pages', each displayed inside a dialog which has the
+buttons to navigate to the next (and previous) pages.
The wizards are typically used to decompose a complex dialog into several
simple steps and are mainly useful to the novice users, hence it is important
to keep them as simple as possible.
-To show a wizard dialog, you must first create an object of wxWizard class
-using \helpref{Create}{wxwizardcreate} function. Then you should add all pages
-you want the wizard to show and call \helpref{RunWizard}{wxwizardrunwizard}.
-Finally, don't forget to call {\tt wizard->Destroy()}.
+To show a wizard dialog, you must first create an instance of the wxWizard class
+using either the non-default constructor or a default one followed by call to the
+\helpref{Create}{wxwizardcreate} function. Then you should add all pages you
+want the wizard to show and call \helpref{RunWizard}{wxwizardrunwizard}.
+Finally, don't forget to call {\tt wizard->Destroy()}, otherwise your application will hang on exit due to an undestroyed window.
+
+You can supply a bitmap to display on the left of the wizard, either for all pages
+or for individual pages. If you need to have the bitmap resize to the height of the wizard,
+call \helpref{wxWizard::SetBitmapPlacement}{wxwizardsetbitmapplacement} and if necessary,\rtfsp
+\helpref{wxWizard::SetBitmapBackgroundColour}{wxwizardsetbitmapbackgroundcolour} and \helpref{wxWizard::SetMinimumBitmapWidth}{wxwizardsetminimumbitmapwidth}.
+
+To make wizard pages scroll when the display is too small to fit the whole dialog, you can switch
+layout adaptation on globally with \helpref{wxDialog::EnableLayoutAdaptation}{wxdialogenablelayoutadaptation} or
+per dialog with \helpref{wxDialog::SetLayoutAdaptationMode}{wxdialogsetlayoutadaptationmode}. For more
+about layout adaptation, see \helpref{Automatic scrolling dialogs}{autoscrollingdialogs}.
\wxheading{Derived from}
\helpref{wxDialog}{wxdialog}\\
-\helpref{wxPanel}{wxpanel}\\
+\helpref{wxTopLevelWindow}{wxtoplevelwindow}\\
\helpref{wxWindow}{wxwindow}\\
\helpref{wxEvtHandler}{wxevthandler}\\
\helpref{wxObject}{wxobject}
<wx/wizard.h>
+\wxheading{Library}
+
+\helpref{wxAdv}{librarieslist}
+
\wxheading{Event table macros}
To process input from a wizard dialog, use these event handler macros to
\twocolwidtha{7cm}
\begin{twocollist}\itemsep=2pt
-\twocolitem{{\bf EVT\_WIZARD\_PAGE\_CHANGED(id, func)}}{The page has been just
-changed (this event can not be vetoed).}
+\twocolitem{{\bf EVT\_WIZARD\_PAGE\_CHANGED(id, func)}}{The page has just been
+changed (this event cannot be vetoed).}
\twocolitem{{\bf EVT\_WIZARD\_PAGE\_CHANGING(id, func)}}{The page is being
changed (this event can be vetoed).}
\twocolitem{{\bf EVT\_WIZARD\_CANCEL(id, func)}}{The user attempted to cancel
the wizard (this event may also be vetoed).}
-\end{twocollist}%
+\twocolitem{{\bf EVT\_WIZARD\_HELP(id, func)}}{The wizard help button was pressed.}
+\twocolitem{{\bf EVT\_WIZARD\_FINISHED(id, func)}}{The wizard finished button was pressed.}
+\end{twocollist}
\wxheading{Extended styles}
\func{}{wxWizard}{\void}
-Default constructor. Use this if you wish to derive from wxWizard and then call {\bf Create}, for example
-if you wish to set an extra style with \helpref{wxWindow::SetExtraStyle}{wxwindowsetextrastyle}.
+Default constructor. Use this if you wish to derive from wxWizard and then call
+\helpref{Create}{wxwizardcreate}, for example if you wish to set an extra style
+with \helpref{wxWindow::SetExtraStyle}{wxwindowsetextrastyle} between the two
+calls.
-\func{}{wxWizard}{\param{wxWindow* }{parent}, \param{int }{id = -1}, \param{const wxString\& }{title = wxEmptyString}, \param{const wxBitmap\& }{bitmap = wxNullBitmap}, \param{const wxPoint\& }{pos = wxDefaultPosition}}
+\func{}{wxWizard}{\param{wxWindow* }{parent}, \param{int }{id = -1}, \param{const wxString\& }{title = wxEmptyString}, \param{const wxBitmap\& }{bitmap = wxNullBitmap}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{long }{style = wxDEFAULT\_DIALOG\_STYLE}}
-Creates the wizard dialog. The wizard should not be deleted
-directly, you should rather call {\tt Destroy()} on it and wxWindows will
-delete it itself.
+Constructor which really creates the wizard -- if you use this constructor, you
+shouldn't call \helpref{Create}{wxwizardcreate}.
-Notice that unlike almost all other wxWindows classes, there is no {\it size}
-parameter in wxWizard constructor because the wizard will have a predefined
+Notice that unlike almost all other wxWidgets classes, there is no {\it size}
+parameter in the wxWizard constructor because the wizard will have a predefined
default size by default. If you want to change this, you should use the
-\helpref{SetPageSize}{wxwizardsetpagesize} function.
+\helpref{GetPageAreaSizer}{wxwizardgetpageareasizer} function.
\wxheading{Parameters}
\docparam{pos}{The position of the dialog, it will be centered on the screen
by default.}
-\membersection{wxWizard::Create}\label{wxwizardcreate}
+\docparam{style}{Window style is passed to wxDialog.}
-\func{static wxWizard*}{Create}{\param{wxWindow* }{parent}, \param{int }{id = -1}, \param{const wxString\& }{title = wxEmptyString}, \param{const wxBitmap\& }{bitmap = wxNullBitmap}, \param{const wxPoint\& }{pos = wxDefaultPosition}}
-Creates the wizard dialog. The returned pointer should not be deleted
-directly, you should rather call {\tt Destroy()} on it and wxWindows will
-delete it itself.
+\membersection{wxWizard::Create}\label{wxwizardcreate}
-Notice that unlike almost all other wxWindows classes, there is no {\it size}
-parameter in wxWizard constructor because the wizard will have a predefined
-default size by default. If you want to change this, you should use the
-\helpref{SetPageSize}{wxwizardsetpagesize} function.
+\func{bool}{Create}{\param{wxWindow* }{parent}, \param{int }{id = -1}, \param{const wxString\& }{title = wxEmptyString}, \param{const wxBitmap\& }{bitmap = wxNullBitmap}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{long }{style = wxDEFAULT\_DIALOG\_STYLE}}
-\func{bool}{Create}{\param{wxWindow* }{parent}, \param{int }{id = -1}, \param{const wxString\& }{title = wxEmptyString}, \param{const wxBitmap\& }{bitmap = wxNullBitmap}, \param{const wxPoint\& }{pos = wxDefaultPosition}}
+Creates the wizard dialog. Must be called if the default constructor had been
+used to create the object.
-Alternative, non-static constructor for two-step construction of a class derived from wxWizard.
+Notice that unlike almost all other wxWidgets classes, there is no {\it size}
+parameter in the wxWizard constructor because the wizard will have a predefined
+default size by default. If you want to change this, you should use the
+\helpref{GetPageAreaSizer}{wxwizardgetpageareasizer} function.
\wxheading{Parameters}
\docparam{pos}{The position of the dialog, it will be centered on the screen
by default.}
-\membersection{wxWizard::RunWizard}\label{wxwizardrunwizard}
+\docparam{style}{Window style is passed to wxDialog.}
-\func{bool}{RunWizard}{\param{wxWizardPage* }{firstPage}}
-Executes the wizard starting from the given page, returns {\tt TRUE} if it was
-successfully finished or {\tt FALSE} if user cancelled it. The {\it firstPage}
-can not be {\tt NULL}.
+\membersection{wxWizard::FitToPage}\label{wxwizardfittopage}
+
+\func{void}{FitToPage}{\param{const wxWizardPage* }{firstPage}}
+
+This method is obsolete, use
+\helpref{GetPageAreaSizer}{wxwizardgetpageareasizer} instead.
+
+Sets the page size to be big enough for all the pages accessible via the
+given {\it firstPage}, i.e. this page, its next page and so on.
+
+This method may be called more than once and it will only change the page size
+if the size required by the new page is bigger than the previously set one.
+This is useful if the decision about which pages to show is taken during
+run-time, as in this case, the wizard won't be able to get to all pages starting
+from a single one and you should call {\it Fit} separately for the others.
+
+\membersection{wxWizard::GetBitmap}\label{wxwizardgetbitmap}
+
+\constfunc{const wxBitmap\&}{GetBitmap}{\void}
+
+Returns the bitmap used for the wizard.
+
+
+\membersection{wxWizard::GetBitmapBackgroundColour}\label{wxwizardgetbitmapbackgroundcolour}
+
+\constfunc{const wxColour\&}{GetBitmapBackgroundColour}{\void}
+
+Returns the colour that should be used to fill the area not taken up by the wizard or page bitmap,
+if a non-zero bitmap placement flag has been set.
+
+See also \helpref{wxWizard::SetBitmapPlacement}{wxwizardsetbitmapplacement}.
+
+
+
+\membersection{wxWizard::GetBitmapPlacement}\label{wxwizardgetbitmapplacement}
+
+\func{int}{GetBitmapPlacement}{\void}
+
+Returns the flags indicating how the wizard or page bitmap should be expanded and positioned to fit the
+page height. By default, placement is 0 (no expansion is done).
+
+See also \helpref{wxWizard::SetBitmapPlacement}{wxwizardsetbitmapplacement} for the possible values.
+
\membersection{wxWizard::GetCurrentPage}\label{wxwizardgetcurrentpage}
Get the current page while the wizard is running. {\tt NULL} is returned if
\helpref{RunWizard()}{wxwizardrunwizard} is not being executed now.
+
+\membersection{wxWizard::GetMinimumBitmapWidth}\label{wxwizardgetminimumbitmapwidth}
+
+\constfunc{int}{GetMinimumBitmapWidth}{\void}
+
+Returns the minimum width for the bitmap that will be constructed to contain the actual wizard or page bitmap
+if a non-zero bitmap placement flag has been set.
+
+See also \helpref{wxWizard::SetBitmapPlacement}{wxwizardsetbitmapplacement}.
+
+
+\membersection{wxWizard::GetPageAreaSizer}\label{wxwizardgetpageareasizer}
+
+\constfunc{virtual wxSizer*}{GetPageAreaSizer}{\void}
+
+Returns pointer to page area sizer. The wizard is laid out using sizers and
+the page area sizer is the place-holder for the pages. All pages are resized before
+being shown to match the wizard page area.
+
+Page area sizer has a minimal size that is the maximum of several values. First,
+all pages (or other objects) added to the sizer. Second, all pages reachable
+by repeatedly applying
+\helpref{wxWizardPage::GetNext}{wxwizardpagegetnext} to
+any page inserted into the sizer. Third,
+the minimal size specified using \helpref{SetPageSize}{wxwizardsetpagesize} and
+\helpref{FitToPage}{wxwizardfittopage}. Fourth, the total wizard height may
+be increased to accommodate the bitmap height. Fifth and finally, wizards are
+never smaller than some built-in minimal size to avoid wizards that are too small.
+
+The caller can use \helpref{wxSizer::SetMinSize}{wxsizersetminsize} to enlarge it
+beyond the minimal size. If {\tt wxRESIZE\_BORDER} was passed to constructor, user
+can resize wizard and consequently the page area (but not make it smaller than the
+minimal size).
+
+It is recommended to add the first page to the page area sizer. For simple wizards,
+this will enlarge the wizard to fit the biggest page. For non-linear wizards,
+the first page of every separate chain should be added. Caller-specified size
+can be accomplished using \helpref{wxSizer::SetMinSize}{wxsizersetminsize}.
+
+Adding pages to the page area sizer affects the default border width around page
+area that can be altered with \helpref{SetBorder}{wxwizardsetborder}.
+
+
\membersection{wxWizard::GetPageSize}\label{wxwizardgetpagesize}
\constfunc{wxSize}{GetPageSize}{\void}
Returns the size available for the pages.
+
+\membersection{wxWizard::HasNextPage}\label{wxwizardhasnextpage}
+
+\func{virtual bool}{HasNextPage}{\param{wxWizardPage *}{page}}
+
+Return {\tt true} if this page is not the last one in the wizard. The base
+class version implements this by calling
+\helpref{page->GetNext}{wxwizardpagegetnext} but this could be undesirable if,
+for example, the pages are created on demand only.
+
+\wxheading{See also}
+
+\helpref{HasPrevPage}{wxwizardhasprevpage}
+
+
+\membersection{wxWizard::HasPrevPage}\label{wxwizardhasprevpage}
+
+\func{virtual bool}{HasPrevPage}{\param{wxWizardPage *}{page}}
+
+Returns {\tt true} if this page is not the last one in the wizard. The base
+class version implements this by calling
+\helpref{page->GetPrev}{wxwizardpagegetprev} but this could be undesirable if,
+for example, the pages are created on demand only.
+
+\wxheading{See also}
+
+\helpref{HasNextPage}{wxwizardhasnextpage}
+
+
+\membersection{wxWizard::RunWizard}\label{wxwizardrunwizard}
+
+\func{bool}{RunWizard}{\param{wxWizardPage* }{firstPage}}
+
+Executes the wizard starting from the given page, returning {\tt true} if it was
+successfully finished or {\tt false} if user cancelled it. The {\it firstPage}
+can not be {\tt NULL}.
+
+\membersection{wxWizard::SetBitmap}\label{wxwizardsetbitmap}
+
+\func{void}{SetBitmap}{\param{const wxBitmap\& }{bitmap}}
+
+Sets the bitmap used for the wizard.
+
+
+\membersection{wxWizard::SetBitmapBackgroundColour}\label{wxwizardsetbitmapbackgroundcolour}
+
+\func{void}{SetBitmapBackgroundColour}{\param{const wxColour\&}{ colour}}
+
+Sets the colour that should be used to fill the area not taken up by the wizard or page bitmap,
+if a non-zero bitmap placement flag has been set.
+
+See also \helpref{wxWizard::SetBitmapPlacement}{wxwizardsetbitmapplacement}.
+
+
+\membersection{wxWizard::SetBitmapPlacement}\label{wxwizardsetbitmapplacement}
+
+\func{void}{SetBitmapPlacement}{\param{int}{ placement}}
+
+Sets the flags indicating how the wizard or page bitmap should be expanded and positioned to fit the
+page height. By default, placement is 0 (no expansion is done). {\it placement} is a bitlist with the
+following possible values:
+
+\begin{twocollist}\itemsep=0pt
+\twocolitem{\windowstyle{wxWIZARD\_VALIGN\_TOP}}{Aligns the bitmap at the top.}
+\twocolitem{\windowstyle{wxWIZARD\_VALIGN\_CENTRE}}{Centres the bitmap vertically.}
+\twocolitem{\windowstyle{wxWIZARD\_VALIGN\_BOTTOM}}{Aligns the bitmap at the bottom.}
+\twocolitem{\windowstyle{wxWIZARD\_HALIGN\_LEFT}}{Left-aligns the bitmap.}
+\twocolitem{\windowstyle{wxWIZARD\_HALIGN\_CENTRE}}{Centres the bitmap horizontally.}
+\twocolitem{\windowstyle{wxWIZARD\_HALIGN\_RIGHT}}{Right-aligns the bitmap.}
+\twocolitem{\windowstyle{wxWIZARD\_TILE}}{}
+\end{twocollist}
+
+See also \helpref{wxWizard::SetMinimumBitmapWidth}{wxwizardsetminimumbitmapwidth}.
+
+
+\membersection{wxWizard::SetMinimumBitmapWidth}\label{wxwizardsetminimumbitmapwidth}
+
+\func{void}{SetMinimumBitmapWidth}{\param{int}{ width}}
+
+Sets the minimum width for the bitmap that will be constructed to contain the actual wizard or page bitmap
+if a non-zero bitmap placement flag has been set. If this is not set when using bitmap placement, the initial
+layout may be incorrect.
+
+See also \helpref{wxWizard::SetBitmapPlacement}{wxwizardsetbitmapplacement}.
+
+
+
\membersection{wxWizard::SetPageSize}\label{wxwizardsetpagesize}
\func{void}{SetPageSize}{\param{const wxSize\& }{sizePage}}
+This method is obsolete, use
+\helpref{GetPageAreaSizer}{wxwizardgetpageareasizer} instead.
+
Sets the minimal size to be made available for the wizard pages. The wizard
will take into account the size of the bitmap (if any) itself. Also, the
wizard will never be smaller than the default size.
-The recommended way to use this function is to layout all wizard pages using
+The recommended way to use this function is to lay out all wizard pages using
the sizers (even though the wizard is not resizeable) and then use
\helpref{wxSizer::CalcMin}{wxsizercalcmin} in a loop to calculate the maximum
of minimal sizes of the pages and pass it to SetPageSize().
+
+\membersection{wxWizard::SetBorder}\label{wxwizardsetborder}
+
+\func{void}{SetBorder}{\param{int }{border}}
+
+Sets width of border around page area. Default is zero. For backward
+compatibility, if there are no pages in
+\helpref{GetPageAreaSizer}{wxwizardgetpageareasizer}, the default is $5$ pixels.
+
+If there is a five point border around all controls in a page and the border around
+page area is left as zero, a five point white space along all dialog borders
+will be added to the control border in order to space page controls ten points from the dialog
+border and non-page controls.
+