]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/wizard.h
fixed propagating of EVT_WIZARD_XXX events to the parent
[wxWidgets.git] / include / wx / generic / wizard.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: generic/wizard.h
3 // Purpose: declaration of generic wxWizard class
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 28.09.99
7 // RCS-ID: $Id$
8 // Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows license
10 ///////////////////////////////////////////////////////////////////////////////
11
12 // ----------------------------------------------------------------------------
13 // wxWizard
14 // ----------------------------------------------------------------------------
15
16 #ifdef __GNUG__
17 #pragma interface "wizardg.h"
18 #endif
19
20 class WXDLLEXPORT wxButton;
21 class WXDLLEXPORT wxStaticBitmap;
22 class WXDLLEXPORT wxWizardEvent;
23
24 class WXDLLEXPORT wxWizard : public wxWizardBase
25 {
26 public:
27 // ctor
28 wxWizard() { Init(); }
29 wxWizard(wxWindow *parent,
30 int id = -1,
31 const wxString& title = wxEmptyString,
32 const wxBitmap& bitmap = wxNullBitmap,
33 const wxPoint& pos = wxDefaultPosition)
34 {
35 Init();
36 Create(parent, id, title, bitmap, pos);
37 }
38 bool Create(wxWindow *parent,
39 int id = -1,
40 const wxString& title = wxEmptyString,
41 const wxBitmap& bitmap = wxNullBitmap,
42 const wxPoint& pos = wxDefaultPosition);
43 void Init();
44
45 // implement base class pure virtuals
46 virtual bool RunWizard(wxWizardPage *firstPage);
47 virtual wxWizardPage *GetCurrentPage() const;
48 virtual void SetPageSize(const wxSize& size);
49 virtual wxSize GetPageSize() const;
50
51 // implementation only from now on
52 // -------------------------------
53
54 // is the wizard running?
55 bool IsRunning() const { return m_page != NULL; }
56
57 // show the prev/next page, but call TransferDataFromWindow on the current
58 // page first and return FALSE without changing the page if
59 // TransferDataFromWindow() returns FALSE - otherwise, returns TRUE
60 bool ShowPage(wxWizardPage *page, bool goingForward = TRUE);
61
62 // do fill the dialog with controls
63 // this is app-overridable to, for example, set help and tooltip text
64 void DoCreateControls();
65
66 private:
67 // was the dialog really created?
68 bool WasCreated() const { return m_btnPrev != NULL; }
69
70 // event handlers
71 void OnCancel(wxCommandEvent& event);
72 void OnBackOrNext(wxCommandEvent& event);
73 void OnHelp(wxCommandEvent& event);
74
75 void OnWizEvent(wxWizardEvent& event);
76
77 // the page size requested by user
78 wxSize m_sizePage;
79
80 // the dialog position from the ctor
81 wxPoint m_posWizard;
82
83 // wizard dimensions
84 int m_x, m_y; // the origin for the pages
85 int m_width, // the size of the page itself
86 m_height; // (total width is m_width + m_x)
87
88 // wizard state
89 wxWizardPage *m_page; // the current page or NULL
90 wxBitmap m_bitmap; // the default bitmap to show
91
92 // wizard controls
93 wxButton *m_btnPrev, // the "<Back" button
94 *m_btnNext; // the "Next>" or "Finish" button
95 wxStaticBitmap *m_statbmp; // the control for the bitmap
96
97 DECLARE_DYNAMIC_CLASS(wxWizard)
98 DECLARE_EVENT_TABLE()
99 };
100