1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %% Purpose: wxWizard class documentation
4 %% Author: Vadim Zeitlin
5 %% Modified by: Robert Vazan (sizers)
8 %% Copyright: (c) Vadim Zeitlin
9 %% License: wxWindows license
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 \section{\class{wxWizard
}}\label{wxwizard
}
14 wxWizard is the central class for implementing `wizard-like' dialogs. These
15 dialogs are mostly familiar to Windows users and are nothing other than a
16 sequence of `pages', each displayed inside a dialog which has the
17 buttons to navigate to the next (and previous) pages.
19 The wizards are typically used to decompose a complex dialog into several
20 simple steps and are mainly useful to the novice users, hence it is important
21 to keep them as simple as possible.
23 To show a wizard dialog, you must first create an instance of the wxWizard class
24 using either the non-default constructor or a default one followed by call to the
25 \helpref{Create
}{wxwizardcreate
} function. Then you should add all pages you
26 want the wizard to show and call
\helpref{RunWizard
}{wxwizardrunwizard
}.
27 Finally, don't forget to call
{\tt wizard->Destroy()
}, otherwise your application will hang on exit due to an undestroyed window.
29 You can supply a bitmap to display on the left of the wizard, either for all pages
30 or for individual pages. If you need to have the bitmap resize to the height of the wizard,
31 call
\helpref{wxWizard::SetBitmapPlacement
}{wxwizardsetbitmapplacement
} and if necessary,
\rtfsp
32 \helpref{wxWizard::SetBitmapBackgroundColour
}{wxwizardsetbitmapbackgroundcolour
} and
\helpref{wxWizard::SetMinimumBitmapWidth
}{wxwizardsetminimumbitmapwidth
}.
34 To make wizard pages scroll when the display is too small to fit the whole dialog, you can switch
35 layout adaptation on globally with
\helpref{wxDialog::EnableLayoutAdaptation
}{wxdialogenablelayoutadaptation
} or
36 per dialog with
\helpref{wxDialog::SetLayoutAdaptationMode
}{wxdialogsetlayoutadaptationmode
}. For more
37 about layout adaptation, see
\helpref{Automatic scrolling dialogs
}{autoscrollingdialogs
}.
39 \wxheading{Derived from
}
41 \helpref{wxDialog
}{wxdialog
}\\
42 \helpref{wxTopLevelWindow
}{wxtoplevelwindow
}\\
43 \helpref{wxWindow
}{wxwindow
}\\
44 \helpref{wxEvtHandler
}{wxevthandler
}\\
45 \helpref{wxObject
}{wxobject
}
47 \wxheading{Include files
}
53 \helpref{wxAdv
}{librarieslist
}
55 \wxheading{Event table macros
}
57 To process input from a wizard dialog, use these event handler macros to
58 direct input to member functions that take a
59 \helpref{wxWizardEvent
}{wxwizardevent
} argument. For some events,
60 \helpref{Veto()
}{wxnotifyeventveto
} can be called to prevent the event from
64 \begin{twocollist
}\itemsep=
2pt
65 \twocolitem{{\bf EVT
\_WIZARD\_PAGE\_CHANGED(id, func)
}}{The page has just been
66 changed (this event cannot be vetoed).
}
67 \twocolitem{{\bf EVT
\_WIZARD\_PAGE\_CHANGING(id, func)
}}{The page is being
68 changed (this event can be vetoed).
}
69 \twocolitem{{\bf EVT
\_WIZARD\_CANCEL(id, func)
}}{The user attempted to cancel
70 the wizard (this event may also be vetoed).
}
71 \twocolitem{{\bf EVT
\_WIZARD\_HELP(id, func)
}}{The wizard help button was pressed.
}
72 \twocolitem{{\bf EVT
\_WIZARD\_FINISHED(id, func)
}}{The wizard finished button was pressed.
}
75 \wxheading{Extended styles
}
77 Use the
\helpref{wxWindow::SetExtraStyle
}{wxwindowsetextrastyle
} function to set the following
78 style. You will need to use two-step construction (use the default constructor, call
{\bf SetExtraStyle
}, then call
{\bf Create
}).
81 \begin{twocollist
}\itemsep=
0pt
82 \twocolitem{\windowstyle{wxWIZARD
\_EX\_HELPBUTTON}}{Shows a Help button using wxID
\_HELP.
}
85 See also
\helpref{wxDialog
}{wxdialog
} for other extended styles.
89 \helpref{wxWizardEvent
}{wxwizardevent
},
\helpref{wxWizardPage
}{wxwizardpage
},
\helpref{wxWizard sample
}{samplewizard
}
91 \latexignore{\rtfignore{\wxheading{Members
}}}
93 \membersection{wxWizard::wxWizard
}\label{wxwizardctor
}
95 \func{}{wxWizard
}{\void}
97 Default constructor. Use this if you wish to derive from wxWizard and then call
98 \helpref{Create
}{wxwizardcreate
}, for example if you wish to set an extra style
99 with
\helpref{wxWindow::SetExtraStyle
}{wxwindowsetextrastyle
} between the two
102 \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}}
104 Constructor which really creates the wizard -- if you use this constructor, you
105 shouldn't call
\helpref{Create
}{wxwizardcreate
}.
107 Notice that unlike almost all other wxWidgets classes, there is no
{\it size
}
108 parameter in the wxWizard constructor because the wizard will have a predefined
109 default size by default. If you want to change this, you should use the
110 \helpref{GetPageAreaSizer
}{wxwizardgetpageareasizer
} function.
112 \wxheading{Parameters
}
114 \docparam{parent
}{The parent window, may be NULL.
}
116 \docparam{id
}{The id of the dialog, will usually be just $-
1$.
}
118 \docparam{title
}{The title of the dialog.
}
120 \docparam{bitmap
}{The default bitmap used in the left side of the wizard. See
121 also
\helpref{GetBitmap
}{wxwizardpagegetbitmap
}.
}
123 \docparam{pos
}{The position of the dialog, it will be centered on the screen
126 \docparam{style
}{Window style is passed to wxDialog.
}
129 \membersection{wxWizard::Create
}\label{wxwizardcreate
}
131 \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}}
133 Creates the wizard dialog. Must be called if the default constructor had been
134 used to create the object.
136 Notice that unlike almost all other wxWidgets classes, there is no
{\it size
}
137 parameter in the wxWizard constructor because the wizard will have a predefined
138 default size by default. If you want to change this, you should use the
139 \helpref{GetPageAreaSizer
}{wxwizardgetpageareasizer
} function.
141 \wxheading{Parameters
}
143 \docparam{parent
}{The parent window, may be NULL.
}
145 \docparam{id
}{The id of the dialog, will usually be just $-
1$.
}
147 \docparam{title
}{The title of the dialog.
}
149 \docparam{bitmap
}{The default bitmap used in the left side of the wizard. See
150 also
\helpref{GetBitmap
}{wxwizardpagegetbitmap
}.
}
152 \docparam{pos
}{The position of the dialog, it will be centered on the screen
155 \docparam{style
}{Window style is passed to wxDialog.
}
158 \membersection{wxWizard::FitToPage
}\label{wxwizardfittopage
}
160 \func{void
}{FitToPage
}{\param{const wxWizardPage*
}{firstPage
}}
162 This method is obsolete, use
163 \helpref{GetPageAreaSizer
}{wxwizardgetpageareasizer
} instead.
165 Sets the page size to be big enough for all the pages accessible via the
166 given
{\it firstPage
}, i.e. this page, its next page and so on.
168 This method may be called more than once and it will only change the page size
169 if the size required by the new page is bigger than the previously set one.
170 This is useful if the decision about which pages to show is taken during
171 run-time, as in this case, the wizard won't be able to get to all pages starting
172 from a single one and you should call
{\it Fit
} separately for the others.
174 \membersection{wxWizard::GetBitmap
}\label{wxwizardgetbitmap
}
176 \constfunc{const wxBitmap\&
}{GetBitmap
}{\void}
178 Returns the bitmap used for the wizard.
181 \membersection{wxWizard::GetBitmapBackgroundColour
}\label{wxwizardgetbitmapbackgroundcolour
}
183 \constfunc{const wxColour\&
}{GetBitmapBackgroundColour
}{\void}
185 Returns the colour that should be used to fill the area not taken up by the wizard or page bitmap,
186 if a non-zero bitmap placement flag has been set.
188 See also
\helpref{wxWizard::SetBitmapPlacement
}{wxwizardsetbitmapplacement
}.
192 \membersection{wxWizard::GetBitmapPlacement
}\label{wxwizardgetbitmapplacement
}
194 \func{int
}{GetBitmapPlacement
}{\void}
196 Returns the flags indicating how the wizard or page bitmap should be expanded and positioned to fit the
197 page height. By default, placement is
0 (no expansion is done).
199 See also
\helpref{wxWizard::SetBitmapPlacement
}{wxwizardsetbitmapplacement
} for the possible values.
202 \membersection{wxWizard::GetCurrentPage
}\label{wxwizardgetcurrentpage
}
204 \constfunc{wxWizardPage*
}{GetCurrentPage
}{\void}
206 Get the current page while the wizard is running.
{\tt NULL
} is returned if
207 \helpref{RunWizard()
}{wxwizardrunwizard
} is not being executed now.
210 \membersection{wxWizard::GetMinimumBitmapWidth
}\label{wxwizardgetminimumbitmapwidth
}
212 \constfunc{int
}{GetMinimumBitmapWidth
}{\void}
214 Returns the minimum width for the bitmap that will be constructed to contain the actual wizard or page bitmap
215 if a non-zero bitmap placement flag has been set.
217 See also
\helpref{wxWizard::SetBitmapPlacement
}{wxwizardsetbitmapplacement
}.
220 \membersection{wxWizard::GetPageAreaSizer
}\label{wxwizardgetpageareasizer
}
222 \constfunc{virtual wxSizer*
}{GetPageAreaSizer
}{\void}
224 Returns pointer to page area sizer. The wizard is laid out using sizers and
225 the page area sizer is the place-holder for the pages. All pages are resized before
226 being shown to match the wizard page area.
228 Page area sizer has a minimal size that is the maximum of several values. First,
229 all pages (or other objects) added to the sizer. Second, all pages reachable
230 by repeatedly applying
231 \helpref{wxWizardPage::GetNext
}{wxwizardpagegetnext
} to
232 any page inserted into the sizer. Third,
233 the minimal size specified using
\helpref{SetPageSize
}{wxwizardsetpagesize
} and
234 \helpref{FitToPage
}{wxwizardfittopage
}. Fourth, the total wizard height may
235 be increased to accommodate the bitmap height. Fifth and finally, wizards are
236 never smaller than some built-in minimal size to avoid wizards that are too small.
238 The caller can use
\helpref{wxSizer::SetMinSize
}{wxsizersetminsize
} to enlarge it
239 beyond the minimal size. If
{\tt wxRESIZE
\_BORDER} was passed to constructor, user
240 can resize wizard and consequently the page area (but not make it smaller than the
243 It is recommended to add the first page to the page area sizer. For simple wizards,
244 this will enlarge the wizard to fit the biggest page. For non-linear wizards,
245 the first page of every separate chain should be added. Caller-specified size
246 can be accomplished using
\helpref{wxSizer::SetMinSize
}{wxsizersetminsize
}.
248 Adding pages to the page area sizer affects the default border width around page
249 area that can be altered with
\helpref{SetBorder
}{wxwizardsetborder
}.
252 \membersection{wxWizard::GetPageSize
}\label{wxwizardgetpagesize
}
254 \constfunc{wxSize
}{GetPageSize
}{\void}
256 Returns the size available for the pages.
259 \membersection{wxWizard::HasNextPage
}\label{wxwizardhasnextpage
}
261 \func{virtual bool
}{HasNextPage
}{\param{wxWizardPage *
}{page
}}
263 Return
{\tt true
} if this page is not the last one in the wizard. The base
264 class version implements this by calling
265 \helpref{page->GetNext
}{wxwizardpagegetnext
} but this could be undesirable if,
266 for example, the pages are created on demand only.
270 \helpref{HasPrevPage
}{wxwizardhasprevpage
}
273 \membersection{wxWizard::HasPrevPage
}\label{wxwizardhasprevpage
}
275 \func{virtual bool
}{HasPrevPage
}{\param{wxWizardPage *
}{page
}}
277 Returns
{\tt true
} if this page is not the last one in the wizard. The base
278 class version implements this by calling
279 \helpref{page->GetPrev
}{wxwizardpagegetprev
} but this could be undesirable if,
280 for example, the pages are created on demand only.
284 \helpref{HasNextPage
}{wxwizardhasnextpage
}
287 \membersection{wxWizard::RunWizard
}\label{wxwizardrunwizard
}
289 \func{bool
}{RunWizard
}{\param{wxWizardPage*
}{firstPage
}}
291 Executes the wizard starting from the given page, returning
{\tt true
} if it was
292 successfully finished or
{\tt false
} if user cancelled it. The
{\it firstPage
}
293 can not be
{\tt NULL
}.
295 \membersection{wxWizard::SetBitmap
}\label{wxwizardsetbitmap
}
297 \func{void
}{SetBitmap
}{\param{const wxBitmap\&
}{bitmap
}}
299 Sets the bitmap used for the wizard.
302 \membersection{wxWizard::SetBitmapBackgroundColour
}\label{wxwizardsetbitmapbackgroundcolour
}
304 \func{void
}{SetBitmapBackgroundColour
}{\param{const wxColour\&
}{ colour
}}
306 Sets the colour that should be used to fill the area not taken up by the wizard or page bitmap,
307 if a non-zero bitmap placement flag has been set.
309 See also
\helpref{wxWizard::SetBitmapPlacement
}{wxwizardsetbitmapplacement
}.
312 \membersection{wxWizard::SetBitmapPlacement
}\label{wxwizardsetbitmapplacement
}
314 \func{void
}{SetBitmapPlacement
}{\param{int
}{ placement
}}
316 Sets the flags indicating how the wizard or page bitmap should be expanded and positioned to fit the
317 page height. By default, placement is
0 (no expansion is done).
{\it placement
} is a bitlist with the
318 following possible values:
320 \begin{twocollist
}\itemsep=
0pt
321 \twocolitem{\windowstyle{wxWIZARD
\_VALIGN\_TOP}}{Aligns the bitmap at the top.
}
322 \twocolitem{\windowstyle{wxWIZARD
\_VALIGN\_CENTRE}}{Centres the bitmap vertically.
}
323 \twocolitem{\windowstyle{wxWIZARD
\_VALIGN\_BOTTOM}}{Aligns the bitmap at the bottom.
}
324 \twocolitem{\windowstyle{wxWIZARD
\_HALIGN\_LEFT}}{Left-aligns the bitmap.
}
325 \twocolitem{\windowstyle{wxWIZARD
\_HALIGN\_CENTRE}}{Centres the bitmap horizontally.
}
326 \twocolitem{\windowstyle{wxWIZARD
\_HALIGN\_RIGHT}}{Right-aligns the bitmap.
}
327 \twocolitem{\windowstyle{wxWIZARD
\_TILE}}{}
330 See also
\helpref{wxWizard::SetMinimumBitmapWidth
}{wxwizardsetminimumbitmapwidth
}.
333 \membersection{wxWizard::SetMinimumBitmapWidth
}\label{wxwizardsetminimumbitmapwidth
}
335 \func{void
}{SetMinimumBitmapWidth
}{\param{int
}{ width
}}
337 Sets the minimum width for the bitmap that will be constructed to contain the actual wizard or page bitmap
338 if a non-zero bitmap placement flag has been set. If this is not set when using bitmap placement, the initial
339 layout may be incorrect.
341 See also
\helpref{wxWizard::SetBitmapPlacement
}{wxwizardsetbitmapplacement
}.
345 \membersection{wxWizard::SetPageSize
}\label{wxwizardsetpagesize
}
347 \func{void
}{SetPageSize
}{\param{const wxSize\&
}{sizePage
}}
349 This method is obsolete, use
350 \helpref{GetPageAreaSizer
}{wxwizardgetpageareasizer
} instead.
352 Sets the minimal size to be made available for the wizard pages. The wizard
353 will take into account the size of the bitmap (if any) itself. Also, the
354 wizard will never be smaller than the default size.
356 The recommended way to use this function is to lay out all wizard pages using
357 the sizers (even though the wizard is not resizeable) and then use
358 \helpref{wxSizer::CalcMin
}{wxsizercalcmin
} in a loop to calculate the maximum
359 of minimal sizes of the pages and pass it to SetPageSize().
362 \membersection{wxWizard::SetBorder
}\label{wxwizardsetborder
}
364 \func{void
}{SetBorder
}{\param{int
}{border
}}
366 Sets width of border around page area. Default is zero. For backward
367 compatibility, if there are no pages in
368 \helpref{GetPageAreaSizer
}{wxwizardgetpageareasizer
}, the default is $
5$ pixels.
370 If there is a five point border around all controls in a page and the border around
371 page area is left as zero, a five point white space along all dialog borders
372 will be added to the control border in order to space page controls ten points from the dialog
373 border and non-page controls.