corrected TAB order of wizard buttons (patch 800935)
[wxWidgets.git] / src / generic / wizard.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: generic/wizard.cpp
3 // Purpose: generic implementation of wxWizard class
4 // Author: Vadim Zeitlin
5 // Modified by: Robert Cavanaugh
6 // 1) Added capability for wxWizardPage to accept resources
7 // 2) Added "Help" button handler stub
8 // 3) Fixed ShowPage() bug on displaying bitmaps
9 // Robert Vazan (sizers)
10 // Created: 15.08.99
11 // RCS-ID: $Id$
12 // Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
13 // Licence: wxWindows licence
14 ///////////////////////////////////////////////////////////////////////////////
15
16 // ============================================================================
17 // declarations
18 // ============================================================================
19
20 // ----------------------------------------------------------------------------
21 // headers
22 // ----------------------------------------------------------------------------
23
24 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
25 #pragma implementation "wizardg.h"
26 #endif
27
28 // For compilers that support precompilation, includes "wx.h".
29 #include "wx/wxprec.h"
30
31 #ifdef __BORLANDC__
32 #pragma hdrstop
33 #endif
34
35 #if wxUSE_WIZARDDLG
36
37 #ifndef WX_PRECOMP
38 #include "wx/dynarray.h"
39 #include "wx/intl.h"
40 #include "wx/statbmp.h"
41 #include "wx/button.h"
42 #endif //WX_PRECOMP
43
44 #include "wx/statline.h"
45 #include "wx/sizer.h"
46
47 #include "wx/wizard.h"
48
49 // ----------------------------------------------------------------------------
50 // wxWizardSizer
51 // ----------------------------------------------------------------------------
52
53 class wxWizardSizer : public wxSizer
54 {
55 public:
56 wxWizardSizer(wxWizard *owner);
57
58 void RecalcSizes();
59 wxSize CalcMin();
60
61 wxSize GetMaxChildSize();
62 int Border() const;
63
64 private:
65 wxSize SiblingSize(wxSizerItem *child);
66
67 wxWizard *m_owner;
68 bool m_childSizeValid;
69 wxSize m_childSize;
70 };
71
72 // ----------------------------------------------------------------------------
73 // event tables and such
74 // ----------------------------------------------------------------------------
75
76 DEFINE_EVENT_TYPE(wxEVT_WIZARD_PAGE_CHANGED)
77 DEFINE_EVENT_TYPE(wxEVT_WIZARD_PAGE_CHANGING)
78 DEFINE_EVENT_TYPE(wxEVT_WIZARD_CANCEL)
79 DEFINE_EVENT_TYPE(wxEVT_WIZARD_FINISHED)
80 DEFINE_EVENT_TYPE(wxEVT_WIZARD_HELP)
81
82 BEGIN_EVENT_TABLE(wxWizard, wxDialog)
83 EVT_BUTTON(wxID_CANCEL, wxWizard::OnCancel)
84 EVT_BUTTON(wxID_BACKWARD, wxWizard::OnBackOrNext)
85 EVT_BUTTON(wxID_FORWARD, wxWizard::OnBackOrNext)
86 EVT_BUTTON(wxID_HELP, wxWizard::OnHelp)
87
88 EVT_WIZARD_PAGE_CHANGED(-1, wxWizard::OnWizEvent)
89 EVT_WIZARD_PAGE_CHANGING(-1, wxWizard::OnWizEvent)
90 EVT_WIZARD_CANCEL(-1, wxWizard::OnWizEvent)
91 EVT_WIZARD_FINISHED(-1, wxWizard::OnWizEvent)
92 EVT_WIZARD_HELP(-1, wxWizard::OnWizEvent)
93 END_EVENT_TABLE()
94
95 IMPLEMENT_DYNAMIC_CLASS(wxWizard, wxDialog)
96
97 /*
98 TODO PROPERTIES :
99 wxWizard
100 extstyle
101 title
102 */
103
104 IMPLEMENT_ABSTRACT_CLASS(wxWizardPage, wxPanel)
105 IMPLEMENT_DYNAMIC_CLASS(wxWizardPageSimple, wxWizardPage)
106 IMPLEMENT_DYNAMIC_CLASS(wxWizardEvent, wxNotifyEvent)
107
108 // ============================================================================
109 // implementation
110 // ============================================================================
111
112 // ----------------------------------------------------------------------------
113 // wxWizardPage
114 // ----------------------------------------------------------------------------
115
116 void wxWizardPage::Init()
117 {
118 m_bitmap = wxNullBitmap;
119 }
120
121 wxWizardPage::wxWizardPage(wxWizard *parent,
122 const wxBitmap& bitmap,
123 const wxChar *resource)
124 {
125 Create(parent, bitmap, resource);
126 }
127
128 bool wxWizardPage::Create(wxWizard *parent,
129 const wxBitmap& bitmap,
130 const wxChar *resource)
131 {
132 if ( !wxPanel::Create(parent, -1) )
133 return FALSE;
134
135 if ( resource != NULL )
136 {
137 #if wxUSE_WX_RESOURCES
138 #if 0
139 if ( !LoadFromResource(this, resource) )
140 {
141 wxFAIL_MSG(wxT("wxWizardPage LoadFromResource failed!!!!"));
142 }
143 #endif
144 #endif // wxUSE_RESOURCES
145 }
146
147 m_bitmap = bitmap;
148
149 // initially the page is hidden, it's shown only when it becomes current
150 Hide();
151
152 return TRUE;
153 }
154
155 // ----------------------------------------------------------------------------
156 // wxWizardPageSimple
157 // ----------------------------------------------------------------------------
158
159 wxWizardPage *wxWizardPageSimple::GetPrev() const
160 {
161 return m_prev;
162 }
163
164 wxWizardPage *wxWizardPageSimple::GetNext() const
165 {
166 return m_next;
167 }
168
169 // ----------------------------------------------------------------------------
170 // wxWizardSizer
171 // ----------------------------------------------------------------------------
172
173 wxWizardSizer::wxWizardSizer(wxWizard *owner)
174 : m_owner(owner)
175 {
176 m_childSizeValid = false;
177 }
178
179 void wxWizardSizer::RecalcSizes()
180 {
181 // Effect of this function depends on m_owner->m_page and
182 // it should be called whenever it changes (wxWizard::ShowPage)
183 if ( m_owner->m_page )
184 {
185 m_owner->m_page->SetSize(m_position.x,m_position.y, m_size.x,m_size.y);
186 }
187 }
188
189 wxSize wxWizardSizer::CalcMin()
190 {
191 return m_owner->GetPageSize();
192 }
193
194 wxSize wxWizardSizer::GetMaxChildSize()
195 {
196 #if !defined(__WXDEBUG__)
197 if ( m_childSizeValid )
198 return m_childSize;
199 #endif
200
201 wxSize maxOfMin;
202 wxSizerItemList::compatibility_iterator childNode;
203
204 for(childNode = m_children.GetFirst(); childNode;
205 childNode = childNode->GetNext())
206 {
207 wxSizerItem *child = childNode->GetData();
208 maxOfMin.IncTo(child->CalcMin());
209 maxOfMin.IncTo(SiblingSize(child));
210 }
211
212 #ifdef __WXDEBUG__
213 if ( m_childSizeValid && m_childSize != maxOfMin )
214 {
215 wxFAIL_MSG( _T("Size changed in wxWizard::GetPageAreaSizer()")
216 _T("after RunWizard().\n")
217 _T("Did you forget to call GetSizer()->Fit(this) ")
218 _T("for some page?")) ;
219
220 return m_childSize;
221 }
222 #endif // __WXDEBUG__
223
224 if ( m_owner->m_started )
225 {
226 m_childSizeValid = true;
227 m_childSize = maxOfMin;
228 }
229
230 return maxOfMin;
231 }
232
233 int wxWizardSizer::Border() const
234 {
235 if ( m_owner->m_calledSetBorder )
236 return m_owner->m_border;
237
238 return m_children.IsEmpty() ? 5 : 0;
239 }
240
241 wxSize wxWizardSizer::SiblingSize(wxSizerItem *child)
242 {
243 wxSize maxSibling;
244
245 if ( child->IsWindow() )
246 {
247 wxWizardPage *page = wxDynamicCast(child->GetWindow(), wxWizardPage);
248 if ( page )
249 {
250 for ( wxWizardPage *sibling = page->GetNext();
251 sibling;
252 sibling = sibling->GetNext() )
253 {
254 if ( sibling->GetSizer() )
255 {
256 maxSibling.IncTo(sibling->GetSizer()->CalcMin());
257 }
258 }
259 }
260 }
261
262 return maxSibling;
263 }
264
265 // ----------------------------------------------------------------------------
266 // generic wxWizard implementation
267 // ----------------------------------------------------------------------------
268
269 void wxWizard::Init()
270 {
271 m_posWizard = wxDefaultPosition;
272 m_page = (wxWizardPage *)NULL;
273 m_btnPrev = m_btnNext = NULL;
274 m_statbmp = NULL;
275 m_sizerBmpAndPage = NULL;
276 m_sizerPage = NULL;
277 m_calledSetBorder = false;
278 m_border = 0;
279 m_started = false;
280 }
281
282 bool wxWizard::Create(wxWindow *parent,
283 int id,
284 const wxString& title,
285 const wxBitmap& bitmap,
286 const wxPoint& pos,
287 long style)
288 {
289 bool result = wxDialog::Create(parent,id,title,pos,wxDefaultSize,style);
290
291 m_posWizard = pos;
292 m_bitmap = bitmap ;
293
294 DoCreateControls();
295
296 return result;
297 }
298
299 void wxWizard::AddBitmapRow(wxBoxSizer *mainColumn)
300 {
301 m_sizerBmpAndPage = new wxBoxSizer(wxHORIZONTAL);
302 mainColumn->Add(
303 m_sizerBmpAndPage,
304 1, // Vertically stretchable
305 wxEXPAND // Horizonal stretching, no border
306 );
307 mainColumn->Add(0,5,
308 0, // No vertical stretching
309 wxEXPAND // No border, (mostly useless) horizontal stretching
310 );
311
312 if ( m_bitmap.Ok() )
313 {
314 m_statbmp = new wxStaticBitmap(this, -1, m_bitmap);
315 m_sizerBmpAndPage->Add(
316 m_statbmp,
317 0, // No horizontal stretching
318 wxALL, // Border all around, top alignment
319 5 // Border width
320 );
321 m_sizerBmpAndPage->Add(
322 5,0,
323 0, // No horizontal stretching
324 wxEXPAND // No border, (mostly useless) vertical stretching
325 );
326 }
327
328 // Added to m_sizerBmpAndPage in FinishLayout
329 m_sizerPage = new wxWizardSizer(this);
330 }
331
332 void wxWizard::AddStaticLine(wxBoxSizer *mainColumn)
333 {
334 #if wxUSE_STATLINE
335 mainColumn->Add(
336 new wxStaticLine(this, -1),
337 0, // Vertically unstretchable
338 wxEXPAND | wxALL, // Border all around, horizontally stretchable
339 5 // Border width
340 );
341 mainColumn->Add(0,5,
342 0, // No vertical stretching
343 wxEXPAND // No border, (mostly useless) horizontal stretching
344 );
345 #else
346 (void)mainColumn;
347 #endif // wxUSE_STATLINE
348 }
349
350 void wxWizard::AddBackNextPair(wxBoxSizer *buttonRow)
351 {
352 wxASSERT_MSG(m_btnNext!=0 && m_btnPrev!=0, "You must create the buttons first before calling wxWizard::AddBackNextPair");
353 // margin between Back and Next buttons
354 #ifdef __WXMAC__
355 static const int BACKNEXT_MARGIN = 10;
356 #else
357 static const int BACKNEXT_MARGIN = 0;
358 #endif
359
360 wxBoxSizer *backNextPair = new wxBoxSizer(wxHORIZONTAL);
361 buttonRow->Add(
362 backNextPair,
363 0, // No horizontal stretching
364 wxALL, // Border all around
365 5 // Border width
366 );
367
368 backNextPair->Add(m_btnPrev);
369 backNextPair->Add(BACKNEXT_MARGIN,0,
370 0, // No horizontal stretching
371 wxEXPAND // No border, (mostly useless) vertical stretching
372 );
373 backNextPair->Add(m_btnNext);
374 }
375
376 void wxWizard::AddButtonRow(wxBoxSizer *mainColumn)
377 {
378 // the order in which the buttons are created determines the TAB order - at least under MSWindows...
379 // although the 'back' button appears before the 'next' button, a more userfriendly tab order is
380 // to activate the 'next' button first (create the next button before the back button).
381 // The reason is: The user will repeatedly enter information in the wizard pages and then wants to
382 // press 'next'. If a user uses mostly the keyboard, he would have to skip the 'back' button
383 // everytime. This is annoying. There is a second reason: RETURN acts as TAB. If the 'next'
384 // button comes first in the TAB order, the user can enter information very fast using the RETURN
385 // key to TAB to the next entry field and page. This would not be possible, if the 'back' button
386 // was created before the 'next' button.
387
388 wxBoxSizer *buttonRow = new wxBoxSizer(wxHORIZONTAL);
389 mainColumn->Add(
390 buttonRow,
391 0, // Vertically unstretchable
392 wxALIGN_RIGHT // Right aligned, no border
393 );
394
395 // Desired TAB order is 'next', 'cancel', 'help', 'back'. This makes the 'back' button the last control on the page.
396 // Create the buttons in the right order...
397 m_btnNext = new wxButton(this, wxID_FORWARD, _("&Next >"));
398 wxButton *btnCancel=new wxButton(this, wxID_CANCEL, _("&Cancel"));
399 wxButton *btnHelp=0;
400 if (GetExtraStyle() & wxWIZARD_EX_HELPBUTTON)
401 btnHelp=new wxButton(this, wxID_HELP, _("&Help"));
402 m_btnPrev = new wxButton(this, wxID_BACKWARD, _("< &Back"));
403
404 if (btnHelp)
405 buttonRow->Add(
406 btnHelp,
407 0, // Horizontally unstretchable
408 wxALL, // Border all around, top aligned
409 5 // Border width
410 );
411
412 AddBackNextPair(buttonRow);
413
414 buttonRow->Add(
415 btnCancel,
416 0, // Horizontally unstretchable
417 wxALL, // Border all around, top aligned
418 5 // Border width
419 );
420 }
421
422 void wxWizard::DoCreateControls()
423 {
424 // do nothing if the controls were already created
425 if ( WasCreated() )
426 return;
427
428 // wxWindow::SetSizer will be called at end
429 wxBoxSizer *windowSizer = new wxBoxSizer(wxVERTICAL);
430
431 wxBoxSizer *mainColumn = new wxBoxSizer(wxVERTICAL);
432 windowSizer->Add(
433 mainColumn,
434 1, // Vertical stretching
435 wxALL | wxEXPAND, // Border all around, horizontal stretching
436 5 // Border width
437 );
438
439 AddBitmapRow(mainColumn);
440 AddStaticLine(mainColumn);
441 AddButtonRow(mainColumn);
442
443 // wxWindow::SetSizer should be followed by wxWindow::Fit, but
444 // this is done in FinishLayout anyway so why duplicate it
445 SetSizer(windowSizer);
446 }
447
448 void wxWizard::SetPageSize(const wxSize& size)
449 {
450 wxCHECK_RET(!m_started,wxT("wxWizard::SetPageSize after RunWizard"));
451 m_sizePage = size;
452 }
453
454 void wxWizard::FinishLayout()
455 {
456 m_sizerBmpAndPage->Add(
457 m_sizerPage,
458 1, // Horizontal stretching
459 wxEXPAND | wxALL, // Vertically stretchable
460 m_sizerPage->Border()
461 );
462
463 GetSizer()->SetSizeHints(this);
464 if ( m_posWizard == wxDefaultPosition )
465 CentreOnScreen();
466 }
467
468 void wxWizard::FitToPage(const wxWizardPage *page)
469 {
470 wxCHECK_RET(!m_started,wxT("wxWizard::FitToPage after RunWizard"));
471
472 while ( page )
473 {
474 wxSize size = page->GetBestSize();
475
476 m_sizePage.IncTo(size);
477
478 page = page->GetNext();
479 }
480 }
481
482 bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward)
483 {
484 wxASSERT_MSG( page != m_page, wxT("this is useless") );
485
486 // we'll use this to decide whether we have to change the label of this
487 // button or not (initially the label is "Next")
488 bool btnLabelWasNext = TRUE;
489
490 // Modified 10-20-2001 Robert Cavanaugh.
491 // Fixed bug for displaying a new bitmap
492 // in each *consecutive* page
493
494 // flag to indicate if this page uses a new bitmap
495 bool bmpIsDefault = TRUE;
496
497 // use these labels to determine if we need to change the bitmap
498 // for this page
499 wxBitmap bmpPrev, bmpCur;
500
501 // check for previous page
502 if ( m_page )
503 {
504 // send the event to the old page
505 wxWizardEvent event(wxEVT_WIZARD_PAGE_CHANGING, GetId(), goingForward, m_page);
506 if ( m_page->GetEventHandler()->ProcessEvent(event) &&
507 !event.IsAllowed() )
508 {
509 // vetoed by the page
510 return FALSE;
511 }
512
513 m_page->Hide();
514
515 btnLabelWasNext = HasNextPage(m_page);
516
517 // Get the bitmap of the previous page (if it exists)
518 if ( m_page->GetBitmap().Ok() )
519 {
520 bmpPrev = m_page->GetBitmap();
521 }
522 }
523
524 // set the new page
525 m_page = page;
526
527 // is this the end?
528 if ( !m_page )
529 {
530 // terminate successfully
531 EndModal(wxID_OK);
532 if ( !IsModal() )
533 {
534 wxWizardEvent event(wxEVT_WIZARD_FINISHED, GetId(),FALSE, 0);
535 (void)GetEventHandler()->ProcessEvent(event);
536 }
537 return TRUE;
538 }
539
540 // position and show the new page
541 (void)m_page->TransferDataToWindow();
542
543 // wxWizardSizer::RecalcSizes wants to be called when m_page changes
544 m_sizerPage->RecalcSizes();
545
546 // check if bitmap needs to be updated
547 // update default flag as well
548 if ( m_page->GetBitmap().Ok() )
549 {
550 bmpCur = m_page->GetBitmap();
551 bmpIsDefault = FALSE;
552 }
553
554 // change the bitmap if:
555 // 1) a default bitmap was selected in constructor
556 // 2) this page was constructed with a bitmap
557 // 3) this bitmap is not the previous bitmap
558 if ( m_statbmp && (bmpCur != bmpPrev) )
559 {
560 wxBitmap bmp;
561 if ( bmpIsDefault )
562 bmp = m_bitmap;
563 else
564 bmp = m_page->GetBitmap();
565 m_statbmp->SetBitmap(bmp);
566 }
567
568 // and update the buttons state
569 m_btnPrev->Enable(HasPrevPage(m_page));
570
571 bool hasNext = HasNextPage(m_page);
572 if ( btnLabelWasNext != hasNext )
573 {
574 // need to update
575 if (btnLabelWasNext)
576 m_btnNext->SetLabel(_("&Finish"));
577 else
578 m_btnNext->SetLabel(_("&Next >"));
579 }
580 // nothing to do: the label was already correct
581
582 // send the change event to the new page now
583 wxWizardEvent event(wxEVT_WIZARD_PAGE_CHANGED, GetId(), goingForward, m_page);
584 (void)m_page->GetEventHandler()->ProcessEvent(event);
585
586 // and finally show it
587 m_page->Show();
588 m_page->SetFocus();
589
590 return TRUE;
591 }
592
593 bool wxWizard::RunWizard(wxWizardPage *firstPage)
594 {
595 wxCHECK_MSG( firstPage, FALSE, wxT("can't run empty wizard") );
596
597 // Set before FinishLayout to enable wxWizardSizer::GetMaxChildSize
598 m_started = true;
599
600 // This cannot be done sooner, because user can change layout options
601 // up to this moment
602 FinishLayout();
603
604 // can't return FALSE here because there is no old page
605 (void)ShowPage(firstPage, TRUE /* forward */);
606
607 return ShowModal() == wxID_OK;
608 }
609
610 wxWizardPage *wxWizard::GetCurrentPage() const
611 {
612 return m_page;
613 }
614
615 wxSize wxWizard::GetPageSize() const
616 {
617 wxSize pageSize(GetManualPageSize());
618 pageSize.IncTo(m_sizerPage->GetMaxChildSize());
619 return pageSize;
620 }
621
622 wxSizer *wxWizard::GetPageAreaSizer() const
623 {
624 return m_sizerPage;
625 }
626
627 void wxWizard::SetBorder(int border)
628 {
629 wxCHECK_RET(!m_started,wxT("wxWizard::SetBorder after RunWizard"));
630
631 m_calledSetBorder = true;
632 m_border = border;
633 }
634
635 wxSize wxWizard::GetManualPageSize() const
636 {
637 // default width and height of the page
638 static const int DEFAULT_PAGE_WIDTH = 270;
639 static const int DEFAULT_PAGE_HEIGHT = 290;
640
641 wxSize totalPageSize(DEFAULT_PAGE_WIDTH,DEFAULT_PAGE_HEIGHT);
642
643 totalPageSize.IncTo(m_sizePage);
644
645 if ( m_statbmp )
646 {
647 totalPageSize.IncTo(wxSize(0, m_bitmap.GetHeight()));
648 }
649
650 return totalPageSize;
651 }
652
653 void wxWizard::OnCancel(wxCommandEvent& WXUNUSED(eventUnused))
654 {
655 // this function probably can never be called when we don't have an active
656 // page, but a small extra check won't hurt
657 wxWindow *win = m_page ? (wxWindow *)m_page : (wxWindow *)this;
658
659 wxWizardEvent event(wxEVT_WIZARD_CANCEL, GetId(), FALSE, m_page);
660 if ( !win->GetEventHandler()->ProcessEvent(event) || event.IsAllowed() )
661 {
662 // no objections - close the dialog
663 EndModal(wxID_CANCEL);
664 }
665 //else: request to Cancel ignored
666 }
667
668 void wxWizard::OnBackOrNext(wxCommandEvent& event)
669 {
670 wxASSERT_MSG( (event.GetEventObject() == m_btnNext) ||
671 (event.GetEventObject() == m_btnPrev),
672 wxT("unknown button") );
673
674 // ask the current page first: notice that we do it before calling
675 // GetNext/Prev() because the data transfered from the controls of the page
676 // may change the value returned by these methods
677 if ( m_page && (!m_page->Validate() || !m_page->TransferDataFromWindow()) )
678 {
679 // the page data is incorrect, don't do anything
680 return;
681 }
682
683 bool forward = event.GetEventObject() == m_btnNext;
684
685 wxWizardPage *page;
686 if ( forward )
687 {
688 page = m_page->GetNext();
689 }
690 else // back
691 {
692 page = m_page->GetPrev();
693
694 wxASSERT_MSG( page, wxT("\"<Back\" button should have been disabled") );
695 }
696
697 // just pass to the new page (or may be not - but we don't care here)
698 (void)ShowPage(page, forward);
699 }
700
701 void wxWizard::OnHelp(wxCommandEvent& WXUNUSED(event))
702 {
703 // this function probably can never be called when we don't have an active
704 // page, but a small extra check won't hurt
705 if(m_page != NULL)
706 {
707 // Create and send the help event to the specific page handler
708 // event data contains the active page so that context-sensitive
709 // help is possible
710 wxWizardEvent eventHelp(wxEVT_WIZARD_HELP, GetId(), TRUE, m_page);
711 (void)m_page->GetEventHandler()->ProcessEvent(eventHelp);
712 }
713 }
714
715 void wxWizard::OnWizEvent(wxWizardEvent& event)
716 {
717 // the dialogs have wxWS_EX_BLOCK_EVENTS style on by default but we want to
718 // propagate wxEVT_WIZARD_XXX to the parent (if any), so do it manually
719 if ( !(GetExtraStyle() & wxWS_EX_BLOCK_EVENTS) )
720 {
721 // the event will be propagated anyhow
722 return;
723 }
724
725 wxWindow *parent = GetParent();
726
727 if ( !parent || !parent->GetEventHandler()->ProcessEvent(event) )
728 {
729 event.Skip();
730 }
731 }
732
733 // ----------------------------------------------------------------------------
734 // our public interface
735 // ----------------------------------------------------------------------------
736
737 #ifdef WXWIN_COMPATIBILITY_2_2
738
739 /* static */
740 wxWizard *wxWizardBase::Create(wxWindow *parent,
741 int id,
742 const wxString& title,
743 const wxBitmap& bitmap,
744 const wxPoint& pos,
745 const wxSize& WXUNUSED(size))
746 {
747 return new wxWizard(parent, id, title, bitmap, pos);
748 }
749
750 #endif // WXWIN_COMPATIBILITY_2_2
751
752 // ----------------------------------------------------------------------------
753 // wxWizardEvent
754 // ----------------------------------------------------------------------------
755
756 wxWizardEvent::wxWizardEvent(wxEventType type, int id, bool direction, wxWizardPage* page)
757 : wxNotifyEvent(type, id)
758 {
759 // Modified 10-20-2001 Robert Cavanaugh
760 // add the active page to the event data
761 m_direction = direction;
762 m_page = page;
763 }
764
765 #endif // wxUSE_WIZARDDLG