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 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
;
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
);
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
);
59 const wxBitmap
& GetBitmap() const { return m_bitmap
; }
60 void SetBitmap(const wxBitmap
& bitmap
);
62 // implementation only from now on
63 // -------------------------------
65 // is the wizard running?
66 bool IsRunning() const { return m_page
!= NULL
; }
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 virtual bool ShowPage(wxWizardPage
*page
, bool goingForward
= true);
73 // do fill the dialog with controls
74 // this is app-overridable to, for example, set help and tooltip text
75 virtual void DoCreateControls();
78 virtual bool DoLayoutAdaptation();
80 // Set/get bitmap background colour
81 void SetBitmapBackgroundColour(const wxColour
& colour
) { m_bitmapBackgroundColour
= colour
; }
82 const wxColour
& GetBitmapBackgroundColour() const { return m_bitmapBackgroundColour
; }
84 // Set/get bitmap placement (centred, tiled etc.)
85 void SetBitmapPlacement(int placement
) { m_bitmapPlacement
= placement
; }
86 int GetBitmapPlacement() const { return m_bitmapPlacement
; }
88 // Set/get minimum bitmap width
89 void SetMinimumBitmapWidth(int w
) { m_bitmapMinimumWidth
= w
; }
90 int GetMinimumBitmapWidth() const { return m_bitmapMinimumWidth
; }
93 static bool TileBitmap(const wxRect
& rect
, wxDC
& dc
, const wxBitmap
& bitmap
);
96 // for compatibility only, doesn't do anything any more
97 void FinishLayout() { }
99 // Do fit, and adjust to screen size if necessary
100 virtual void DoWizardLayout();
102 // Resize bitmap if necessary
103 virtual bool ResizeBitmap(wxBitmap
& bmp
);
105 // was the dialog really created?
106 bool WasCreated() const { return m_btnPrev
!= NULL
; }
109 void OnCancel(wxCommandEvent
& event
);
110 void OnBackOrNext(wxCommandEvent
& event
);
111 void OnHelp(wxCommandEvent
& event
);
113 void OnWizEvent(wxWizardEvent
& event
);
115 void AddBitmapRow(wxBoxSizer
*mainColumn
);
116 void AddStaticLine(wxBoxSizer
*mainColumn
);
117 void AddBackNextPair(wxBoxSizer
*buttonRow
);
118 void AddButtonRow(wxBoxSizer
*mainColumn
);
120 // the page size requested by user
123 // the dialog position from the ctor
127 wxWizardPage
*m_page
; // the current page or NULL
128 wxBitmap m_bitmap
; // the default bitmap to show
131 wxButton
*m_btnPrev
, // the "<Back" button
132 *m_btnNext
; // the "Next>" or "Finish" button
133 wxStaticBitmap
*m_statbmp
; // the control for the bitmap
135 // Border around page area sizer requested using SetBorder()
138 // Whether RunWizard() was called
141 // Whether was modal (modeless has to be destroyed on finish or cancel)
144 // True if pages are laid out using the sizer
147 // Page area sizer will be inserted here with padding
148 wxBoxSizer
*m_sizerBmpAndPage
;
150 // Actual position and size of pages
151 wxWizardSizer
*m_sizerPage
;
153 // Bitmap background colour if resizing bitmap
154 wxColour m_bitmapBackgroundColour
;
156 // Bitmap placement flags
157 int m_bitmapPlacement
;
159 // Minimum bitmap width
160 int m_bitmapMinimumWidth
;
162 friend class wxWizardSizer
;
164 DECLARE_DYNAMIC_CLASS(wxWizard
)
165 DECLARE_EVENT_TABLE()
166 DECLARE_NO_COPY_CLASS(wxWizard
)
169 #endif // _WX_GENERIC_WIZARD_H_