1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/wizard.h
3 // Purpose: declaration of generic wxWizard class
4 // Author: Vadim Zeitlin
5 // Modified by: Robert Vazan (sizers)
8 // Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_GENERIC_WIZARD_H_
13 #define _WX_GENERIC_WIZARD_H_
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 class WXDLLEXPORT wxButton
;
20 class WXDLLEXPORT wxStaticBitmap
;
21 class WXDLLIMPEXP_ADV wxWizardEvent
;
22 class WXDLLEXPORT wxBoxSizer
;
23 class WXDLLIMPEXP_ADV wxWizardSizer
;
25 class WXDLLIMPEXP_ADV wxWizard
: public wxWizardBase
29 wxWizard() { Init(); }
30 wxWizard(wxWindow
*parent
,
32 const wxString
& title
= wxEmptyString
,
33 const wxBitmap
& bitmap
= wxNullBitmap
,
34 const wxPoint
& pos
= wxDefaultPosition
,
35 long style
= wxDEFAULT_DIALOG_STYLE
)
38 Create(parent
, id
, title
, bitmap
, pos
, style
);
40 bool Create(wxWindow
*parent
,
42 const wxString
& title
= wxEmptyString
,
43 const wxBitmap
& bitmap
= wxNullBitmap
,
44 const wxPoint
& pos
= wxDefaultPosition
,
45 long style
= wxDEFAULT_DIALOG_STYLE
);
48 // implement base class pure virtuals
49 virtual bool RunWizard(wxWizardPage
*firstPage
);
50 virtual wxWizardPage
*GetCurrentPage() const;
51 virtual void SetPageSize(const wxSize
& size
);
52 virtual wxSize
GetPageSize() const;
53 virtual void FitToPage(const wxWizardPage
*firstPage
);
54 virtual wxSizer
*GetPageAreaSizer() const;
55 virtual void SetBorder(int border
);
57 // implementation only from now on
58 // -------------------------------
60 // is the wizard running?
61 bool IsRunning() const { return m_page
!= NULL
; }
63 // show the prev/next page, but call TransferDataFromWindow on the current
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);
68 // do fill the dialog with controls
69 // this is app-overridable to, for example, set help and tooltip text
70 virtual void DoCreateControls();
73 // for compatibility only, doesn't do anything any more
74 void FinishLayout() { }
77 // was the dialog really created?
78 bool WasCreated() const { return m_btnPrev
!= NULL
; }
81 void OnCancel(wxCommandEvent
& event
);
82 void OnBackOrNext(wxCommandEvent
& event
);
83 void OnHelp(wxCommandEvent
& event
);
85 void OnWizEvent(wxWizardEvent
& event
);
87 void AddBitmapRow(wxBoxSizer
*mainColumn
);
88 void AddStaticLine(wxBoxSizer
*mainColumn
);
89 void AddBackNextPair(wxBoxSizer
*buttonRow
);
90 void AddButtonRow(wxBoxSizer
*mainColumn
);
92 // the page size requested by user
95 // the dialog position from the ctor
99 wxWizardPage
*m_page
; // the current page or NULL
100 wxBitmap m_bitmap
; // the default bitmap to show
103 wxButton
*m_btnPrev
, // the "<Back" button
104 *m_btnNext
; // the "Next>" or "Finish" button
105 wxStaticBitmap
*m_statbmp
; // the control for the bitmap
107 // Border around page area sizer requested using SetBorder()
110 // Whether RunWizard() was called
113 // Whether was modal (modeless has to be destroyed on finish or cancel)
116 // True if pages are laid out using the sizer
119 // Page area sizer will be inserted here with padding
120 wxBoxSizer
*m_sizerBmpAndPage
;
122 // Actual position and size of pages
123 wxWizardSizer
*m_sizerPage
;
125 friend class wxWizardSizer
;
127 DECLARE_DYNAMIC_CLASS(wxWizard
)
128 DECLARE_EVENT_TABLE()
129 DECLARE_NO_COPY_CLASS(wxWizard
)
132 #endif // _WX_GENERIC_WIZARD_H_