]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/wizard.tex
added wxGLCanvas::IsDisplaySupported() (patch 1879906)
[wxWidgets.git] / docs / latex / wx / wizard.tex
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
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.
18
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.
22
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.
28
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}.
33
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}.
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
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
61 happening.
62
63 \twocolwidtha{7cm}
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.}
73 \end{twocollist}
74
75 \wxheading{Extended styles}
76
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}).
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
85 See 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
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
100 calls.
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
104 Constructor which really creates the wizard -- if you use this constructor, you
105 shouldn't call \helpref{Create}{wxwizardcreate}.
106
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.
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
121 also \helpref{GetBitmap}{wxwizardpagegetbitmap}.}
122
123 \docparam{pos}{The position of the dialog, it will be centered on the screen
124 by 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
133 Creates the wizard dialog. Must be called if the default constructor had been
134 used to create the object.
135
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.
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
150 also \helpref{GetBitmap}{wxwizardpagegetbitmap}.}
151
152 \docparam{pos}{The position of the dialog, it will be centered on the screen
153 by 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
162 This method is obsolete, use
163 \helpref{GetPageAreaSizer}{wxwizardgetpageareasizer} instead.
164
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.
167
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.
173
174 \membersection{wxWizard::GetBitmap}\label{wxwizardgetbitmap}
175
176 \constfunc{const wxBitmap\&}{GetBitmap}{\void}
177
178 Returns the bitmap used for the wizard.
179
180
181 \membersection{wxWizard::GetBitmapBackgroundColour}\label{wxwizardgetbitmapbackgroundcolour}
182
183 \constfunc{const wxColour\&}{GetBitmapBackgroundColour}{\void}
184
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.
187
188 See also \helpref{wxWizard::SetBitmapPlacement}{wxwizardsetbitmapplacement}.
189
190
191
192 \membersection{wxWizard::GetBitmapPlacement}\label{wxwizardgetbitmapplacement}
193
194 \func{int}{GetBitmapPlacement}{\void}
195
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).
198
199 See also \helpref{wxWizard::SetBitmapPlacement}{wxwizardsetbitmapplacement} for the possible values.
200
201
202 \membersection{wxWizard::GetCurrentPage}\label{wxwizardgetcurrentpage}
203
204 \constfunc{wxWizardPage*}{GetCurrentPage}{\void}
205
206 Get 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
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.
216
217 See also \helpref{wxWizard::SetBitmapPlacement}{wxwizardsetbitmapplacement}.
218
219
220 \membersection{wxWizard::GetPageAreaSizer}\label{wxwizardgetpageareasizer}
221
222 \constfunc{virtual wxSizer*}{GetPageAreaSizer}{\void}
223
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.
227
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.
237
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
241 minimal size).
242
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}.
247
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}.
250
251
252 \membersection{wxWizard::GetPageSize}\label{wxwizardgetpagesize}
253
254 \constfunc{wxSize}{GetPageSize}{\void}
255
256 Returns the size available for the pages.
257
258
259 \membersection{wxWizard::HasNextPage}\label{wxwizardhasnextpage}
260
261 \func{virtual bool}{HasNextPage}{\param{wxWizardPage *}{page}}
262
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.
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
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.
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
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}.
294
295 \membersection{wxWizard::SetBitmap}\label{wxwizardsetbitmap}
296
297 \func{void}{SetBitmap}{\param{const wxBitmap\& }{bitmap}}
298
299 Sets the bitmap used for the wizard.
300
301
302 \membersection{wxWizard::SetBitmapBackgroundColour}\label{wxwizardsetbitmapbackgroundcolour}
303
304 \func{void}{SetBitmapBackgroundColour}{\param{const wxColour\&}{ colour}}
305
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.
308
309 See also \helpref{wxWizard::SetBitmapPlacement}{wxwizardsetbitmapplacement}.
310
311
312 \membersection{wxWizard::SetBitmapPlacement}\label{wxwizardsetbitmapplacement}
313
314 \func{void}{SetBitmapPlacement}{\param{int}{ placement}}
315
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:
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
330 See also \helpref{wxWizard::SetMinimumBitmapWidth}{wxwizardsetminimumbitmapwidth}.
331
332
333 \membersection{wxWizard::SetMinimumBitmapWidth}\label{wxwizardsetminimumbitmapwidth}
334
335 \func{void}{SetMinimumBitmapWidth}{\param{int}{ width}}
336
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.
340
341 See also \helpref{wxWizard::SetBitmapPlacement}{wxwizardsetbitmapplacement}.
342
343
344
345 \membersection{wxWizard::SetPageSize}\label{wxwizardsetpagesize}
346
347 \func{void}{SetPageSize}{\param{const wxSize\& }{sizePage}}
348
349 This method is obsolete, use
350 \helpref{GetPageAreaSizer}{wxwizardgetpageareasizer} instead.
351
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.
355
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().
360
361
362 \membersection{wxWizard::SetBorder}\label{wxwizardsetborder}
363
364 \func{void}{SetBorder}{\param{int }{border}}
365
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.
369
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.
374