// Name: wizard.h
// Purpose: interface of wxWizardPage, wxWizardEvent,
// Author: wxWidgets team
-// RCS-ID: $Id$
-// Licence: wxWindows license
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
+
+// Extended style to specify a help button
+#define wxWIZARD_EX_HELPBUTTON 0x00000010
+
+// Bitmap placement flags
+#define wxWIZARD_VALIGN_TOP 0x01
+#define wxWIZARD_VALIGN_CENTRE 0x02
+#define wxWIZARD_VALIGN_BOTTOM 0x04
+#define wxWIZARD_HALIGN_LEFT 0x08
+#define wxWIZARD_HALIGN_CENTRE 0x10
+#define wxWIZARD_HALIGN_RIGHT 0x20
+#define wxWIZARD_TILE 0x40
+
+
/**
@class wxWizardPage
class wxWizardPage : public wxPanel
{
public:
+ /**
+ Default constructor.
+ */
+ wxWizardPage();
+
/**
Constructor accepts an optional bitmap which will be used for this page
instead of the default one for this wizard (note that all bitmaps used should
wxWizardPage(wxWizard* parent,
const wxBitmap& bitmap = wxNullBitmap);
+ /**
+ Creates the wizard page.
+ Must be called if the default constructor had been used to create the object.
+
+ @param parent
+ The parent wizard
+ @param bitmap
+ The page-specific bitmap if different from the global one
+ */
+ bool Create(wxWizard *parent,
+ const wxBitmap& bitmap = wxNullBitmap);
+
/**
This method is called by wxWizard to get the bitmap to display alongside the page.
By default, @c m_bitmap member variable which was set in the
The only cases when you would want to override this function is if the page
bitmap depends dynamically on the user choices, i.e. almost never.
*/
- wxBitmap GetBitmap() const;
+ virtual wxBitmap GetBitmap() const;
/**
Get the page which should be shown when the user chooses the @c "Next"
@see GetPrev()
*/
- wxWizardPage* GetNext() const;
+ virtual wxWizardPage* GetNext() const = 0;
/**
Get the page which should be shown when the user chooses the @c "Back"
@see GetNext()
*/
- wxWizardPage* GetPrev() const;
+ virtual wxWizardPage* GetPrev() const = 0;
};
@beginEventTable{wxWizardEvent}
@event{EVT_WIZARD_PAGE_CHANGED(id, func)}
- The page has been just changed (this event can not be vetoed).
+ The page has been just changed (this event cannot be vetoed).
@event{EVT_WIZARD_PAGE_CHANGING(id, func)}
The page is being changed (this event can be vetoed).
+ @event{EVT_WIZARD_BEFORE_PAGE_CHANGED(id, func)}
+ Called after Next is clicked but before GetNext is called. Unlike EVT_WIZARD_CHANGING,
+ the handler for this function can change state that might affect the return value of
+ GetNext. This event can be vetoed.
+ @event{EVT_WIZARD_PAGE_SHOWN(id, func)}
+ The page was shown and laid out (this event cannot be vetoed).
@event{EVT_WIZARD_CANCEL(id, func)}
The user attempted to cancel the wizard (this event may also be vetoed).
@event{EVT_WIZARD_HELP(id, func)}
It is not normally used by the user code as the objects of this
type are constructed by wxWizard.
*/
- wxWizardEvent(wxEventType type = wxEVT_NULL, int id = -1,
- bool direction = true);
+ wxWizardEvent(wxEventType type = wxEVT_NULL, int id = wxID_ANY,
+ bool direction = true, wxWizardPage* page = 0);
/**
Return the direction in which the page is changing: for
};
+wxEventType wxEVT_WIZARD_PAGE_CHANGED;
+wxEventType wxEVT_WIZARD_PAGE_CHANGING;
+wxEventType wxEVT_WIZARD_CANCEL;
+wxEventType wxEVT_WIZARD_HELP;
+wxEventType wxEVT_WIZARD_FINISHED;
+wxEventType wxEVT_WIZARD_PAGE_SHOWN;
+wxEventType wxEVT_WIZARD_BEFORE_PAGE_CHANGED;
+
/**
@class wxWizardPageSimple
class wxWizardPageSimple : public wxWizardPage
{
public:
+ /**
+ Default constructor.
+ */
+ wxWizardPageSimple();
+
/**
Constructor takes the previous and next pages.
They may be modified later by SetPrev() or SetNext().
*/
- wxWizardPageSimple(wxWizard* parent = NULL,
+ wxWizardPageSimple(wxWizard* parent,
wxWizardPage* prev = NULL,
wxWizardPage* next = NULL,
const wxBitmap& bitmap = wxNullBitmap);
+ /**
+ Creates the wizard page.
+ Must be called if the default constructor had been used to create the object.
+ */
+ bool Create(wxWizard *parent = NULL,
+ wxWizardPage *prev = NULL,
+ wxWizardPage *next = NULL,
+ const wxBitmap& bitmap = wxNullBitmap);
+
+ /**
+ A helper chaining this page with the next one.
+
+ Notice that this method returns a reference to the next page, so the
+ calls to it can, in turn, be chained:
+
+ @code
+ wxWizardPageSimple* firstPage = new FirstPage;
+ (*firstPage).Chain(new SecondPage)
+ .Chain(new ThirdPage)
+ .Chain(new LastPage);
+ @endcode
+
+ This makes this method the simplest way to define the order of changes
+ in fully static wizards, i.e. in those where the order doesn't depend
+ on the choices made by the user in the wizard pages during run-time.
+
+ @param next A non-@NULL pointer to the next page.
+ @return Reference to @a next on which Chain() can be called again.
+
+ @since 2.9.5
+ */
+ wxWizardPageSimple& Chain(wxWizardPageSimple* next);
+
/**
A convenience function to make the pages follow each other.
Example:
wxDialog::EnableLayoutAdaptation() or per dialog with wxDialog::SetLayoutAdaptationMode().
For more about layout adaptation, see @ref overview_dialog_autoscrolling.
- @beginEventTable{wxWizardEvent}
+ @beginEventEmissionTable{wxWizardEvent}
For some events, Veto() can be called to prevent the event from happening.
@event{EVT_WIZARD_PAGE_CHANGED(id, func)}
The page has just been changed (this event cannot be vetoed).
@event{EVT_WIZARD_PAGE_CHANGING(id, func)}
The page is being changed (this event can be vetoed).
+ @event{EVT_WIZARD_BEFORE_PAGE_CHANGED(id, func)}
+ Called after Next is clicked but before GetNext is called. Unlike EVT_WIZARD_CHANGING,
+ the handler for this function can change state that might affect the return value of
+ GetNext. This event can be vetoed.
+ @event{EVT_WIZARD_PAGE_SHOWN(id, func)}
+ The page was shown and laid out (this event cannot be vetoed).
@event{EVT_WIZARD_CANCEL(id, func)}
The user attempted to cancel the wizard (this event may also be vetoed).
@event{EVT_WIZARD_HELP(id, func)}
@param parent
The parent window, may be @NULL.
@param id
- The id of the dialog, will usually be just -1.
+ The id of the dialog, will usually be just wxID_ANY.
@param title
The title of the dialog.
@param bitmap
@param style
Window style is passed to wxDialog.
*/
- wxWizard(wxWindow* parent, int id = -1,
+ wxWizard(wxWindow* parent, int id = wxID_ANY,
const wxString& title = wxEmptyString,
const wxBitmap& bitmap = wxNullBitmap,
const wxPoint& pos = wxDefaultPosition,
@param style
Window style is passed to wxDialog.
*/
- bool Create(wxWindow* parent, int id = -1,
+ bool Create(wxWindow* parent, int id = wxID_ANY,
const wxString& title = wxEmptyString,
const wxBitmap& bitmap = wxNullBitmap,
- const wxPoint& pos = wxDefaultPosition,
- long style = wxDEFAULT_DIALOG_STYLE);
+ const wxPoint& pos = wxDefaultPosition, long style = wxDEFAULT_DIALOG_STYLE);
/**
This method is obsolete, use GetPageAreaSizer() instead.
run-time, as in this case, the wizard won't be able to get to all pages starting
from a single one and you should call @e Fit separately for the others.
*/
- void FitToPage(const wxWizardPage* firstPage);
+ virtual void FitToPage(const wxWizardPage* firstPage);
/**
Returns the bitmap used for the wizard.
See also SetBitmapPlacement() for the possible values.
*/
- int GetBitmapPlacement();
+ int GetBitmapPlacement() const;
/**
Get the current page while the wizard is running.
@NULL is returned if RunWizard() is not being executed now.
*/
- wxWizardPage* GetCurrentPage() const;
+ virtual wxWizardPage* GetCurrentPage() const;
/**
Returns the minimum width for the bitmap that will be constructed to contain
/**
Returns the size available for the pages.
*/
- wxSize GetPageSize() const;
+ virtual wxSize GetPageSize() const;
/**
Return @true if this page is not the last one in the wizard.
/**
Executes the wizard starting from the given page, returning @true if it was
successfully finished or @false if user cancelled it.
- The @a firstPage can not be @NULL.
+ The @a firstPage cannot be @NULL.
*/
- bool RunWizard(wxWizardPage* firstPage);
+ virtual bool RunWizard(wxWizardPage* firstPage);
/**
Sets the bitmap used for the wizard.
will be added to the control border in order to space page controls ten points
from the dialog border and non-page controls.
*/
- void SetBorder(int border);
+ virtual void SetBorder(int border);
/**
Sets the minimum width for the bitmap that will be constructed to contain the
Also, the wizard will never be smaller than the default size.
The recommended way to use this function is to lay out all wizard pages
- using the sizers (even though the wizard is not resizeable) and then use
+ using the sizers (even though the wizard is not resizable) and then use
wxSizer::CalcMin() in a loop to calculate the maximum of minimal sizes of
the pages and pass it to SetPageSize().
-
- @deprecated
- This method is obsolete, use GetPageAreaSizer() instead.
*/
- void SetPageSize(const wxSize& sizePage);
+ virtual void SetPageSize(const wxSize& sizePage);
};