]> git.saurik.com Git - wxWidgets.git/blob - src/generic/wizard.cpp
Conditional compilation fix.
[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(wxID_ANY, wxWizard::OnWizEvent)
89 EVT_WIZARD_PAGE_CHANGING(wxID_ANY, wxWizard::OnWizEvent)
90 EVT_WIZARD_CANCEL(wxID_ANY, wxWizard::OnWizEvent)
91 EVT_WIZARD_FINISHED(wxID_ANY, wxWizard::OnWizEvent)
92 EVT_WIZARD_HELP(wxID_ANY, 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, wxID_ANY) )
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 wxUSE_STATBMP
313 if ( m_bitmap.Ok() )
314 {
315 m_statbmp = new wxStaticBitmap(this, wxID_ANY, m_bitmap);
316 m_sizerBmpAndPage->Add(
317 m_statbmp,
318 0, // No horizontal stretching
319 wxALL, // Border all around, top alignment
320 5 // Border width
321 );
322 m_sizerBmpAndPage->Add(
323 5,0,
324 0, // No horizontal stretching
325 wxEXPAND // No border, (mostly useless) vertical stretching
326 );
327 }
328 #endif
329
330 // Added to m_sizerBmpAndPage in FinishLayout
331 m_sizerPage = new wxWizardSizer(this);
332 }
333
334 void wxWizard::AddStaticLine(wxBoxSizer *mainColumn)
335 {
336 #if wxUSE_STATLINE
337 mainColumn->Add(
338 new wxStaticLine(this, wxID_ANY),
339 0, // Vertically unstretchable
340 wxEXPAND | wxALL, // Border all around, horizontally stretchable
341 5 // Border width
342 );
343 mainColumn->Add(0,5,
344 0, // No vertical stretching
345 wxEXPAND // No border, (mostly useless) horizontal stretching
346 );
347 #else
348 (void)mainColumn;
349 #endif // wxUSE_STATLINE
350 }
351
352 void wxWizard::AddBackNextPair(wxBoxSizer *buttonRow)
353 {
354 wxASSERT_MSG( m_btnNext && m_btnPrev,
355 _T("You must create the buttons before calling ")
356 _T("wxWizard::AddBackNextPair") );
357
358 // margin between Back and Next buttons
359 #ifdef __WXMAC__
360 static const int BACKNEXT_MARGIN = 10;
361 #else
362 static const int BACKNEXT_MARGIN = 0;
363 #endif
364
365 wxBoxSizer *backNextPair = new wxBoxSizer(wxHORIZONTAL);
366 buttonRow->Add(
367 backNextPair,
368 0, // No horizontal stretching
369 wxALL, // Border all around
370 5 // Border width
371 );
372
373 backNextPair->Add(m_btnPrev);
374 backNextPair->Add(BACKNEXT_MARGIN,0,
375 0, // No horizontal stretching
376 wxEXPAND // No border, (mostly useless) vertical stretching
377 );
378 backNextPair->Add(m_btnNext);
379 }
380
381 void wxWizard::AddButtonRow(wxBoxSizer *mainColumn)
382 {
383 // the order in which the buttons are created determines the TAB order - at least under MSWindows...
384 // although the 'back' button appears before the 'next' button, a more userfriendly tab order is
385 // to activate the 'next' button first (create the next button before the back button).
386 // The reason is: The user will repeatedly enter information in the wizard pages and then wants to
387 // press 'next'. If a user uses mostly the keyboard, he would have to skip the 'back' button
388 // everytime. This is annoying. There is a second reason: RETURN acts as TAB. If the 'next'
389 // button comes first in the TAB order, the user can enter information very fast using the RETURN
390 // key to TAB to the next entry field and page. This would not be possible, if the 'back' button
391 // was created before the 'next' button.
392
393 wxBoxSizer *buttonRow = new wxBoxSizer(wxHORIZONTAL);
394 mainColumn->Add(
395 buttonRow,
396 0, // Vertically unstretchable
397 wxALIGN_RIGHT // Right aligned, no border
398 );
399
400 // Desired TAB order is 'next', 'cancel', 'help', 'back'. This makes the 'back' button the last control on the page.
401 // Create the buttons in the right order...
402 m_btnNext = new wxButton(this, wxID_FORWARD, _("&Next >"));
403 wxButton *btnCancel=new wxButton(this, wxID_CANCEL, _("&Cancel"));
404 wxButton *btnHelp=0;
405 if (GetExtraStyle() & wxWIZARD_EX_HELPBUTTON)
406 btnHelp=new wxButton(this, wxID_HELP, _("&Help"));
407 m_btnPrev = new wxButton(this, wxID_BACKWARD, _("< &Back"));
408
409 if (btnHelp)
410 buttonRow->Add(
411 btnHelp,
412 0, // Horizontally unstretchable
413 wxALL, // Border all around, top aligned
414 5 // Border width
415 );
416
417 AddBackNextPair(buttonRow);
418
419 buttonRow->Add(
420 btnCancel,
421 0, // Horizontally unstretchable
422 wxALL, // Border all around, top aligned
423 5 // Border width
424 );
425 }
426
427 void wxWizard::DoCreateControls()
428 {
429 // do nothing if the controls were already created
430 if ( WasCreated() )
431 return;
432
433 // wxWindow::SetSizer will be called at end
434 wxBoxSizer *windowSizer = new wxBoxSizer(wxVERTICAL);
435
436 wxBoxSizer *mainColumn = new wxBoxSizer(wxVERTICAL);
437 windowSizer->Add(
438 mainColumn,
439 1, // Vertical stretching
440 wxALL | wxEXPAND, // Border all around, horizontal stretching
441 5 // Border width
442 );
443
444 AddBitmapRow(mainColumn);
445 AddStaticLine(mainColumn);
446 AddButtonRow(mainColumn);
447
448 // wxWindow::SetSizer should be followed by wxWindow::Fit, but
449 // this is done in FinishLayout anyway so why duplicate it
450 SetSizer(windowSizer);
451 }
452
453 void wxWizard::SetPageSize(const wxSize& size)
454 {
455 wxCHECK_RET(!m_started,wxT("wxWizard::SetPageSize after RunWizard"));
456 m_sizePage = size;
457 }
458
459 void wxWizard::FinishLayout()
460 {
461 m_sizerBmpAndPage->Add(
462 m_sizerPage,
463 1, // Horizontal stretching
464 wxEXPAND | wxALL, // Vertically stretchable
465 m_sizerPage->Border()
466 );
467
468 GetSizer()->SetSizeHints(this);
469 if ( m_posWizard == wxDefaultPosition )
470 CentreOnScreen();
471 }
472
473 void wxWizard::FitToPage(const wxWizardPage *page)
474 {
475 wxCHECK_RET(!m_started,wxT("wxWizard::FitToPage after RunWizard"));
476
477 while ( page )
478 {
479 wxSize size = page->GetBestSize();
480
481 m_sizePage.IncTo(size);
482
483 page = page->GetNext();
484 }
485 }
486
487 bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward)
488 {
489 wxASSERT_MSG( page != m_page, wxT("this is useless") );
490
491 // we'll use this to decide whether we have to change the label of this
492 // button or not (initially the label is "Next")
493 bool btnLabelWasNext = true;
494
495 // Modified 10-20-2001 Robert Cavanaugh.
496 // Fixed bug for displaying a new bitmap
497 // in each *consecutive* page
498
499 // flag to indicate if this page uses a new bitmap
500 bool bmpIsDefault = true;
501
502 // use these labels to determine if we need to change the bitmap
503 // for this page
504 wxBitmap bmpPrev, bmpCur;
505
506 // check for previous page
507 if ( m_page )
508 {
509 // send the event to the old page
510 wxWizardEvent event(wxEVT_WIZARD_PAGE_CHANGING, GetId(), goingForward, m_page);
511 if ( m_page->GetEventHandler()->ProcessEvent(event) &&
512 !event.IsAllowed() )
513 {
514 // vetoed by the page
515 return false;
516 }
517
518 m_page->Hide();
519
520 btnLabelWasNext = HasNextPage(m_page);
521
522 // Get the bitmap of the previous page (if it exists)
523 if ( m_page->GetBitmap().Ok() )
524 {
525 bmpPrev = m_page->GetBitmap();
526 }
527 }
528
529 // set the new page
530 m_page = page;
531
532 // is this the end?
533 if ( !m_page )
534 {
535 // terminate successfully
536 EndModal(wxID_OK);
537
538 // and notify the user code (this is especially useful for modeless
539 // wizards)
540 wxWizardEvent event(wxEVT_WIZARD_FINISHED, GetId(), false, 0);
541 (void)GetEventHandler()->ProcessEvent(event);
542
543 return true;
544 }
545
546 // position and show the new page
547 (void)m_page->TransferDataToWindow();
548
549 // wxWizardSizer::RecalcSizes wants to be called when m_page changes
550 m_sizerPage->RecalcSizes();
551
552 // check if bitmap needs to be updated
553 // update default flag as well
554 if ( m_page->GetBitmap().Ok() )
555 {
556 bmpCur = m_page->GetBitmap();
557 bmpIsDefault = false;
558 }
559
560 #if wxUSE_STATBMP
561 // change the bitmap if:
562 // 1) a default bitmap was selected in constructor
563 // 2) this page was constructed with a bitmap
564 // 3) this bitmap is not the previous bitmap
565 if ( m_statbmp && (bmpCur != bmpPrev) )
566 {
567 wxBitmap bmp;
568 if ( bmpIsDefault )
569 bmp = m_bitmap;
570 else
571 bmp = m_page->GetBitmap();
572 m_statbmp->SetBitmap(bmp);
573 }
574 #endif
575
576 // and update the buttons state
577 m_btnPrev->Enable(HasPrevPage(m_page));
578
579 bool hasNext = HasNextPage(m_page);
580 if ( btnLabelWasNext != hasNext )
581 {
582 // need to update
583 if (btnLabelWasNext)
584 m_btnNext->SetLabel(_("&Finish"));
585 else
586 m_btnNext->SetLabel(_("&Next >"));
587 }
588 m_btnNext->SetDefault();
589 // nothing to do: the label was already correct
590
591 // send the change event to the new page now
592 wxWizardEvent event(wxEVT_WIZARD_PAGE_CHANGED, GetId(), goingForward, m_page);
593 (void)m_page->GetEventHandler()->ProcessEvent(event);
594
595 // and finally show it
596 m_page->Show();
597 m_page->SetFocus();
598
599 return true;
600 }
601
602 bool wxWizard::RunWizard(wxWizardPage *firstPage)
603 {
604 wxCHECK_MSG( firstPage, false, wxT("can't run empty wizard") );
605
606 // Set before FinishLayout to enable wxWizardSizer::GetMaxChildSize
607 m_started = true;
608
609 // This cannot be done sooner, because user can change layout options
610 // up to this moment
611 FinishLayout();
612
613 // can't return false here because there is no old page
614 (void)ShowPage(firstPage, true /* forward */);
615
616 return ShowModal() == wxID_OK;
617 }
618
619 wxWizardPage *wxWizard::GetCurrentPage() const
620 {
621 return m_page;
622 }
623
624 wxSize wxWizard::GetPageSize() const
625 {
626 wxSize pageSize(GetManualPageSize());
627 pageSize.IncTo(m_sizerPage->GetMaxChildSize());
628 return pageSize;
629 }
630
631 wxSizer *wxWizard::GetPageAreaSizer() const
632 {
633 return m_sizerPage;
634 }
635
636 void wxWizard::SetBorder(int border)
637 {
638 wxCHECK_RET(!m_started,wxT("wxWizard::SetBorder after RunWizard"));
639
640 m_calledSetBorder = true;
641 m_border = border;
642 }
643
644 wxSize wxWizard::GetManualPageSize() const
645 {
646 // default width and height of the page
647 static const int DEFAULT_PAGE_WIDTH = 270;
648 static const int DEFAULT_PAGE_HEIGHT = 290;
649
650 wxSize totalPageSize(DEFAULT_PAGE_WIDTH,DEFAULT_PAGE_HEIGHT);
651
652 totalPageSize.IncTo(m_sizePage);
653
654 if ( m_statbmp )
655 {
656 totalPageSize.IncTo(wxSize(0, m_bitmap.GetHeight()));
657 }
658
659 return totalPageSize;
660 }
661
662 void wxWizard::OnCancel(wxCommandEvent& WXUNUSED(eventUnused))
663 {
664 // this function probably can never be called when we don't have an active
665 // page, but a small extra check won't hurt
666 wxWindow *win = m_page ? (wxWindow *)m_page : (wxWindow *)this;
667
668 wxWizardEvent event(wxEVT_WIZARD_CANCEL, GetId(), false, m_page);
669 if ( !win->GetEventHandler()->ProcessEvent(event) || event.IsAllowed() )
670 {
671 // no objections - close the dialog
672 EndModal(wxID_CANCEL);
673 }
674 //else: request to Cancel ignored
675 }
676
677 void wxWizard::OnBackOrNext(wxCommandEvent& event)
678 {
679 wxASSERT_MSG( (event.GetEventObject() == m_btnNext) ||
680 (event.GetEventObject() == m_btnPrev),
681 wxT("unknown button") );
682
683 // ask the current page first: notice that we do it before calling
684 // GetNext/Prev() because the data transfered from the controls of the page
685 // may change the value returned by these methods
686 if ( m_page && (!m_page->Validate() || !m_page->TransferDataFromWindow()) )
687 {
688 // the page data is incorrect, don't do anything
689 return;
690 }
691
692 bool forward = event.GetEventObject() == m_btnNext;
693
694 wxWizardPage *page;
695 if ( forward )
696 {
697 page = m_page->GetNext();
698 }
699 else // back
700 {
701 page = m_page->GetPrev();
702
703 wxASSERT_MSG( page, wxT("\"<Back\" button should have been disabled") );
704 }
705
706 // just pass to the new page (or may be not - but we don't care here)
707 (void)ShowPage(page, forward);
708 }
709
710 void wxWizard::OnHelp(wxCommandEvent& WXUNUSED(event))
711 {
712 // this function probably can never be called when we don't have an active
713 // page, but a small extra check won't hurt
714 if(m_page != NULL)
715 {
716 // Create and send the help event to the specific page handler
717 // event data contains the active page so that context-sensitive
718 // help is possible
719 wxWizardEvent eventHelp(wxEVT_WIZARD_HELP, GetId(), true, m_page);
720 (void)m_page->GetEventHandler()->ProcessEvent(eventHelp);
721 }
722 }
723
724 void wxWizard::OnWizEvent(wxWizardEvent& event)
725 {
726 // the dialogs have wxWS_EX_BLOCK_EVENTS style on by default but we want to
727 // propagate wxEVT_WIZARD_XXX to the parent (if any), so do it manually
728 if ( !(GetExtraStyle() & wxWS_EX_BLOCK_EVENTS) )
729 {
730 // the event will be propagated anyhow
731 event.Skip();
732 return;
733 }
734
735 wxWindow *parent = GetParent();
736
737 if ( !parent || !parent->GetEventHandler()->ProcessEvent(event) )
738 {
739 event.Skip();
740 }
741 }
742
743 // ----------------------------------------------------------------------------
744 // our public interface
745 // ----------------------------------------------------------------------------
746
747 #if WXWIN_COMPATIBILITY_2_2
748
749 /* static */
750 wxWizard *wxWizardBase::Create(wxWindow *parent,
751 int id,
752 const wxString& title,
753 const wxBitmap& bitmap,
754 const wxPoint& pos,
755 const wxSize& WXUNUSED(size))
756 {
757 return new wxWizard(parent, id, title, bitmap, pos);
758 }
759
760 #endif // WXWIN_COMPATIBILITY_2_2
761
762 // ----------------------------------------------------------------------------
763 // wxWizardEvent
764 // ----------------------------------------------------------------------------
765
766 wxWizardEvent::wxWizardEvent(wxEventType type, int id, bool direction, wxWizardPage* page)
767 : wxNotifyEvent(type, id)
768 {
769 // Modified 10-20-2001 Robert Cavanaugh
770 // add the active page to the event data
771 m_direction = direction;
772 m_page = page;
773 }
774
775 #endif // wxUSE_WIZARDDLG