wxWizard draft
[wxWidgets.git] / include / wx / wizard.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wizard.h
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.
6 // Smith)
7 // Modified by:
8 // Created: 15.08.99
9 // RCS-ID: $Id$
10 // Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
11 // Licence: wxWindows license
12 ///////////////////////////////////////////////////////////////////////////////
13
14 #ifndef _WX_WIZARD_H_
15 #define _WX_WIZARD_H_
16
17 // ----------------------------------------------------------------------------
18 // wxWizard
19 // ----------------------------------------------------------------------------
20
21 class WXDLLEXPORT wxWizard : public wxDialog
22 {
23 public:
24 // create the wizard control
25 static wxWizard *Create(wxWindow *parent,
26 int id = -1,
27 const wxString& title = wxEmptyString,
28 const wxBitmap& bitmap = wxNullBitmap,
29 const wxPoint& pos = wxDefaultPosition,
30 const wxSize& size = wxDefaultSize);
31
32 // wizard construction: add/insert new page into it
33 // adds a page at the end
34 virtual void AddPage(wxPanel *page) = 0;
35 // adds a page before the page nPage (the new page will have this index)
36 virtual void InsertPage(int nPage, wxPanel *page) = 0;
37
38 // executes the wizard, returns TRUE if it was successfully finished, FALSE
39 // if user cancelled it
40 virtual bool RunWizard() = 0;
41
42 // get the current page (NULL if RunWizard() isn't running)
43 virtual wxPanel *GetCurrentPage() const = 0;
44
45 private:
46 DECLARE_DYNAMIC_CLASS(wxWizard)
47 };
48
49 // ----------------------------------------------------------------------------
50 // wxWizardEvent class represents an event generated by the wizard
51 // ----------------------------------------------------------------------------
52
53 class WXDLLEXPORT wxWizardEvent : public wxNotifyEvent
54 {
55 public:
56 wxWizardEvent(wxEventType type = wxEVT_NULL, int id = 0);
57
58 // get the previously active page or -1 if none
59 int GetOldPage() const { return m_pageOld; }
60
61 // get the current page or -1 if none
62 int GetPage() const { return m_page; }
63
64 private:
65 int m_pageOld, m_page;
66
67 DECLARE_DYNAMIC_CLASS(wxWizardEvent)
68 };
69
70 // ----------------------------------------------------------------------------
71 // macros for handling wxWizardEvents
72 // ----------------------------------------------------------------------------
73
74 typedef void (wxEvtHandler::*wxWizardEventFunction)(wxWizardEvent&);
75
76 // notifies that the page has just been changed
77 #define EVT_WIZARD_PAGE_CHANGED(id, fn) { wxEVT_WIZARD_PAGE_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxWizardEventFunction) & fn, (wxObject *)NULL },
78
79 // the user pressed "<Back" or "Next>" button and the page is going to be
80 // changed - unless the event handler vetoes the event
81 #define EVT_WIZARD_PAGE_CHANGING(id, fn) { wxEVT_WIZARD_PAGE_CHANGING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxWizardEventFunction) & fn, (wxObject *)NULL },
82
83 // the user pressed "Cancel" button and the wizard is going to be dismissed -
84 // unless the event handler vetoes the event
85 #define EVT_WIZARD_CANCEL(id, fn) { wxEVT_WIZARD_CANCEL, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxWizardEventFunction) & fn, (wxObject *)NULL },
86
87 #endif // _WX_WIZARD_H_