]>
git.saurik.com Git - wxWidgets.git/blob - interface/wizard.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: documentation for wxWizardPage class
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
13 wxWizardPage is one of the screens in wxWizard: it must
14 know what are the following and preceding pages (which may be @NULL for the
15 first/last page). Except for this extra knowledge, wxWizardPage is just a
16 panel, so the controls may be placed directly on it in the usual way.
18 This class allows the programmer to decide the order of pages in the wizard
19 dynamically (during run-time) and so provides maximal flexibility. Usually,
20 however, the order of pages is known in advance in which case
21 wxWizardPageSimple class is enough and it is simpler
28 wxWizard, @ref overview_samplewizard "wxWizard sample"
30 class wxWizardPage
: public wxPanel
34 Constructor accepts an optional bitmap which will be used for this page
35 instead of the default one for this wizard (note that all bitmaps used should
36 be of the same size). Notice that no other parameters are needed because the
37 wizard will resize and reposition the page anyhow.
42 The page-specific bitmap if different from the global one
44 wxWizardPage(wxWizard
* parent
,
45 const wxBitmap
& bitmap
= wxNullBitmap
);
48 This method is called by wxWizard to get the bitmap to display alongside the
49 page. By default, @c m_bitmap member variable which was set in the
50 @ref wxwizardpage() constructor.
51 If the bitmap was not explicitly set (i.e. if @c wxNullBitmap is returned),
52 the default bitmap for the wizard should be used.
53 The only cases when you would want to override this function is if the page
54 bitmap depends dynamically on the user choices, i.e. almost never.
56 wxBitmap
GetBitmap() const;
59 Get the page which should be shown when the user chooses the @c "Next"
60 button: if @NULL is returned, this button will be disabled. The last
61 page of the wizard will usually return @NULL from here, but the others
66 wxWizardPage
* GetNext() const;
69 Get the page which should be shown when the user chooses the @c "Back"
70 button: if @NULL is returned, this button will be disabled. The first
71 page of the wizard will usually return @NULL from here, but the others
76 wxWizardPage
* GetPrev() const;
84 wxWizardEvent class represents an event generated by the
85 wizard: this event is first sent to the page itself and,
86 if not processed there, goes up the window hierarchy as usual.
92 wxWizard, @ref overview_samplewizard "wxWizard sample"
94 class wxWizardEvent
: public wxNotifyEvent
98 Constructor. It is not normally used by the user code as the objects of this
99 type are constructed by wxWizard.
101 wxWizardEvent(wxEventType type
= wxEVT_NULL
, int id
= -1,
102 bool direction
= true);
105 Return the direction in which the page is changing: for @c
106 EVT_WIZARD_PAGE_CHANGING, return @true if we're going forward or
107 @false otherwise and for @c EVT_WIZARD_PAGE_CHANGED return @true if
108 we came from the previous page and @false if we returned from the next
111 bool GetDirection() const;
114 Returns the wxWizardPage which was active when this
117 wxWizardPage
* GetPage() const;
122 @class wxWizardPageSimple
125 wxWizardPageSimple is the simplest possible
126 wxWizardPage implementation: it just returns the
127 pointers given to its constructor from GetNext() and GetPrev() functions.
129 This makes it very easy to use the objects of this class in the wizards where
130 the pages order is known statically - on the other hand, if this is not the
131 case you must derive your own class from wxWizardPage
138 wxWizard, @ref overview_samplewizard "wxWizard sample"
140 class wxWizardPageSimple
: public wxWizardPage
144 Constructor takes the previous and next pages. They may be modified later by
148 wxWizardPageSimple(wxWizard
* parent
= NULL
,
149 wxWizardPage
* prev
= NULL
,
150 wxWizardPage
* next
= NULL
,
151 const wxBitmap
& bitmap
= wxNullBitmap
);
154 A convenience function to make the pages follow each other.
157 static void Chain(wxWizardPageSimple
* first
,
158 wxWizardPageSimple
* second
);
163 void SetNext(wxWizardPage
* next
);
166 Sets the previous page.
168 void SetPrev(wxWizardPage
* prev
);
176 wxWizard is the central class for implementing 'wizard-like' dialogs. These
177 dialogs are mostly familiar to Windows users and are nothing other than a
178 sequence of 'pages', each displayed inside a dialog which has the
179 buttons to navigate to the next (and previous) pages.
181 The wizards are typically used to decompose a complex dialog into several
182 simple steps and are mainly useful to the novice users, hence it is important
183 to keep them as simple as possible.
185 To show a wizard dialog, you must first create an instance of the wxWizard class
186 using either the non-default constructor or a default one followed by call to
188 wxWizard::Create function. Then you should add all pages you
189 want the wizard to show and call wxWizard::RunWizard.
190 Finally, don't forget to call @c wizard-Destroy(), otherwise your application
191 will hang on exit due to an undestroyed window.
193 You can supply a bitmap to display on the left of the wizard, either for all
195 or for individual pages. If you need to have the bitmap resize to the height of
197 call wxWizard::SetBitmapPlacement and if necessary,
198 wxWizard::SetBitmapBackgroundColour and wxWizard::SetMinimumBitmapWidth.
200 To make wizard pages scroll when the display is too small to fit the whole
201 dialog, you can switch
202 layout adaptation on globally with wxDialog::EnableLayoutAdaptation or
203 per dialog with wxDialog::SetLayoutAdaptationMode. For more
204 about layout adaptation, see @ref overview_autoscrollingdialogs "Automatic
211 wxWizardEvent, wxWizardPage, @ref overview_samplewizard "wxWizard sample"
213 class wxWizard
: public wxDialog
218 Constructor which really creates the wizard -- if you use this constructor, you
219 shouldn't call Create().
220 Notice that unlike almost all other wxWidgets classes, there is no @e size
221 parameter in the wxWizard constructor because the wizard will have a predefined
222 default size by default. If you want to change this, you should use the
223 GetPageAreaSizer() function.
226 The parent window, may be @NULL.
228 The id of the dialog, will usually be just -1.
230 The title of the dialog.
232 The default bitmap used in the left side of the wizard. See
235 The position of the dialog, it will be centered on the screen
238 Window style is passed to wxDialog.
241 wxWizard(wxWindow
* parent
, int id
= -1,
242 const wxString
& title
= wxEmptyString
,
243 const wxBitmap
& bitmap
= wxNullBitmap
,
244 const wxPoint
& pos
= wxDefaultPosition
,
245 long style
= wxDEFAULT_DIALOG_STYLE
);
249 Creates the wizard dialog. Must be called if the default constructor had been
250 used to create the object.
251 Notice that unlike almost all other wxWidgets classes, there is no @e size
252 parameter in the wxWizard constructor because the wizard will have a predefined
253 default size by default. If you want to change this, you should use the
254 GetPageAreaSizer() function.
257 The parent window, may be @NULL.
259 The id of the dialog, will usually be just -1.
261 The title of the dialog.
263 The default bitmap used in the left side of the wizard. See
266 The position of the dialog, it will be centered on the screen
269 Window style is passed to wxDialog.
271 bool Create(wxWindow
* parent
, int id
= -1,
272 const wxString
& title
= wxEmptyString
,
273 const wxBitmap
& bitmap
= wxNullBitmap
,
274 const wxPoint
& pos
= wxDefaultPosition
,
275 long style
= wxDEFAULT_DIALOG_STYLE
);
278 This method is obsolete, use
279 GetPageAreaSizer() instead.
280 Sets the page size to be big enough for all the pages accessible via the
281 given @e firstPage, i.e. this page, its next page and so on.
282 This method may be called more than once and it will only change the page size
283 if the size required by the new page is bigger than the previously set one.
284 This is useful if the decision about which pages to show is taken during
285 run-time, as in this case, the wizard won't be able to get to all pages starting
286 from a single one and you should call @e Fit separately for the others.
288 void FitToPage(const wxWizardPage
* firstPage
);
291 Returns the bitmap used for the wizard.
293 const wxBitmap
GetBitmap() const;
296 Returns the colour that should be used to fill the area not taken up by the
297 wizard or page bitmap,
298 if a non-zero bitmap placement flag has been set.
299 See also SetBitmapPlacement().
301 const wxColour
GetBitmapBackgroundColour() const;
304 Returns the flags indicating how the wizard or page bitmap should be expanded
305 and positioned to fit the
306 page height. By default, placement is 0 (no expansion is done).
307 See also SetBitmapPlacement() for the possible values.
309 int GetBitmapPlacement();
312 Get the current page while the wizard is running. @NULL is returned if
313 RunWizard() is not being executed now.
315 wxWizardPage
* GetCurrentPage() const;
318 Returns the minimum width for the bitmap that will be constructed to contain
319 the actual wizard or page bitmap
320 if a non-zero bitmap placement flag has been set.
321 See also SetBitmapPlacement().
323 int GetMinimumBitmapWidth() const;
326 Returns pointer to page area sizer. The wizard is laid out using sizers and
327 the page area sizer is the place-holder for the pages. All pages are resized
329 being shown to match the wizard page area.
330 Page area sizer has a minimal size that is the maximum of several values. First,
331 all pages (or other objects) added to the sizer. Second, all pages reachable
332 by repeatedly applying
333 wxWizardPage::GetNext to
334 any page inserted into the sizer. Third,
335 the minimal size specified using SetPageSize() and
336 FitToPage(). Fourth, the total wizard height may
337 be increased to accommodate the bitmap height. Fifth and finally, wizards are
338 never smaller than some built-in minimal size to avoid wizards that are too
340 The caller can use wxSizer::SetMinSize to enlarge it
341 beyond the minimal size. If @c wxRESIZE_BORDER was passed to constructor, user
342 can resize wizard and consequently the page area (but not make it smaller than
345 It is recommended to add the first page to the page area sizer. For simple
347 this will enlarge the wizard to fit the biggest page. For non-linear wizards,
348 the first page of every separate chain should be added. Caller-specified size
349 can be accomplished using wxSizer::SetMinSize.
350 Adding pages to the page area sizer affects the default border width around page
351 area that can be altered with SetBorder().
353 virtual wxSizer
* GetPageAreaSizer() const;
356 Returns the size available for the pages.
358 wxSize
GetPageSize() const;
361 Return @true if this page is not the last one in the wizard. The base
362 class version implements this by calling
363 @ref wxWizardPage::getnext page-GetNext but this could be undesirable if,
364 for example, the pages are created on demand only.
368 virtual bool HasNextPage(wxWizardPage
* page
);
371 Returns @true if this page is not the last one in the wizard. The base
372 class version implements this by calling
373 @ref wxWizardPage::getprev page-GetPrev but this could be undesirable if,
374 for example, the pages are created on demand only.
378 virtual bool HasPrevPage(wxWizardPage
* page
);
381 Executes the wizard starting from the given page, returning @true if it was
382 successfully finished or @false if user cancelled it. The @a firstPage
385 bool RunWizard(wxWizardPage
* firstPage
);
388 Sets the bitmap used for the wizard.
390 void SetBitmap(const wxBitmap
& bitmap
);
393 Sets the colour that should be used to fill the area not taken up by the wizard
395 if a non-zero bitmap placement flag has been set.
396 See also SetBitmapPlacement().
398 void SetBitmapBackgroundColour(const wxColour
& colour
);
401 Sets the flags indicating how the wizard or page bitmap should be expanded and
402 positioned to fit the
403 page height. By default, placement is 0 (no expansion is done). @a placement is
405 following possible values:
407 @b wxWIZARD_VALIGN_TOP
409 Aligns the bitmap at the top.
411 @b wxWIZARD_VALIGN_CENTRE
413 Centres the bitmap vertically.
415 @b wxWIZARD_VALIGN_BOTTOM
417 Aligns the bitmap at the bottom.
419 @b wxWIZARD_HALIGN_LEFT
421 Left-aligns the bitmap.
423 @b wxWIZARD_HALIGN_CENTRE
425 Centres the bitmap horizontally.
427 @b wxWIZARD_HALIGN_RIGHT
429 Right-aligns the bitmap.
434 See also SetMinimumBitmapWidth().
436 void SetBitmapPlacement(int placement
);
439 Sets width of border around page area. Default is zero. For backward
440 compatibility, if there are no pages in
441 GetPageAreaSizer(), the default is 5 pixels.
442 If there is a five point border around all controls in a page and the border
444 page area is left as zero, a five point white space along all dialog borders
445 will be added to the control border in order to space page controls ten points
447 border and non-page controls.
449 void SetBorder(int border
);
452 Sets the minimum width for the bitmap that will be constructed to contain the
453 actual wizard or page bitmap
454 if a non-zero bitmap placement flag has been set. If this is not set when using
455 bitmap placement, the initial
456 layout may be incorrect.
457 See also SetBitmapPlacement().
459 void SetMinimumBitmapWidth(int width
);
462 This method is obsolete, use
463 GetPageAreaSizer() instead.
464 Sets the minimal size to be made available for the wizard pages. The wizard
465 will take into account the size of the bitmap (if any) itself. Also, the
466 wizard will never be smaller than the default size.
467 The recommended way to use this function is to lay out all wizard pages using
468 the sizers (even though the wizard is not resizeable) and then use
469 wxSizer::CalcMin in a loop to calculate the maximum
470 of minimal sizes of the pages and pass it to SetPageSize().
472 void SetPageSize(const wxSize
& sizePage
);