]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/wizard.tex
no changes, just come cleanup and more comments
[wxWidgets.git] / docs / latex / wx / wizard.tex
... / ...
CommitLineData
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: wizard.tex
3%% Purpose: wxWizard class documentation
4%% Author: Vadim Zeitlin
5%% Modified by: Robert Vazan (sizers)
6%% Created: 02.04.00
7%% RCS-ID: $Id$
8%% Copyright: (c) Vadim Zeitlin
9%% License: wxWindows license
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12\section{\class{wxWizard}}\label{wxwizard}
13
14wxWizard is the central class for implementing `wizard-like' dialogs. These
15dialogs are mostly familiar to Windows users and are nothing other than a
16sequence of `pages', each displayed inside a dialog which has the
17buttons to navigate to the next (and previous) pages.
18
19The wizards are typically used to decompose a complex dialog into several
20simple steps and are mainly useful to the novice users, hence it is important
21to keep them as simple as possible.
22
23To show a wizard dialog, you must first create an instance of the wxWizard class
24using 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
26want the wizard to show and call \helpref{RunWizard}{wxwizardrunwizard}.
27Finally, don't forget to call {\tt wizard->Destroy()}, otherwise your application will hang on exit due to an undestroyed window.
28
29You can supply a bitmap to display on the left of the wizard, either for all pages
30or for individual pages. If you need to have the bitmap resize to the height of the wizard,
31call \helpref{wxWizard::SetBitmapPlacement}{wxwizardsetbitmapplacement} and if necessary,\rtfsp
32\helpref{wxWizard::SetBitmapBackgroundColour}{wxwizardsetbitmapbackgroundcolour} and \helpref{wxWizard::SetMinimumBitmapWidth}{wxwizardsetminimumbitmapwidth}.
33
34To make wizard pages scroll when the display is too small to fit the whole dialog, you can switch
35layout adaptation on globally with \helpref{wxDialog::EnableLayoutAdaptation}{wxdialogenablelayoutadaptation} or
36per dialog with \helpref{wxDialog::SetLayoutAdaptationMode}{wxdialogsetlayoutadaptationmode}. For more
37about layout adaptation, see \helpref{Automatic scrolling dialogs}{autoscrollingdialogs}.
38
39\wxheading{Derived from}
40
41\helpref{wxDialog}{wxdialog}\\
42\helpref{wxTopLevelWindow}{wxtoplevelwindow}\\
43\helpref{wxWindow}{wxwindow}\\
44\helpref{wxEvtHandler}{wxevthandler}\\
45\helpref{wxObject}{wxobject}
46
47\wxheading{Include files}
48
49<wx/wizard.h>
50
51\wxheading{Library}
52
53\helpref{wxAdv}{librarieslist}
54
55\wxheading{Event table macros}
56
57To process input from a wizard dialog, use these event handler macros to
58direct 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
61happening.
62
63\twocolwidtha{7cm}
64\begin{twocollist}\itemsep=2pt
65\twocolitem{{\bf EVT\_WIZARD\_PAGE\_CHANGED(id, func)}}{The page has just been
66changed (this event cannot be vetoed).}
67\twocolitem{{\bf EVT\_WIZARD\_PAGE\_CHANGING(id, func)}}{The page is being
68changed (this event can be vetoed).}
69\twocolitem{{\bf EVT\_WIZARD\_CANCEL(id, func)}}{The user attempted to cancel
70the 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.}
73\end{twocollist}
74
75\wxheading{Extended styles}
76
77Use the \helpref{wxWindow::SetExtraStyle}{wxwindowsetextrastyle} function to set the following
78style. You will need to use two-step construction (use the default constructor, call {\bf SetExtraStyle}, then call {\bf Create}).
79
80\twocolwidtha{5cm}%
81\begin{twocollist}\itemsep=0pt
82\twocolitem{\windowstyle{wxWIZARD\_EX\_HELPBUTTON}}{Shows a Help button using wxID\_HELP.}
83\end{twocollist}
84
85See also \helpref{wxDialog}{wxdialog} for other extended styles.
86
87\wxheading{See also}
88
89\helpref{wxWizardEvent}{wxwizardevent}, \helpref{wxWizardPage}{wxwizardpage}, \helpref{wxWizard sample}{samplewizard}
90
91\latexignore{\rtfignore{\wxheading{Members}}}
92
93\membersection{wxWizard::wxWizard}\label{wxwizardctor}
94
95\func{}{wxWizard}{\void}
96
97Default 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
99with \helpref{wxWindow::SetExtraStyle}{wxwindowsetextrastyle} between the two
100calls.
101
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}}
103
104Constructor which really creates the wizard -- if you use this constructor, you
105shouldn't call \helpref{Create}{wxwizardcreate}.
106
107Notice that unlike almost all other wxWidgets classes, there is no {\it size}
108parameter in the wxWizard constructor because the wizard will have a predefined
109default size by default. If you want to change this, you should use the
110\helpref{GetPageAreaSizer}{wxwizardgetpageareasizer} function.
111
112\wxheading{Parameters}
113
114\docparam{parent}{The parent window, may be NULL.}
115
116\docparam{id}{The id of the dialog, will usually be just $-1$.}
117
118\docparam{title}{The title of the dialog.}
119
120\docparam{bitmap}{The default bitmap used in the left side of the wizard. See
121also \helpref{GetBitmap}{wxwizardpagegetbitmap}.}
122
123\docparam{pos}{The position of the dialog, it will be centered on the screen
124by default.}
125
126\docparam{style}{Window style is passed to wxDialog.}
127
128
129\membersection{wxWizard::Create}\label{wxwizardcreate}
130
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}}
132
133Creates the wizard dialog. Must be called if the default constructor had been
134used to create the object.
135
136Notice that unlike almost all other wxWidgets classes, there is no {\it size}
137parameter in the wxWizard constructor because the wizard will have a predefined
138default size by default. If you want to change this, you should use the
139\helpref{GetPageAreaSizer}{wxwizardgetpageareasizer} function.
140
141\wxheading{Parameters}
142
143\docparam{parent}{The parent window, may be NULL.}
144
145\docparam{id}{The id of the dialog, will usually be just $-1$.}
146
147\docparam{title}{The title of the dialog.}
148
149\docparam{bitmap}{The default bitmap used in the left side of the wizard. See
150also \helpref{GetBitmap}{wxwizardpagegetbitmap}.}
151
152\docparam{pos}{The position of the dialog, it will be centered on the screen
153by default.}
154
155\docparam{style}{Window style is passed to wxDialog.}
156
157
158\membersection{wxWizard::FitToPage}\label{wxwizardfittopage}
159
160\func{void}{FitToPage}{\param{const wxWizardPage* }{firstPage}}
161
162This method is obsolete, use
163\helpref{GetPageAreaSizer}{wxwizardgetpageareasizer} instead.
164
165Sets the page size to be big enough for all the pages accessible via the
166given {\it firstPage}, i.e. this page, its next page and so on.
167
168This method may be called more than once and it will only change the page size
169if the size required by the new page is bigger than the previously set one.
170This is useful if the decision about which pages to show is taken during
171run-time, as in this case, the wizard won't be able to get to all pages starting
172from a single one and you should call {\it Fit} separately for the others.
173
174\membersection{wxWizard::GetBitmap}\label{wxwizardgetbitmap}
175
176\constfunc{const wxBitmap\&}{GetBitmap}{\void}
177
178Returns the bitmap used for the wizard.
179
180
181\membersection{wxWizard::GetBitmapBackgroundColour}\label{wxwizardgetbitmapbackgroundcolour}
182
183\constfunc{const wxColour\&}{GetBitmapBackgroundColour}{\void}
184
185Returns the colour that should be used to fill the area not taken up by the wizard or page bitmap,
186if a non-zero bitmap placement flag has been set.
187
188See also \helpref{wxWizard::SetBitmapPlacement}{wxwizardsetbitmapplacement}.
189
190
191
192\membersection{wxWizard::GetBitmapPlacement}\label{wxwizardgetbitmapplacement}
193
194\func{int}{GetBitmapPlacement}{\void}
195
196Returns the flags indicating how the wizard or page bitmap should be expanded and positioned to fit the
197page height. By default, placement is 0 (no expansion is done).
198
199See also \helpref{wxWizard::SetBitmapPlacement}{wxwizardsetbitmapplacement} for the possible values.
200
201
202\membersection{wxWizard::GetCurrentPage}\label{wxwizardgetcurrentpage}
203
204\constfunc{wxWizardPage*}{GetCurrentPage}{\void}
205
206Get the current page while the wizard is running. {\tt NULL} is returned if
207\helpref{RunWizard()}{wxwizardrunwizard} is not being executed now.
208
209
210\membersection{wxWizard::GetMinimumBitmapWidth}\label{wxwizardgetminimumbitmapwidth}
211
212\constfunc{int}{GetMinimumBitmapWidth}{\void}
213
214Returns the minimum width for the bitmap that will be constructed to contain the actual wizard or page bitmap
215if a non-zero bitmap placement flag has been set.
216
217See also \helpref{wxWizard::SetBitmapPlacement}{wxwizardsetbitmapplacement}.
218
219
220\membersection{wxWizard::GetPageAreaSizer}\label{wxwizardgetpageareasizer}
221
222\constfunc{virtual wxSizer*}{GetPageAreaSizer}{\void}
223
224Returns pointer to page area sizer. The wizard is laid out using sizers and
225the page area sizer is the place-holder for the pages. All pages are resized before
226being shown to match the wizard page area.
227
228Page area sizer has a minimal size that is the maximum of several values. First,
229all pages (or other objects) added to the sizer. Second, all pages reachable
230by repeatedly applying
231\helpref{wxWizardPage::GetNext}{wxwizardpagegetnext} to
232any page inserted into the sizer. Third,
233the minimal size specified using \helpref{SetPageSize}{wxwizardsetpagesize} and
234\helpref{FitToPage}{wxwizardfittopage}. Fourth, the total wizard height may
235be increased to accommodate the bitmap height. Fifth and finally, wizards are
236never smaller than some built-in minimal size to avoid wizards that are too small.
237
238The caller can use \helpref{wxSizer::SetMinSize}{wxsizersetminsize} to enlarge it
239beyond the minimal size. If {\tt wxRESIZE\_BORDER} was passed to constructor, user
240can resize wizard and consequently the page area (but not make it smaller than the
241minimal size).
242
243It is recommended to add the first page to the page area sizer. For simple wizards,
244this will enlarge the wizard to fit the biggest page. For non-linear wizards,
245the first page of every separate chain should be added. Caller-specified size
246can be accomplished using \helpref{wxSizer::SetMinSize}{wxsizersetminsize}.
247
248Adding pages to the page area sizer affects the default border width around page
249area that can be altered with \helpref{SetBorder}{wxwizardsetborder}.
250
251
252\membersection{wxWizard::GetPageSize}\label{wxwizardgetpagesize}
253
254\constfunc{wxSize}{GetPageSize}{\void}
255
256Returns the size available for the pages.
257
258
259\membersection{wxWizard::HasNextPage}\label{wxwizardhasnextpage}
260
261\func{virtual bool}{HasNextPage}{\param{wxWizardPage *}{page}}
262
263Return {\tt true} if this page is not the last one in the wizard. The base
264class version implements this by calling
265\helpref{page->GetNext}{wxwizardpagegetnext} but this could be undesirable if,
266for example, the pages are created on demand only.
267
268\wxheading{See also}
269
270\helpref{HasPrevPage}{wxwizardhasprevpage}
271
272
273\membersection{wxWizard::HasPrevPage}\label{wxwizardhasprevpage}
274
275\func{virtual bool}{HasPrevPage}{\param{wxWizardPage *}{page}}
276
277Returns {\tt true} if this page is not the last one in the wizard. The base
278class version implements this by calling
279\helpref{page->GetPrev}{wxwizardpagegetprev} but this could be undesirable if,
280for example, the pages are created on demand only.
281
282\wxheading{See also}
283
284\helpref{HasNextPage}{wxwizardhasnextpage}
285
286
287\membersection{wxWizard::RunWizard}\label{wxwizardrunwizard}
288
289\func{bool}{RunWizard}{\param{wxWizardPage* }{firstPage}}
290
291Executes the wizard starting from the given page, returning {\tt true} if it was
292successfully finished or {\tt false} if user cancelled it. The {\it firstPage}
293can not be {\tt NULL}.
294
295\membersection{wxWizard::SetBitmap}\label{wxwizardsetbitmap}
296
297\func{void}{SetBitmap}{\param{const wxBitmap\& }{bitmap}}
298
299Sets the bitmap used for the wizard.
300
301
302\membersection{wxWizard::SetBitmapBackgroundColour}\label{wxwizardsetbitmapbackgroundcolour}
303
304\func{void}{SetBitmapBackgroundColour}{\param{const wxColour\&}{ colour}}
305
306Sets the colour that should be used to fill the area not taken up by the wizard or page bitmap,
307if a non-zero bitmap placement flag has been set.
308
309See also \helpref{wxWizard::SetBitmapPlacement}{wxwizardsetbitmapplacement}.
310
311
312\membersection{wxWizard::SetBitmapPlacement}\label{wxwizardsetbitmapplacement}
313
314\func{void}{SetBitmapPlacement}{\param{int}{ placement}}
315
316Sets the flags indicating how the wizard or page bitmap should be expanded and positioned to fit the
317page height. By default, placement is 0 (no expansion is done). {\it placement} is a bitlist with the
318following possible values:
319
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}}{}
328\end{twocollist}
329
330See also \helpref{wxWizard::SetMinimumBitmapWidth}{wxwizardsetminimumbitmapwidth}.
331
332
333\membersection{wxWizard::SetMinimumBitmapWidth}\label{wxwizardsetminimumbitmapwidth}
334
335\func{void}{SetMinimumBitmapWidth}{\param{int}{ width}}
336
337Sets the minimum width for the bitmap that will be constructed to contain the actual wizard or page bitmap
338if a non-zero bitmap placement flag has been set. If this is not set when using bitmap placement, the initial
339layout may be incorrect.
340
341See also \helpref{wxWizard::SetBitmapPlacement}{wxwizardsetbitmapplacement}.
342
343
344
345\membersection{wxWizard::SetPageSize}\label{wxwizardsetpagesize}
346
347\func{void}{SetPageSize}{\param{const wxSize\& }{sizePage}}
348
349This method is obsolete, use
350\helpref{GetPageAreaSizer}{wxwizardgetpageareasizer} instead.
351
352Sets the minimal size to be made available for the wizard pages. The wizard
353will take into account the size of the bitmap (if any) itself. Also, the
354wizard will never be smaller than the default size.
355
356The recommended way to use this function is to lay out all wizard pages using
357the sizers (even though the wizard is not resizeable) and then use
358\helpref{wxSizer::CalcMin}{wxsizercalcmin} in a loop to calculate the maximum
359of minimal sizes of the pages and pass it to SetPageSize().
360
361
362\membersection{wxWizard::SetBorder}\label{wxwizardsetborder}
363
364\func{void}{SetBorder}{\param{int }{border}}
365
366Sets width of border around page area. Default is zero. For backward
367compatibility, if there are no pages in
368\helpref{GetPageAreaSizer}{wxwizardgetpageareasizer}, the default is $5$ pixels.
369
370If there is a five point border around all controls in a page and the border around
371page area is left as zero, a five point white space along all dialog borders
372will be added to the control border in order to space page controls ten points from the dialog
373border and non-page controls.
374