]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/wizard.tex
Added periods
[wxWidgets.git] / docs / latex / wx / wizard.tex
CommitLineData
f6bcfd97
BP
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: wizard.tex
3%% Purpose: wxWizard class documentation
4%% Author: Vadim Zeitlin
07f20d9a 5%% Modified by: Robert Vazan (sizers)
f6bcfd97
BP
6%% Created: 02.04.00
7%% RCS-ID: $Id$
8%% Copyright: (c) Vadim Zeitlin
8795498c 9%% License: wxWindows license
f6bcfd97
BP
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12\section{\class{wxWizard}}\label{wxwizard}
13
14wxWizard is the central class for implementing `wizard-like' dialogs. These
027aa6fa
JS
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.
f6bcfd97
BP
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
027aa6fa
JS
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
750cefbc
VZ
25\helpref{Create}{wxwizardcreate} function. Then you should add all pages you
26want the wizard to show and call \helpref{RunWizard}{wxwizardrunwizard}.
b18f44e2 27Finally, don't forget to call {\tt wizard->Destroy()}, otherwise your application will hang on exit due to an undestroyed window.
f6bcfd97
BP
28
29\wxheading{Derived from}
30
31\helpref{wxDialog}{wxdialog}\\
32\helpref{wxPanel}{wxpanel}\\
33\helpref{wxWindow}{wxwindow}\\
34\helpref{wxEvtHandler}{wxevthandler}\\
35\helpref{wxObject}{wxobject}
36
37\wxheading{Include files}
38
39<wx/wizard.h>
40
a7af285d
VZ
41\wxheading{Library}
42
43\helpref{wxAdv}{librarieslist}
44
f6bcfd97
BP
45\wxheading{Event table macros}
46
47To process input from a wizard dialog, use these event handler macros to
48direct input to member functions that take a
49\helpref{wxWizardEvent}{wxwizardevent} argument. For some events,
50\helpref{Veto()}{wxnotifyeventveto} can be called to prevent the event from
51happening.
52
53\twocolwidtha{7cm}
54\begin{twocollist}\itemsep=2pt
027aa6fa
JS
55\twocolitem{{\bf EVT\_WIZARD\_PAGE\_CHANGED(id, func)}}{The page has just been
56changed (this event cannot be vetoed).}
f6bcfd97
BP
57\twocolitem{{\bf EVT\_WIZARD\_PAGE\_CHANGING(id, func)}}{The page is being
58changed (this event can be vetoed).}
59\twocolitem{{\bf EVT\_WIZARD\_CANCEL(id, func)}}{The user attempted to cancel
60the wizard (this event may also be vetoed).}
f80bf901 61\twocolitem{{\bf EVT\_WIZARD\_HELP(id, func)}}{The wizard help button was pressed.}
1d30a0a1 62\twocolitem{{\bf EVT\_WIZARD\_FINISHED(id, func)}}{The wizard finished button was pressed.}
d2c2afc9 63\end{twocollist}
f6bcfd97 64
213ba43b
JS
65\wxheading{Extended styles}
66
67Use the \helpref{wxWindow::SetExtraStyle}{wxwindowsetextrastyle} function to set the following
68style. You will need to use two-step construction (use the default constructor, call {\bf SetExtraStyle}, then call {\bf Create}).
69
70\twocolwidtha{5cm}%
71\begin{twocollist}\itemsep=0pt
72\twocolitem{\windowstyle{wxWIZARD\_EX\_HELPBUTTON}}{Shows a Help button using wxID\_HELP.}
73\end{twocollist}
74
75See also \helpref{wxDialog}{wxdialog} for other extended styles.
76
f6bcfd97
BP
77\wxheading{See also}
78
79\helpref{wxWizardEvent}{wxwizardevent}, \helpref{wxWizardPage}{wxwizardpage}, \helpref{wxWizard sample}{samplewizard}
80
81\latexignore{\rtfignore{\wxheading{Members}}}
82
213ba43b
JS
83\membersection{wxWizard::wxWizard}\label{wxwizardctor}
84
85\func{}{wxWizard}{\void}
86
750cefbc
VZ
87Default constructor. Use this if you wish to derive from wxWizard and then call
88\helpref{Create}{wxwizardcreate}, for example if you wish to set an extra style
89with \helpref{wxWindow::SetExtraStyle}{wxwindowsetextrastyle} between the two
90calls.
213ba43b 91
c0d26c0f 92\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}}
213ba43b 93
750cefbc
VZ
94Constructor which really creates the wizard -- if you use this constructor, you
95shouldn't call \helpref{Create}{wxwizardcreate}.
213ba43b 96
fc2171bd 97Notice that unlike almost all other wxWidgets classes, there is no {\it size}
027aa6fa 98parameter in the wxWizard constructor because the wizard will have a predefined
213ba43b 99default size by default. If you want to change this, you should use the
07f20d9a 100\helpref{GetPageAreaSizer}{wxwizardgetpageareasizer} function.
213ba43b
JS
101
102\wxheading{Parameters}
103
104\docparam{parent}{The parent window, may be NULL.}
105
106\docparam{id}{The id of the dialog, will usually be just $-1$.}
107
108\docparam{title}{The title of the dialog.}
109
110\docparam{bitmap}{The default bitmap used in the left side of the wizard. See
111also \helpref{GetBitmap}{wxwizardpagegetbitmap}.}
112
113\docparam{pos}{The position of the dialog, it will be centered on the screen
114by default.}
115
07f20d9a
VZ
116\docparam{style}{Window style is passed to wxDialog.}
117
118
f6bcfd97
BP
119\membersection{wxWizard::Create}\label{wxwizardcreate}
120
c0d26c0f 121\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}}
f6bcfd97 122
750cefbc
VZ
123Creates the wizard dialog. Must be called if the default constructor had been
124used to create the object.
f6bcfd97 125
fc2171bd 126Notice that unlike almost all other wxWidgets classes, there is no {\it size}
027aa6fa 127parameter in the wxWizard constructor because the wizard will have a predefined
f6bcfd97 128default size by default. If you want to change this, you should use the
07f20d9a 129\helpref{GetPageAreaSizer}{wxwizardgetpageareasizer} function.
f6bcfd97
BP
130
131\wxheading{Parameters}
132
133\docparam{parent}{The parent window, may be NULL.}
134
135\docparam{id}{The id of the dialog, will usually be just $-1$.}
136
137\docparam{title}{The title of the dialog.}
138
139\docparam{bitmap}{The default bitmap used in the left side of the wizard. See
140also \helpref{GetBitmap}{wxwizardpagegetbitmap}.}
141
142\docparam{pos}{The position of the dialog, it will be centered on the screen
143by default.}
144
07f20d9a
VZ
145\docparam{style}{Window style is passed to wxDialog.}
146
147
2b5f62a0 148\membersection{wxWizard::FitToPage}\label{wxwizardfittopage}
f6bcfd97 149
384c9653 150\func{void}{FitToPage}{\param{const wxWizardPage* }{firstPage}}
f6bcfd97 151
07f20d9a
VZ
152This method is obsolete, use
153\helpref{GetPageAreaSizer}{wxwizardgetpageareasizer} instead.
154
c73b439f
VZ
155Sets the page size to be big enough for all the pages accessible via the
156given {\it firstPage}, i.e. this page, its next page and so on.
157
158This method may be called more than once and it will only change the page size
159if the size required by the new page is bigger than the previously set one.
027aa6fa
JS
160This is useful if the decision about which pages to show is taken during
161run-time, as in this case, the wizard won't be able to get to all pages starting
c73b439f 162from a single one and you should call {\it Fit} separately for the others.
f6bcfd97 163
f49fd6d0
JS
164\membersection{wxWizard::GetBitmap}\label{wxwizardgetbitmap}
165
166\constfunc{const wxBitmap\&}{GetBitmap}{\void}
167
168Returns the bitmap used for the wizard.
07f20d9a 169
f6bcfd97
BP
170\membersection{wxWizard::GetCurrentPage}\label{wxwizardgetcurrentpage}
171
172\constfunc{wxWizardPage*}{GetCurrentPage}{\void}
173
174Get the current page while the wizard is running. {\tt NULL} is returned if
175\helpref{RunWizard()}{wxwizardrunwizard} is not being executed now.
176
07f20d9a
VZ
177
178\membersection{wxWizard::GetPageAreaSizer}\label{wxwizardgetpageareasizer}
179
180\constfunc{virtual wxSizer*}{GetPageAreaSizer}{\void}
181
027aa6fa
JS
182Returns pointer to page area sizer. The wizard is laid out using sizers and
183the page area sizer is the place-holder for the pages. All pages are resized before
07f20d9a
VZ
184being shown to match the wizard page area.
185
027aa6fa 186Page area sizer has a minimal size that is the maximum of several values. First,
07f20d9a
VZ
187all pages (or other objects) added to the sizer. Second, all pages reachable
188by repeatedly applying
189\helpref{wxWizardPage::GetNext}{wxwizardpagegetnext} to
190any page inserted into the sizer. Third,
027aa6fa 191the minimal size specified using \helpref{SetPageSize}{wxwizardsetpagesize} and
07f20d9a 192\helpref{FitToPage}{wxwizardfittopage}. Fourth, the total wizard height may
dbd94b75 193be increased to accommodate the bitmap height. Fifth and finally, wizards are
027aa6fa 194never smaller than some built-in minimal size to avoid wizards that are too small.
07f20d9a 195
027aa6fa
JS
196The caller can use \helpref{wxSizer::SetMinSize}{wxsizersetminsize} to enlarge it
197beyond the minimal size. If {\tt wxRESIZE\_BORDER} was passed to constructor, user
198can resize wizard and consequently the page area (but not make it smaller than the
07f20d9a
VZ
199minimal size).
200
027aa6fa
JS
201It is recommended to add the first page to the page area sizer. For simple wizards,
202this will enlarge the wizard to fit the biggest page. For non-linear wizards,
203the first page of every separate chain should be added. Caller-specified size
07f20d9a
VZ
204can be accomplished using \helpref{wxSizer::SetMinSize}{wxsizersetminsize}.
205
027aa6fa 206Adding pages to the page area sizer affects the default border width around page
07f20d9a
VZ
207area that can be altered with \helpref{SetBorder}{wxwizardsetborder}.
208
209
f6bcfd97
BP
210\membersection{wxWizard::GetPageSize}\label{wxwizardgetpagesize}
211
212\constfunc{wxSize}{GetPageSize}{\void}
213
214Returns the size available for the pages.
215
07f20d9a 216
2b5f62a0
VZ
217\membersection{wxWizard::HasNextPage}\label{wxwizardhasnextpage}
218
219\func{virtual bool}{HasNextPage}{\param{wxWizardPage *}{page}}
220
cc81d32f 221Return {\tt true} if this page is not the last one in the wizard. The base
2b5f62a0
VZ
222class version implements this by calling
223\helpref{page->GetNext}{wxwizardpagegetnext} but this could be undesirable if,
224for example, the pages are created on demand only.
225
226\wxheading{See also}
227
228\helpref{HasPrevPage}{wxwizardhasprevpage}
229
07f20d9a 230
2b5f62a0
VZ
231\membersection{wxWizard::HasPrevPage}\label{wxwizardhasprevpage}
232
233\func{virtual bool}{HasPrevPage}{\param{wxWizardPage *}{page}}
234
027aa6fa 235Returns {\tt true} if this page is not the last one in the wizard. The base
2b5f62a0
VZ
236class version implements this by calling
237\helpref{page->GetPrev}{wxwizardpagegetprev} but this could be undesirable if,
238for example, the pages are created on demand only.
239
240\wxheading{See also}
241
242\helpref{HasNextPage}{wxwizardhasnextpage}
243
07f20d9a 244
c73b439f
VZ
245\membersection{wxWizard::RunWizard}\label{wxwizardrunwizard}
246
247\func{bool}{RunWizard}{\param{wxWizardPage* }{firstPage}}
248
027aa6fa 249Executes the wizard starting from the given page, returning {\tt true} if it was
cc81d32f 250successfully finished or {\tt false} if user cancelled it. The {\it firstPage}
c73b439f
VZ
251can not be {\tt NULL}.
252
f49fd6d0
JS
253\membersection{wxWizard::SetBitmap}\label{wxwizardsetbitmap}
254
255\func{void}{SetBitmap}{\param{const wxBitmap\& }{bitmap}}
256
257Sets the bitmap used for the wizard.
07f20d9a 258
f6bcfd97
BP
259\membersection{wxWizard::SetPageSize}\label{wxwizardsetpagesize}
260
261\func{void}{SetPageSize}{\param{const wxSize\& }{sizePage}}
262
07f20d9a
VZ
263This method is obsolete, use
264\helpref{GetPageAreaSizer}{wxwizardgetpageareasizer} instead.
265
f6bcfd97
BP
266Sets the minimal size to be made available for the wizard pages. The wizard
267will take into account the size of the bitmap (if any) itself. Also, the
268wizard will never be smaller than the default size.
269
027aa6fa 270The recommended way to use this function is to lay out all wizard pages using
f6bcfd97
BP
271the sizers (even though the wizard is not resizeable) and then use
272\helpref{wxSizer::CalcMin}{wxsizercalcmin} in a loop to calculate the maximum
273of minimal sizes of the pages and pass it to SetPageSize().
274
07f20d9a
VZ
275
276\membersection{wxWizard::SetBorder}\label{wxwizardsetborder}
277
278\func{void}{SetBorder}{\param{int }{border}}
279
280Sets width of border around page area. Default is zero. For backward
281compatibility, if there are no pages in
027aa6fa 282\helpref{GetPageAreaSizer}{wxwizardgetpageareasizer}, the default is $5$ pixels.
07f20d9a 283
027aa6fa
JS
284If there is a five point border around all controls in a page and the border around
285page area is left as zero, a five point white space along all dialog borders
286will be added to the control border in order to space page controls ten points from the dialog
07f20d9a
VZ
287border and non-page controls.
288