00001
00020 #ifndef INC_MGUI_DLGWIZARD_H
00021 #define INC_MGUI_DLGWIZARD_H
00022
00023 #ifndef INC_MGUI_SHELL_H
00024 #include <mgui/shell.h>
00025 #endif
00026
00027 #ifndef INC_MGUI_CTRL_H
00028 #include <mgui/ctrl.h>
00029 #endif
00030
00031
00032 namespace MGUI {
00033
00034 class LAYOUT_WIZARD_PAGE;
00035
00042 class DLGWIZARD : public MGUI::SHELL {
00043 public:
00044
00045 enum BTNFLAGS {
00046 BTNFLAG_None = 0x00,
00047 BTNFLAG_Next = 0x01,
00048 BTNFLAG_Back = 0x02,
00049 BTNFLAG_Finish = 0x04,
00050 BTNFLAG_DisabledFinish = 0x08
00051 };
00052
00054 enum DLGSTYLE {
00055 DLGSTYLE_Default = 0x0000,
00056 DLGSTYLE_Resizable = 0x0001,
00057 };
00058
00060 virtual ~DLGWIZARD (
00061 ) = 0;
00062
00065 ERRVALUE DoModal (
00066 MDLGPARENT dlgparent
00067 );
00068
00071 int GetActiveIndex (
00072 ) const;
00073
00076 int GetNumPages (
00077 ) const;
00078
00080 void SetActiveIndex (
00081 int index
00082 );
00083
00086 void SetWizardButtons (
00087 BTNFLAGS flags
00088 );
00089
00090 protected:
00091
00093 DLGWIZARD (
00094 const MISTRING& title,
00095 HELPID HelpID,
00096 DLGSTYLE style = DLGSTYLE_Default
00097 );
00098
00100 void NotifyCancel (
00101 ) { v_OnCancel(); }
00102
00104 void SetReturnValue (
00105 int RetValue
00106 ) { m_RetValue = RetValue; }
00107
00111 void SetRootMargin (
00112 int RootMargin
00113 ) { m_RootMargin = RootMargin; }
00114
00118 void SetRootSpacing (
00119 int RootSpacing
00120 ) { m_RootSpacing = RootSpacing; }
00121
00125 void SetStyle (
00126 DLGSTYLE style
00127 ) { m_Style = style; }
00128
00129
00130
00138 virtual void v_OnCancel ();
00139
00140 private:
00141 #ifndef GENERATING_DOXYGEN_OUTPUT
00142 typedef DLGWIZARD THISCLASS;
00143
00144 DLGSTYLE m_Style;
00145 ERRVALUE m_RetValue;
00146 int m_RootSpacing;
00147 int m_RootMargin;
00148
00149 SIMPLE_ARRAY<LAYOUT_WIZARD_PAGE*> m_PagePtrs;
00150 int m_ActiveIndex;
00151 LAYOUT_PANE m_ButtonPane;
00152 CTRL_PUSHBUTTON m_BtnBack;
00153 CTRL_PUSHBUTTON m_BtnNext;
00154 CTRL_PUSHBUTTON m_BtnFinish;
00155 CTRL_PUSHBUTTON m_BtnCancel;
00156 CTRL_PUSHBUTTON m_BtnHelp;
00157
00159 void Close (bool notify = true);
00160
00161 ERRVALUE CreateDlg (
00162 MDLGPARENT dlgparent
00163 );
00164
00165 void OnCmdBack ();
00166 void OnCmdFinish ();
00167 void OnCmdNext ();
00168
00169 DLGWIZARD (const DLGWIZARD&);
00170 DLGWIZARD& operator= (const DLGWIZARD&);
00171
00172
00173 void v_Destroy ();
00174 int v_CreateContent ();
00175 void v_OnCloseRequest ();
00176
00177 friend class LAYOUT_WIZARD_PAGE;
00178 #endif // GENERATING_DOXYGEN_OUTPUT
00179
00180
00181
00183 virtual void v_OnClose ();
00184
00186 virtual void v_OnDestroy ();
00187
00189 virtual void v_OnOpen ();
00190
00191 };
00192
00193 #ifndef GENERATING_DOXYGEN_OUTPUT
00194 DEFINE_ENUM_OP_BITWISE(DLGWIZARD::DLGSTYLE)
00195 DEFINE_ENUM_OP_BITWISE(DLGWIZARD::BTNFLAGS)
00196 #endif
00197
00198
00199 class LAYOUT_WIZARD_PAGE : public MGUI::LAYOUT_PANE_ROOT {
00200 public:
00201
00202 enum PAGE {
00203 PAGE_Same = -2,
00204 PAGE_Next = -1,
00205 PAGE_Back = PAGE_Next
00206 };
00207
00209 LAYOUT_WIZARD_PAGE (
00210 );
00211
00213 virtual ~LAYOUT_WIZARD_PAGE (
00214 );
00215
00218 int Create (
00219 MGUI::DLGWIZARD& wizard,
00220 MGUI::LAYOUT_ORIENTATION orientation = MGUI::LAYOUT_ORIENTATION_Vertical
00221 );
00222
00225 int GetPageIndex (
00226 ) const { return (m_index); }
00227
00229 bool IsActive (
00230 ) const;
00231
00233 void SetEnabled (
00234 bool enabled = true
00235 );
00236
00238 void SetNextEnabled (
00239 bool enabled,
00240 bool ForceToFinish = false
00241 );
00242
00243 protected:
00244
00247 void SetIgnoreNonVisible (
00248 bool IgnoreNonVisible = true
00249 ) { m_IgnoreNonVisible = IgnoreNonVisible; }
00250
00254 void SetNoSpaceExpanding (
00255 bool NoSpaceExpanding = true
00256 ) { m_NoSpaceExpanding = NoSpaceExpanding; }
00257
00265 virtual void v_OnWizardFinish ();
00266
00267 private:
00268 #ifndef GENERATING_DOXYGEN_OUTPUT
00269
00270 DLGWIZARD *m_pWizard;
00271 MGUI::LAYOUT_ORIENTATION m_Orientation;
00272 int m_index;
00273 bool m_IgnoreNonVisible;
00274 bool m_NoSpaceExpanding;
00275
00276 LAYOUT_WIZARD_PAGE (const LAYOUT_WIZARD_PAGE&);
00277 LAYOUT_WIZARD_PAGE& operator= (const LAYOUT_WIZARD_PAGE&);
00278
00279 void InitPageX (Widget form);
00280
00281 friend class DLGWIZARD;
00282 #endif // GENERATING_DOXYGEN_OUTPUT
00283
00284
00285
00288 virtual void v_OnInitPage () = 0;
00289
00291 virtual void v_OnSetActive ();
00292
00294 virtual void v_OnSetInactive ();
00295
00300 virtual int v_OnWizardBack ();
00301
00306 virtual int v_OnWizardNext ();
00307
00308 };
00309
00310
00311 }
00312
00313
00314 #endif // INC_MGUI_DLGWIZARD_H