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: wizard.h 49563 2007-10-31 20:46:21Z VZ $ 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 wxWizard()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 48 #if wxABI_VERSION >= 20804 49 virtual ~wxWizard(); 50 #endif 51 52 // implement base class pure virtuals 53 virtual bool RunWizard(wxWizardPage *firstPage); 54 virtual wxWizardPage *GetCurrentPage() const; 55 virtual void SetPageSize(const wxSize& size); 56 virtual wxSize GetPageSize() const; 57 virtual void FitToPage(const wxWizardPage *firstPage); 58 virtual wxSizer *GetPageAreaSizer() const; 59 virtual void SetBorder(int border); 60 61 /// set/get bitmap 62 #if wxABI_VERSION >= 20805 GetBitmap()63 const wxBitmap& GetBitmap() const { return m_bitmap; } 64 void SetBitmap(const wxBitmap& bitmap); 65 #endif 66 67 // implementation only from now on 68 // ------------------------------- 69 70 // is the wizard running? IsRunning()71 bool IsRunning() const { return m_page != NULL; } 72 73 // show the prev/next page, but call TransferDataFromWindow on the current 74 // page first and return false without changing the page if 75 // TransferDataFromWindow() returns false - otherwise, returns true 76 bool ShowPage(wxWizardPage *page, bool goingForward = true); 77 78 // do fill the dialog with controls 79 // this is app-overridable to, for example, set help and tooltip text 80 virtual void DoCreateControls(); 81 82 protected: 83 // for compatibility only, doesn't do anything any more FinishLayout()84 void FinishLayout() { } 85 86 private: 87 // was the dialog really created? WasCreated()88 bool WasCreated() const { return m_btnPrev != NULL; } 89 90 // event handlers 91 void OnCancel(wxCommandEvent& event); 92 void OnBackOrNext(wxCommandEvent& event); 93 void OnHelp(wxCommandEvent& event); 94 95 void OnWizEvent(wxWizardEvent& event); 96 97 void AddBitmapRow(wxBoxSizer *mainColumn); 98 void AddStaticLine(wxBoxSizer *mainColumn); 99 void AddBackNextPair(wxBoxSizer *buttonRow); 100 void AddButtonRow(wxBoxSizer *mainColumn); 101 102 // the page size requested by user 103 wxSize m_sizePage; 104 105 // the dialog position from the ctor 106 wxPoint m_posWizard; 107 108 // wizard state 109 wxWizardPage *m_page; // the current page or NULL 110 wxBitmap m_bitmap; // the default bitmap to show 111 112 // wizard controls 113 wxButton *m_btnPrev, // the "<Back" button 114 *m_btnNext; // the "Next>" or "Finish" button 115 wxStaticBitmap *m_statbmp; // the control for the bitmap 116 117 // Border around page area sizer requested using SetBorder() 118 int m_border; 119 120 // Whether RunWizard() was called 121 bool m_started; 122 123 // Whether was modal (modeless has to be destroyed on finish or cancel) 124 bool m_wasModal; 125 126 // True if pages are laid out using the sizer 127 bool m_usingSizer; 128 129 // Page area sizer will be inserted here with padding 130 wxBoxSizer *m_sizerBmpAndPage; 131 132 // Actual position and size of pages 133 wxWizardSizer *m_sizerPage; 134 135 friend class wxWizardSizer; 136 137 DECLARE_DYNAMIC_CLASS(wxWizard) 138 DECLARE_EVENT_TABLE() 139 DECLARE_NO_COPY_CLASS(wxWizard) 140 }; 141 142 #endif // _WX_GENERIC_WIZARD_H_ 143