1 ///////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxWizard class: a GUI control presenting the user with a
4 // sequence of dialogs which allows to simply perform some task
5 // Author: Vadim Zeitlin (partly based on work by Ron Kuris and Kevin B.
10 // Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
11 // Licence: wxWindows license
12 ///////////////////////////////////////////////////////////////////////////////
17 // ----------------------------------------------------------------------------
19 // ----------------------------------------------------------------------------
22 #include "wx/dialog.h" // the base class
24 #include "wx/event.h" // wxEVT_XXX constants
27 // ----------------------------------------------------------------------------
29 // ----------------------------------------------------------------------------
31 class WXDLLEXPORT wxWizard
: public wxDialog
34 // create the wizard control
35 static wxWizard
*Create(wxWindow
*parent
,
37 const wxString
& title
= wxEmptyString
,
38 const wxBitmap
& bitmap
= wxNullBitmap
,
39 const wxPoint
& pos
= wxDefaultPosition
,
40 const wxSize
& size
= wxDefaultSize
);
42 // wizard construction: add/insert new page into it
43 // adds a page at the end
44 virtual void AddPage(wxPanel
*page
) = 0;
45 // adds a page before the page nPage (the new page will have this index)
46 virtual void InsertPage(int nPage
, wxPanel
*page
) = 0;
48 // executes the wizard, returns TRUE if it was successfully finished, FALSE
49 // if user cancelled it
50 virtual bool RunWizard() = 0;
52 // get the current page (NULL if RunWizard() isn't running)
53 virtual wxPanel
*GetCurrentPage() const = 0;
56 DECLARE_DYNAMIC_CLASS(wxWizard
)
59 // ----------------------------------------------------------------------------
60 // wxWizardEvent class represents an event generated by the wizard
61 // ----------------------------------------------------------------------------
63 class WXDLLEXPORT wxWizardEvent
: public wxNotifyEvent
66 wxWizardEvent(wxEventType type
= wxEVT_NULL
, int id
= 0);
68 // get the previously active page or -1 if none
69 int GetOldPage() const { return m_pageOld
; }
71 // get the current page or -1 if none
72 int GetPage() const { return m_page
; }
75 int m_pageOld
, m_page
;
77 DECLARE_DYNAMIC_CLASS(wxWizardEvent
)
80 // ----------------------------------------------------------------------------
81 // macros for handling wxWizardEvents
82 // ----------------------------------------------------------------------------
84 typedef void (wxEvtHandler::*wxWizardEventFunction
)(wxWizardEvent
&);
86 // notifies that the page has just been changed
87 #define EVT_WIZARD_PAGE_CHANGED(id, fn) { wxEVT_WIZARD_PAGE_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxWizardEventFunction) & fn, (wxObject *)NULL },
89 // the user pressed "<Back" or "Next>" button and the page is going to be
90 // changed - unless the event handler vetoes the event
91 #define EVT_WIZARD_PAGE_CHANGING(id, fn) { wxEVT_WIZARD_PAGE_CHANGING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxWizardEventFunction) & fn, (wxObject *)NULL },
93 // the user pressed "Cancel" button and the wizard is going to be dismissed -
94 // unless the event handler vetoes the event
95 #define EVT_WIZARD_CANCEL(id, fn) { wxEVT_WIZARD_CANCEL, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxWizardEventFunction) & fn, (wxObject *)NULL },
97 #endif // _WX_WIZARD_H_