1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/wizard.h
3 // Purpose: declaration of generic wxWizard class
4 // Author: Vadim Zeitlin
5 // Modified by: Robert Vazan (sizers)
7 // Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_GENERIC_WIZARD_H_
12 #define _WX_GENERIC_WIZARD_H_
14 // ----------------------------------------------------------------------------
16 // ----------------------------------------------------------------------------
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
;
24 class WXDLLIMPEXP_ADV wxWizard
: public wxWizardBase
28 wxWizard() { Init(); }
29 wxWizard(wxWindow
*parent
,
31 const wxString
& title
= wxEmptyString
,
32 const wxBitmap
& bitmap
= wxNullBitmap
,
33 const wxPoint
& pos
= wxDefaultPosition
,
34 long style
= wxDEFAULT_DIALOG_STYLE
)
37 Create(parent
, id
, title
, bitmap
, pos
, style
);
39 bool Create(wxWindow
*parent
,
41 const wxString
& title
= wxEmptyString
,
42 const wxBitmap
& bitmap
= wxNullBitmap
,
43 const wxPoint
& pos
= wxDefaultPosition
,
44 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
);
58 const wxBitmap
& GetBitmap() const { return m_bitmap
; }
59 void SetBitmap(const wxBitmap
& bitmap
);
61 // implementation only from now on
62 // -------------------------------
64 // is the wizard running?
65 bool IsRunning() const { return m_page
!= NULL
; }
67 // show the prev/next page, but call TransferDataFromWindow on the current
68 // page first and return false without changing the page if
69 // TransferDataFromWindow() returns false - otherwise, returns true
70 virtual bool ShowPage(wxWizardPage
*page
, bool goingForward
= true);
72 // do fill the dialog with controls
73 // this is app-overridable to, for example, set help and tooltip text
74 virtual void DoCreateControls();
77 virtual bool DoLayoutAdaptation();
79 // Set/get bitmap background colour
80 void SetBitmapBackgroundColour(const wxColour
& colour
) { m_bitmapBackgroundColour
= colour
; }
81 const wxColour
& GetBitmapBackgroundColour() const { return m_bitmapBackgroundColour
; }
83 // Set/get bitmap placement (centred, tiled etc.)
84 void SetBitmapPlacement(int placement
) { m_bitmapPlacement
= placement
; }
85 int GetBitmapPlacement() const { return m_bitmapPlacement
; }
87 // Set/get minimum bitmap width
88 void SetMinimumBitmapWidth(int w
) { m_bitmapMinimumWidth
= w
; }
89 int GetMinimumBitmapWidth() const { return m_bitmapMinimumWidth
; }
92 static bool TileBitmap(const wxRect
& rect
, wxDC
& dc
, const wxBitmap
& bitmap
);
95 // for compatibility only, doesn't do anything any more
96 void FinishLayout() { }
98 // Do fit, and adjust to screen size if necessary
99 virtual void DoWizardLayout();
101 // Resize bitmap if necessary
102 virtual bool ResizeBitmap(wxBitmap
& bmp
);
104 // was the dialog really created?
105 bool WasCreated() const { return m_btnPrev
!= NULL
; }
108 void OnCancel(wxCommandEvent
& event
);
109 void OnBackOrNext(wxCommandEvent
& event
);
110 void OnHelp(wxCommandEvent
& event
);
112 void OnWizEvent(wxWizardEvent
& event
);
114 void AddBitmapRow(wxBoxSizer
*mainColumn
);
115 void AddStaticLine(wxBoxSizer
*mainColumn
);
116 void AddBackNextPair(wxBoxSizer
*buttonRow
);
117 void AddButtonRow(wxBoxSizer
*mainColumn
);
119 // the page size requested by user
122 // the dialog position from the ctor
126 wxWizardPage
*m_page
; // the current page or NULL
127 wxBitmap m_bitmap
; // the default bitmap to show
130 wxButton
*m_btnPrev
, // the "<Back" button
131 *m_btnNext
; // the "Next>" or "Finish" button
132 wxStaticBitmap
*m_statbmp
; // the control for the bitmap
134 // Border around page area sizer requested using SetBorder()
137 // Whether RunWizard() was called
140 // Whether was modal (modeless has to be destroyed on finish or cancel)
143 // True if pages are laid out using the sizer
146 // Page area sizer will be inserted here with padding
147 wxBoxSizer
*m_sizerBmpAndPage
;
149 // Actual position and size of pages
150 wxWizardSizer
*m_sizerPage
;
152 // Bitmap background colour if resizing bitmap
153 wxColour m_bitmapBackgroundColour
;
155 // Bitmap placement flags
156 int m_bitmapPlacement
;
158 // Minimum bitmap width
159 int m_bitmapMinimumWidth
;
161 friend class wxWizardSizer
;
163 DECLARE_DYNAMIC_CLASS(wxWizard
)
164 DECLARE_EVENT_TABLE()
165 wxDECLARE_NO_COPY_CLASS(wxWizard
);
168 #endif // _WX_GENERIC_WIZARD_H_