wxWidgets/include/wx/wizard.h
Vadim Zeitlin b87654f3fd wxWizard added
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3418 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
1999-08-18 18:06:10 +00:00

98 lines
3.8 KiB
C++

///////////////////////////////////////////////////////////////////////////////
// Name: wizard.h
// Purpose: wxWizard class: a GUI control presenting the user with a
// sequence of dialogs which allows to simply perform some task
// Author: Vadim Zeitlin (partly based on work by Ron Kuris and Kevin B.
// Smith)
// Modified by:
// Created: 15.08.99
// RCS-ID: $Id$
// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
// Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_WIZARD_H_
#define _WX_WIZARD_H_
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#ifndef WX_PRECOMP
#include "wx/dialog.h" // the base class
#include "wx/event.h" // wxEVT_XXX constants
#endif // WX_PRECOMP
// ----------------------------------------------------------------------------
// wxWizard
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxWizard : public wxDialog
{
public:
// create the wizard control
static wxWizard *Create(wxWindow *parent,
int id = -1,
const wxString& title = wxEmptyString,
const wxBitmap& bitmap = wxNullBitmap,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize);
// wizard construction: add/insert new page into it
// adds a page at the end
virtual void AddPage(wxPanel *page) = 0;
// adds a page before the page nPage (the new page will have this index)
virtual void InsertPage(int nPage, wxPanel *page) = 0;
// executes the wizard, returns TRUE if it was successfully finished, FALSE
// if user cancelled it
virtual bool RunWizard() = 0;
// get the current page (NULL if RunWizard() isn't running)
virtual wxPanel *GetCurrentPage() const = 0;
private:
DECLARE_DYNAMIC_CLASS(wxWizard)
};
// ----------------------------------------------------------------------------
// wxWizardEvent class represents an event generated by the wizard
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxWizardEvent : public wxNotifyEvent
{
public:
wxWizardEvent(wxEventType type = wxEVT_NULL, int id = 0);
// get the previously active page or -1 if none
int GetOldPage() const { return m_pageOld; }
// get the current page or -1 if none
int GetPage() const { return m_page; }
private:
int m_pageOld, m_page;
DECLARE_DYNAMIC_CLASS(wxWizardEvent)
};
// ----------------------------------------------------------------------------
// macros for handling wxWizardEvents
// ----------------------------------------------------------------------------
typedef void (wxEvtHandler::*wxWizardEventFunction)(wxWizardEvent&);
// notifies that the page has just been changed
#define EVT_WIZARD_PAGE_CHANGED(id, fn) { wxEVT_WIZARD_PAGE_CHANGED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxWizardEventFunction) & fn, (wxObject *)NULL },
// the user pressed "<Back" or "Next>" button and the page is going to be
// changed - unless the event handler vetoes the event
#define EVT_WIZARD_PAGE_CHANGING(id, fn) { wxEVT_WIZARD_PAGE_CHANGING, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxWizardEventFunction) & fn, (wxObject *)NULL },
// the user pressed "Cancel" button and the wizard is going to be dismissed -
// unless the event handler vetoes the event
#define EVT_WIZARD_CANCEL(id, fn) { wxEVT_WIZARD_CANCEL, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxWizardEventFunction) & fn, (wxObject *)NULL },
#endif // _WX_WIZARD_H_