]>
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 | 6 | // Created: 28.09.99 |
74b31181 | 7 | // Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> |
65571936 | 8 | // Licence: wxWindows licence |
74b31181 VZ |
9 | /////////////////////////////////////////////////////////////////////////////// |
10 | ||
20ceebaa MW |
11 | #ifndef _WX_GENERIC_WIZARD_H_ |
12 | #define _WX_GENERIC_WIZARD_H_ | |
13 | ||
74b31181 VZ |
14 | // ---------------------------------------------------------------------------- |
15 | // wxWizard | |
16 | // ---------------------------------------------------------------------------- | |
17 | ||
b5dbe15d VS |
18 | class WXDLLIMPEXP_FWD_CORE wxButton; |
19 | class WXDLLIMPEXP_FWD_CORE wxStaticBitmap; | |
20 | class WXDLLIMPEXP_FWD_ADV wxWizardEvent; | |
21 | class WXDLLIMPEXP_FWD_CORE wxBoxSizer; | |
22 | class WXDLLIMPEXP_FWD_ADV wxWizardSizer; | |
f1df0927 | 23 | |
12f190b0 | 24 | class WXDLLIMPEXP_ADV wxWizard : public wxWizardBase |
74b31181 VZ |
25 | { |
26 | public: | |
27 | // ctor | |
77436c4c JS |
28 | wxWizard() { Init(); } |
29 | wxWizard(wxWindow *parent, | |
ca65c044 | 30 | int id = wxID_ANY, |
77436c4c JS |
31 | const wxString& title = wxEmptyString, |
32 | const wxBitmap& bitmap = wxNullBitmap, | |
07f20d9a VZ |
33 | const wxPoint& pos = wxDefaultPosition, |
34 | long style = wxDEFAULT_DIALOG_STYLE) | |
77436c4c JS |
35 | { |
36 | Init(); | |
07f20d9a | 37 | Create(parent, id, title, bitmap, pos, style); |
77436c4c JS |
38 | } |
39 | bool Create(wxWindow *parent, | |
ca65c044 | 40 | int id = wxID_ANY, |
74b31181 VZ |
41 | const wxString& title = wxEmptyString, |
42 | const wxBitmap& bitmap = wxNullBitmap, | |
07f20d9a VZ |
43 | const wxPoint& pos = wxDefaultPosition, |
44 | long style = wxDEFAULT_DIALOG_STYLE); | |
77436c4c | 45 | void Init(); |
781130bf | 46 | virtual ~wxWizard(); |
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 | 56 | |
f49fd6d0 JS |
57 | /// set/get bitmap |
58 | const wxBitmap& GetBitmap() const { return m_bitmap; } | |
59 | void SetBitmap(const wxBitmap& bitmap); | |
60 | ||
74b31181 VZ |
61 | // implementation only from now on |
62 | // ------------------------------- | |
63 | ||
64 | // is the wizard running? | |
65 | bool IsRunning() const { return m_page != NULL; } | |
66 | ||
67 | // show the prev/next page, but call TransferDataFromWindow on the current | |
ca65c044 WS |
68 | // page first and return false without changing the page if |
69 | // TransferDataFromWindow() returns false - otherwise, returns true | |
3aa8e4ea | 70 | virtual bool ShowPage(wxWizardPage *page, bool goingForward = true); |
74b31181 | 71 | |
77436c4c JS |
72 | // do fill the dialog with controls |
73 | // this is app-overridable to, for example, set help and tooltip text | |
aacb1b80 | 74 | virtual void DoCreateControls(); |
77436c4c | 75 | |
3aa8e4ea JS |
76 | // Do the adaptation |
77 | virtual bool DoLayoutAdaptation(); | |
78 | ||
79 | // Set/get bitmap background colour | |
80 | void SetBitmapBackgroundColour(const wxColour& colour) { m_bitmapBackgroundColour = colour; } | |
81 | const wxColour& GetBitmapBackgroundColour() const { return m_bitmapBackgroundColour; } | |
82 | ||
83 | // Set/get bitmap placement (centred, tiled etc.) | |
84 | void SetBitmapPlacement(int placement) { m_bitmapPlacement = placement; } | |
85 | int GetBitmapPlacement() const { return m_bitmapPlacement; } | |
86 | ||
87 | // Set/get minimum bitmap width | |
88 | void SetMinimumBitmapWidth(int w) { m_bitmapMinimumWidth = w; } | |
89 | int GetMinimumBitmapWidth() const { return m_bitmapMinimumWidth; } | |
90 | ||
91 | // Tile bitmap | |
92 | static bool TileBitmap(const wxRect& rect, wxDC& dc, const wxBitmap& bitmap); | |
93 | ||
84006e65 | 94 | protected: |
0a089246 VZ |
95 | // for compatibility only, doesn't do anything any more |
96 | void FinishLayout() { } | |
84006e65 | 97 | |
3aa8e4ea JS |
98 | // Do fit, and adjust to screen size if necessary |
99 | virtual void DoWizardLayout(); | |
100 | ||
101 | // Resize bitmap if necessary | |
102 | virtual bool ResizeBitmap(wxBitmap& bmp); | |
103 | ||
f6bcfd97 BP |
104 | // was the dialog really created? |
105 | bool WasCreated() const { return m_btnPrev != NULL; } | |
106 | ||
74b31181 VZ |
107 | // event handlers |
108 | void OnCancel(wxCommandEvent& event); | |
109 | void OnBackOrNext(wxCommandEvent& event); | |
f80bf901 | 110 | void OnHelp(wxCommandEvent& event); |
74b31181 | 111 | |
91c68292 VZ |
112 | void OnWizEvent(wxWizardEvent& event); |
113 | ||
07f20d9a VZ |
114 | void AddBitmapRow(wxBoxSizer *mainColumn); |
115 | void AddStaticLine(wxBoxSizer *mainColumn); | |
116 | void AddBackNextPair(wxBoxSizer *buttonRow); | |
117 | void AddButtonRow(wxBoxSizer *mainColumn); | |
118 | ||
f6bcfd97 BP |
119 | // the page size requested by user |
120 | wxSize m_sizePage; | |
121 | ||
122 | // the dialog position from the ctor | |
123 | wxPoint m_posWizard; | |
124 | ||
74b31181 VZ |
125 | // wizard state |
126 | wxWizardPage *m_page; // the current page or NULL | |
f1df0927 | 127 | wxBitmap m_bitmap; // the default bitmap to show |
74b31181 VZ |
128 | |
129 | // wizard controls | |
130 | wxButton *m_btnPrev, // the "<Back" button | |
131 | *m_btnNext; // the "Next>" or "Finish" button | |
f1df0927 | 132 | wxStaticBitmap *m_statbmp; // the control for the bitmap |
74b31181 | 133 | |
07f20d9a VZ |
134 | // Border around page area sizer requested using SetBorder() |
135 | int m_border; | |
ca65c044 | 136 | |
07f20d9a VZ |
137 | // Whether RunWizard() was called |
138 | bool m_started; | |
ca65c044 | 139 | |
94c09a19 WS |
140 | // Whether was modal (modeless has to be destroyed on finish or cancel) |
141 | bool m_wasModal; | |
142 | ||
0a089246 VZ |
143 | // True if pages are laid out using the sizer |
144 | bool m_usingSizer; | |
145 | ||
07f20d9a VZ |
146 | // Page area sizer will be inserted here with padding |
147 | wxBoxSizer *m_sizerBmpAndPage; | |
ca65c044 | 148 | |
07f20d9a VZ |
149 | // Actual position and size of pages |
150 | wxWizardSizer *m_sizerPage; | |
ca65c044 | 151 | |
3aa8e4ea JS |
152 | // Bitmap background colour if resizing bitmap |
153 | wxColour m_bitmapBackgroundColour; | |
154 | ||
155 | // Bitmap placement flags | |
156 | int m_bitmapPlacement; | |
157 | ||
158 | // Minimum bitmap width | |
159 | int m_bitmapMinimumWidth; | |
160 | ||
07f20d9a | 161 | friend class wxWizardSizer; |
ca65c044 | 162 | |
74b31181 VZ |
163 | DECLARE_DYNAMIC_CLASS(wxWizard) |
164 | DECLARE_EVENT_TABLE() | |
c0c133e1 | 165 | wxDECLARE_NO_COPY_CLASS(wxWizard); |
74b31181 VZ |
166 | }; |
167 | ||
20ceebaa | 168 | #endif // _WX_GENERIC_WIZARD_H_ |