]>
Commit | Line | Data |
---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/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 | #ifndef _WX_GENERIC_WIZARD_H_ | |
13 | #define _WX_GENERIC_WIZARD_H_ | |
14 | ||
15 | // ---------------------------------------------------------------------------- | |
16 | // wxWizard | |
17 | // ---------------------------------------------------------------------------- | |
18 | ||
19 | class WXDLLIMPEXP_FWD_CORE wxButton; | |
20 | class WXDLLIMPEXP_FWD_CORE wxStaticBitmap; | |
21 | class WXDLLIMPEXP_FWD_ADV wxWizardEvent; | |
22 | class WXDLLIMPEXP_FWD_CORE wxBoxSizer; | |
23 | class WXDLLIMPEXP_FWD_ADV wxWizardSizer; | |
24 | ||
25 | class WXDLLIMPEXP_ADV wxWizard : public wxWizardBase | |
26 | { | |
27 | public: | |
28 | // ctor | |
29 | wxWizard() { Init(); } | |
30 | wxWizard(wxWindow *parent, | |
31 | int id = wxID_ANY, | |
32 | const wxString& title = wxEmptyString, | |
33 | const wxBitmap& bitmap = wxNullBitmap, | |
34 | const wxPoint& pos = wxDefaultPosition, | |
35 | long style = wxDEFAULT_DIALOG_STYLE) | |
36 | { | |
37 | Init(); | |
38 | Create(parent, id, title, bitmap, pos, style); | |
39 | } | |
40 | bool Create(wxWindow *parent, | |
41 | int id = wxID_ANY, | |
42 | const wxString& title = wxEmptyString, | |
43 | const wxBitmap& bitmap = wxNullBitmap, | |
44 | const wxPoint& pos = wxDefaultPosition, | |
45 | long style = wxDEFAULT_DIALOG_STYLE); | |
46 | void Init(); | |
47 | virtual ~wxWizard(); | |
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 | /// set/get bitmap | |
59 | const wxBitmap& GetBitmap() const { return m_bitmap; } | |
60 | void SetBitmap(const wxBitmap& bitmap); | |
61 | ||
62 | // implementation only from now on | |
63 | // ------------------------------- | |
64 | ||
65 | // is the wizard running? | |
66 | bool IsRunning() const { return m_page != NULL; } | |
67 | ||
68 | // show the prev/next page, but call TransferDataFromWindow on the current | |
69 | // page first and return false without changing the page if | |
70 | // TransferDataFromWindow() returns false - otherwise, returns true | |
71 | bool ShowPage(wxWizardPage *page, bool goingForward = true); | |
72 | ||
73 | // do fill the dialog with controls | |
74 | // this is app-overridable to, for example, set help and tooltip text | |
75 | virtual void DoCreateControls(); | |
76 | ||
77 | protected: | |
78 | // for compatibility only, doesn't do anything any more | |
79 | void FinishLayout() { } | |
80 | ||
81 | private: | |
82 | // was the dialog really created? | |
83 | bool WasCreated() const { return m_btnPrev != NULL; } | |
84 | ||
85 | // event handlers | |
86 | void OnCancel(wxCommandEvent& event); | |
87 | void OnBackOrNext(wxCommandEvent& event); | |
88 | void OnHelp(wxCommandEvent& event); | |
89 | ||
90 | void OnWizEvent(wxWizardEvent& event); | |
91 | ||
92 | void AddBitmapRow(wxBoxSizer *mainColumn); | |
93 | void AddStaticLine(wxBoxSizer *mainColumn); | |
94 | void AddBackNextPair(wxBoxSizer *buttonRow); | |
95 | void AddButtonRow(wxBoxSizer *mainColumn); | |
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 | // Border around page area sizer requested using SetBorder() | |
113 | int m_border; | |
114 | ||
115 | // Whether RunWizard() was called | |
116 | bool m_started; | |
117 | ||
118 | // Whether was modal (modeless has to be destroyed on finish or cancel) | |
119 | bool m_wasModal; | |
120 | ||
121 | // True if pages are laid out using the sizer | |
122 | bool m_usingSizer; | |
123 | ||
124 | // Page area sizer will be inserted here with padding | |
125 | wxBoxSizer *m_sizerBmpAndPage; | |
126 | ||
127 | // Actual position and size of pages | |
128 | wxWizardSizer *m_sizerPage; | |
129 | ||
130 | friend class wxWizardSizer; | |
131 | ||
132 | DECLARE_DYNAMIC_CLASS(wxWizard) | |
133 | DECLARE_EVENT_TABLE() | |
134 | DECLARE_NO_COPY_CLASS(wxWizard) | |
135 | }; | |
136 | ||
137 | #endif // _WX_GENERIC_WIZARD_H_ |