]> git.saurik.com Git - wxWidgets.git/blob - include/wx/wizard.h
Added GSocket/wxSocket alias to socket.h to prevent us from using GSocket
[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 // headers
19 // ----------------------------------------------------------------------------
20
21 #ifndef WX_PRECOMP
22 #include "wx/dialog.h" // the base class
23
24 #include "wx/event.h" // wxEVT_XXX constants
25 #endif // WX_PRECOMP
26
27 // ----------------------------------------------------------------------------
28 // wxWizard
29 // ----------------------------------------------------------------------------
30
31 class WXDLLEXPORT wxWizard : public wxDialog
32 {
33 public:
34 // create the wizard control
35 static wxWizard *Create(wxWindow *parent,
36 int id = -1,
37 const wxString& title = wxEmptyString,
38 const wxBitmap& bitmap = wxNullBitmap,
39 const wxPoint& pos = wxDefaultPosition,
40 const wxSize& size = wxDefaultSize);
41
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;
47
48 // executes the wizard, returns TRUE if it was successfully finished, FALSE
49 // if user cancelled it
50 virtual bool RunWizard() = 0;
51
52 // get the current page (NULL if RunWizard() isn't running)
53 virtual wxPanel *GetCurrentPage() const = 0;
54
55 private:
56 DECLARE_DYNAMIC_CLASS(wxWizard)
57 };
58
59 // ----------------------------------------------------------------------------
60 // wxWizardEvent class represents an event generated by the wizard
61 // ----------------------------------------------------------------------------
62
63 class WXDLLEXPORT wxWizardEvent : public wxNotifyEvent
64 {
65 public:
66 wxWizardEvent(wxEventType type = wxEVT_NULL, int id = 0);
67
68 // get the previously active page or -1 if none
69 int GetOldPage() const { return m_pageOld; }
70
71 // get the current page or -1 if none
72 int GetPage() const { return m_page; }
73
74 private:
75 int m_pageOld, m_page;
76
77 DECLARE_DYNAMIC_CLASS(wxWizardEvent)
78 };
79
80 // ----------------------------------------------------------------------------
81 // macros for handling wxWizardEvents
82 // ----------------------------------------------------------------------------
83
84 typedef void (wxEvtHandler::*wxWizardEventFunction)(wxWizardEvent&);
85
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 },
88
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 },
92
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 },
96
97 #endif // _WX_WIZARD_H_