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