]>
Commit | Line | Data |
---|---|---|
74b31181 VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: generic/wizard.h | |
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> | |
371a5b4e | 9 | // Licence: wxWindows licence |
74b31181 VZ |
10 | /////////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | // ---------------------------------------------------------------------------- | |
13 | // wxWizard | |
14 | // ---------------------------------------------------------------------------- | |
15 | ||
12028905 | 16 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
91c68292 VZ |
17 | #pragma interface "wizardg.h" |
18 | #endif | |
19 | ||
f1df0927 VZ |
20 | class WXDLLEXPORT wxButton; |
21 | class WXDLLEXPORT wxStaticBitmap; | |
12f190b0 | 22 | class WXDLLIMPEXP_ADV wxWizardEvent; |
07f20d9a | 23 | class WXDLLEXPORT wxBoxSizer; |
12f190b0 | 24 | class WXDLLIMPEXP_ADV wxWizardSizer; |
f1df0927 | 25 | |
12f190b0 | 26 | class WXDLLIMPEXP_ADV wxWizard : public wxWizardBase |
74b31181 VZ |
27 | { |
28 | public: | |
29 | // ctor | |
77436c4c JS |
30 | wxWizard() { Init(); } |
31 | wxWizard(wxWindow *parent, | |
32 | int id = -1, | |
33 | const wxString& title = wxEmptyString, | |
34 | const wxBitmap& bitmap = wxNullBitmap, | |
07f20d9a VZ |
35 | const wxPoint& pos = wxDefaultPosition, |
36 | long style = wxDEFAULT_DIALOG_STYLE) | |
77436c4c JS |
37 | { |
38 | Init(); | |
07f20d9a | 39 | Create(parent, id, title, bitmap, pos, style); |
77436c4c JS |
40 | } |
41 | bool Create(wxWindow *parent, | |
74b31181 VZ |
42 | int id = -1, |
43 | const wxString& title = wxEmptyString, | |
44 | const wxBitmap& bitmap = wxNullBitmap, | |
07f20d9a VZ |
45 | const wxPoint& pos = wxDefaultPosition, |
46 | long style = wxDEFAULT_DIALOG_STYLE); | |
77436c4c | 47 | void Init(); |
74b31181 VZ |
48 | |
49 | // implement base class pure virtuals | |
50 | virtual bool RunWizard(wxWizardPage *firstPage); | |
51 | virtual wxWizardPage *GetCurrentPage() const; | |
f6bcfd97 | 52 | virtual void SetPageSize(const wxSize& size); |
4fe5383d | 53 | virtual wxSize GetPageSize() const; |
3ee58334 | 54 | virtual void FitToPage(const wxWizardPage *firstPage); |
07f20d9a VZ |
55 | virtual wxSizer *GetPageAreaSizer() const; |
56 | virtual void SetBorder(int border); | |
74b31181 VZ |
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 | |
f6bcfd97 BP |
65 | // page first and return FALSE without changing the page if |
66 | // TransferDataFromWindow() returns FALSE - otherwise, returns TRUE | |
74b31181 VZ |
67 | bool ShowPage(wxWizardPage *page, bool goingForward = TRUE); |
68 | ||
77436c4c JS |
69 | // do fill the dialog with controls |
70 | // this is app-overridable to, for example, set help and tooltip text | |
aacb1b80 | 71 | virtual void DoCreateControls(); |
77436c4c | 72 | |
74b31181 | 73 | private: |
f6bcfd97 BP |
74 | // was the dialog really created? |
75 | bool WasCreated() const { return m_btnPrev != NULL; } | |
76 | ||
74b31181 VZ |
77 | // event handlers |
78 | void OnCancel(wxCommandEvent& event); | |
79 | void OnBackOrNext(wxCommandEvent& event); | |
f80bf901 | 80 | void OnHelp(wxCommandEvent& event); |
74b31181 | 81 | |
91c68292 VZ |
82 | void OnWizEvent(wxWizardEvent& event); |
83 | ||
07f20d9a VZ |
84 | void AddBitmapRow(wxBoxSizer *mainColumn); |
85 | void AddStaticLine(wxBoxSizer *mainColumn); | |
86 | void AddBackNextPair(wxBoxSizer *buttonRow); | |
87 | void AddButtonRow(wxBoxSizer *mainColumn); | |
88 | ||
89 | void FinishLayout(); | |
90 | ||
91 | wxSize GetManualPageSize() const; | |
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; | |
112 | ||
113 | // Whether RunWizard() was called | |
114 | bool m_started; | |
115 | ||
116 | // Page area sizer will be inserted here with padding | |
117 | wxBoxSizer *m_sizerBmpAndPage; | |
118 | ||
119 | // Actual position and size of pages | |
120 | wxWizardSizer *m_sizerPage; | |
121 | ||
122 | friend class wxWizardSizer; | |
123 | ||
74b31181 VZ |
124 | DECLARE_DYNAMIC_CLASS(wxWizard) |
125 | DECLARE_EVENT_TABLE() | |
22f3361e | 126 | DECLARE_NO_COPY_CLASS(wxWizard) |
74b31181 VZ |
127 | }; |
128 |