1
//--------------------------------------------------------------------------------------
2
// LenMus Phonascus: The teacher of music
3
// Copyright (c) 2002-2010 LenMus project
5
// This program is free software; you can redistribute it and/or modify it under the
6
// terms of the GNU General Public License as published by the Free Software Foundation,
7
// either version 3 of the License, or (at your option) any later version.
9
// This program is distributed in the hope that it will be useful, but WITHOUT ANY
10
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11
// PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
// You should have received a copy of the GNU General Public License along with this
14
// program. If not, see <http://www.gnu.org/licenses/>.
16
// For any comment, suggestion or feature request, please contact the manager of
17
// the project at cecilios@users.sourceforge.net
19
//-------------------------------------------------------------------------------------
21
#ifndef __LM_WIZARD_H__ //to avoid nested includes
22
#define __LM_WIZARD_H__
24
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
25
#pragma interface "Wizard.cpp"
30
#include <wx/wizard.h>
35
//-----------------------------------------------------------------------------
37
//-----------------------------------------------------------------------------
39
class lmWizardPage : public wxWizardPageSimple
42
lmWizardPage() : wxWizardPageSimple(), m_fOptional(false) {}
43
lmWizardPage(wxWizard *parent);
45
inline bool IsOptional() { return m_fOptional; }
46
inline void SetOptional(bool fValue) { m_fOptional = fValue; }
48
virtual void OnEnterPage() {}
50
wxWizard* GetParentWizard() { return m_pParent; }
59
//-----------------------------------------------------------------------------------
60
// lmWizard: A wizard with optional pages
61
//-----------------------------------------------------------------------------------
63
class lmWizard : public wxDialog
66
lmWizard(wxWindow *parent, int id = wxID_ANY, const wxString& title = wxEmptyString,
67
const wxPoint& pos = wxDefaultPosition,
68
const wxSize& size = wxDefaultSize,
69
long style = wxDEFAULT_DIALOG_STYLE);
73
void AddPage(lmWizardPage* pPage, bool fOptional=false);
77
virtual bool HasNextPage(lmWizardPage* page)
78
{ return page->GetNext() != NULL; }
80
virtual bool HasPrevPage(lmWizardPage* page)
81
{ return page->GetPrev() != NULL; }
83
virtual bool IsOptional(lmWizardPage* page)
84
{ return ((lmWizardPage*)page)->IsOptional(); }
87
void EnableButtonNext(bool fEnable);
88
void EnableButtonPrev(bool fEnable);
92
void CreateControls();
97
void OnCancel(wxCommandEvent& event);
98
void OnPageButton(wxCommandEvent& event);
99
void OnHelp(wxCommandEvent& event);
101
void OnWizardEvent(wxWizardEvent& event);
103
// show the prev/next page, but call TransferDataFromWindow on the current
104
// page first and return false without changing the page if
105
// TransferDataFromWindow() returns false - otherwise, returns true
106
bool ShowPage(lmWizardPage* pPage, bool fGoingFwd = true);
110
wxBoxSizer* m_pWindowSizer; //sizer item for page panel
111
wxPoint m_posWizard; //dialog position from the ctor
114
lmWizardPage* m_pCurPage; //current page or NULL
117
wxButton* m_pBtnPrev; //"<Back" button
118
wxButton* m_pBtnNext; //"Next>" button
119
wxButton* m_pBtnFinish; //"Finish" button
121
lmWizardPage* m_pFirstPage;
122
lmWizardPage* m_pLastPage;
124
DECLARE_EVENT_TABLE()
128
#endif // __LM_WIZARD_H__