]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/wizard.h
e6f4f5faacf1e56d746e6d35d89fd8b191af2ff3
[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: Robert Vazan (sizers)
6 // Created: 28.09.99
7 // RCS-ID: $Id$
8 // Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 // ----------------------------------------------------------------------------
13 // wxWizard
14 // ----------------------------------------------------------------------------
15
16 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
17 #pragma interface "wizardg.h"
18 #endif
19
20 class WXDLLEXPORT wxButton;
21 class WXDLLEXPORT wxStaticBitmap;
22 class WXDLLIMPEXP_ADV wxWizardEvent;
23 class WXDLLEXPORT wxBoxSizer;
24 class WXDLLIMPEXP_ADV wxWizardSizer;
25
26 class WXDLLIMPEXP_ADV wxWizard : public wxWizardBase
27 {
28 public:
29 // ctor
30 wxWizard() { Init(); }
31 wxWizard(wxWindow *parent,
32 int id = wxID_ANY,
33 const wxString& title = wxEmptyString,
34 const wxBitmap& bitmap = wxNullBitmap,
35 const wxPoint& pos = wxDefaultPosition,
36 long style = wxDEFAULT_DIALOG_STYLE)
37 {
38 Init();
39 Create(parent, id, title, bitmap, pos, style);
40 }
41 bool Create(wxWindow *parent,
42 int id = wxID_ANY,
43 const wxString& title = wxEmptyString,
44 const wxBitmap& bitmap = wxNullBitmap,
45 const wxPoint& pos = wxDefaultPosition,
46 long style = wxDEFAULT_DIALOG_STYLE);
47 void Init();
48
49 // implement base class pure virtuals
50 virtual bool RunWizard(wxWizardPage *firstPage);
51 virtual wxWizardPage *GetCurrentPage() const;
52 virtual void SetPageSize(const wxSize& size);
53 virtual wxSize GetPageSize() const;
54 virtual void FitToPage(const wxWizardPage *firstPage);
55 virtual wxSizer *GetPageAreaSizer() const;
56 virtual void SetBorder(int border);
57
58 // implementation only from now on
59 // -------------------------------
60
61 // is the wizard running?
62 bool IsRunning() const { return m_page != NULL; }
63
64 // show the prev/next page, but call TransferDataFromWindow on the current
65 // page first and return false without changing the page if
66 // TransferDataFromWindow() returns false - otherwise, returns true
67 bool ShowPage(wxWizardPage *page, bool goingForward = true);
68
69 // do fill the dialog with controls
70 // this is app-overridable to, for example, set help and tooltip text
71 virtual void DoCreateControls();
72
73 private:
74 // was the dialog really created?
75 bool WasCreated() const { return m_btnPrev != NULL; }
76
77 // event handlers
78 void OnCancel(wxCommandEvent& event);
79 void OnBackOrNext(wxCommandEvent& event);
80 void OnHelp(wxCommandEvent& event);
81
82 void OnWizEvent(wxWizardEvent& event);
83
84 void AddBitmapRow(wxBoxSizer *mainColumn);
85 void AddStaticLine(wxBoxSizer *mainColumn);
86 void AddBackNextPair(wxBoxSizer *buttonRow);
87 void AddButtonRow(wxBoxSizer *mainColumn);
88
89 #if wxABI_VERSION >= 20602
90 protected:
91 #endif
92 void FinishLayout();
93
94 private:
95 wxSize GetManualPageSize() const;
96
97 // the page size requested by user
98 wxSize m_sizePage;
99
100 // the dialog position from the ctor
101 wxPoint m_posWizard;
102
103 // wizard state
104 wxWizardPage *m_page; // the current page or NULL
105 wxBitmap m_bitmap; // the default bitmap to show
106
107 // wizard controls
108 wxButton *m_btnPrev, // the "<Back" button
109 *m_btnNext; // the "Next>" or "Finish" button
110 wxStaticBitmap *m_statbmp; // the control for the bitmap
111
112 // Whether user called SetBorder()
113 bool m_calledSetBorder;
114 // Border around page area sizer requested using SetBorder()
115 int m_border;
116
117 // Whether RunWizard() was called
118 bool m_started;
119
120 // Page area sizer will be inserted here with padding
121 wxBoxSizer *m_sizerBmpAndPage;
122
123 // Actual position and size of pages
124 wxWizardSizer *m_sizerPage;
125
126 friend class wxWizardSizer;
127
128 DECLARE_DYNAMIC_CLASS(wxWizard)
129 DECLARE_EVENT_TABLE()
130 DECLARE_NO_COPY_CLASS(wxWizard)
131 };
132