1999-09-29 18:47:56 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2005-09-26 09:30:54 -04:00
|
|
|
// Name: wx/generic/wizard.h
|
1999-09-29 18:47:56 -04:00
|
|
|
// Purpose: declaration of generic wxWizard class
|
|
|
|
// Author: Vadim Zeitlin
|
2003-07-20 16:48:52 -04:00
|
|
|
// Modified by: Robert Vazan (sizers)
|
1999-09-29 18:47:56 -04:00
|
|
|
// Created: 28.09.99
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) 1999 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1999-09-29 18:47:56 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2005-09-25 16:49:40 -04:00
|
|
|
#ifndef _WX_GENERIC_WIZARD_H_
|
|
|
|
#define _WX_GENERIC_WIZARD_H_
|
|
|
|
|
1999-09-29 18:47:56 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxWizard
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2007-07-09 06:09:52 -04:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxButton;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxStaticBitmap;
|
|
|
|
class WXDLLIMPEXP_FWD_ADV wxWizardEvent;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxBoxSizer;
|
|
|
|
class WXDLLIMPEXP_FWD_ADV wxWizardSizer;
|
2000-01-20 21:26:25 -05:00
|
|
|
|
2003-08-01 21:04:55 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxWizard : public wxWizardBase
|
1999-09-29 18:47:56 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// ctor
|
2001-08-17 05:38:19 -04:00
|
|
|
wxWizard() { Init(); }
|
|
|
|
wxWizard(wxWindow *parent,
|
2004-06-17 12:22:36 -04:00
|
|
|
int id = wxID_ANY,
|
2001-08-17 05:38:19 -04:00
|
|
|
const wxString& title = wxEmptyString,
|
|
|
|
const wxBitmap& bitmap = wxNullBitmap,
|
2003-07-20 16:48:52 -04:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
long style = wxDEFAULT_DIALOG_STYLE)
|
2001-08-17 05:38:19 -04:00
|
|
|
{
|
|
|
|
Init();
|
2003-07-20 16:48:52 -04:00
|
|
|
Create(parent, id, title, bitmap, pos, style);
|
2001-08-17 05:38:19 -04:00
|
|
|
}
|
|
|
|
bool Create(wxWindow *parent,
|
2004-06-17 12:22:36 -04:00
|
|
|
int id = wxID_ANY,
|
1999-09-29 18:47:56 -04:00
|
|
|
const wxString& title = wxEmptyString,
|
|
|
|
const wxBitmap& bitmap = wxNullBitmap,
|
2003-07-20 16:48:52 -04:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
long style = wxDEFAULT_DIALOG_STYLE);
|
2001-08-17 05:38:19 -04:00
|
|
|
void Init();
|
2007-04-30 15:43:28 -04:00
|
|
|
virtual ~wxWizard();
|
1999-09-29 18:47:56 -04:00
|
|
|
|
|
|
|
// implement base class pure virtuals
|
|
|
|
virtual bool RunWizard(wxWizardPage *firstPage);
|
|
|
|
virtual wxWizardPage *GetCurrentPage() const;
|
2000-07-15 15:51:35 -04:00
|
|
|
virtual void SetPageSize(const wxSize& size);
|
1999-11-13 21:22:27 -05:00
|
|
|
virtual wxSize GetPageSize() const;
|
2002-06-21 17:49:28 -04:00
|
|
|
virtual void FitToPage(const wxWizardPage *firstPage);
|
2003-07-20 16:48:52 -04:00
|
|
|
virtual wxSizer *GetPageAreaSizer() const;
|
|
|
|
virtual void SetBorder(int border);
|
1999-09-29 18:47:56 -04:00
|
|
|
|
2007-07-02 04:00:48 -04:00
|
|
|
/// set/get bitmap
|
|
|
|
const wxBitmap& GetBitmap() const { return m_bitmap; }
|
|
|
|
void SetBitmap(const wxBitmap& bitmap);
|
|
|
|
|
1999-09-29 18:47:56 -04:00
|
|
|
// implementation only from now on
|
|
|
|
// -------------------------------
|
|
|
|
|
|
|
|
// is the wizard running?
|
|
|
|
bool IsRunning() const { return m_page != NULL; }
|
|
|
|
|
|
|
|
// show the prev/next page, but call TransferDataFromWindow on the current
|
2004-06-17 12:22:36 -04:00
|
|
|
// page first and return false without changing the page if
|
|
|
|
// TransferDataFromWindow() returns false - otherwise, returns true
|
2007-12-29 11:35:39 -05:00
|
|
|
virtual bool ShowPage(wxWizardPage *page, bool goingForward = true);
|
1999-09-29 18:47:56 -04:00
|
|
|
|
2001-08-17 05:38:19 -04:00
|
|
|
// do fill the dialog with controls
|
|
|
|
// this is app-overridable to, for example, set help and tooltip text
|
2002-07-12 10:43:58 -04:00
|
|
|
virtual void DoCreateControls();
|
2001-08-17 05:38:19 -04:00
|
|
|
|
2007-12-29 11:35:39 -05:00
|
|
|
// Do the adaptation
|
|
|
|
virtual bool DoLayoutAdaptation();
|
|
|
|
|
|
|
|
// Set/get bitmap background colour
|
|
|
|
void SetBitmapBackgroundColour(const wxColour& colour) { m_bitmapBackgroundColour = colour; }
|
|
|
|
const wxColour& GetBitmapBackgroundColour() const { return m_bitmapBackgroundColour; }
|
|
|
|
|
|
|
|
// Set/get bitmap placement (centred, tiled etc.)
|
|
|
|
void SetBitmapPlacement(int placement) { m_bitmapPlacement = placement; }
|
|
|
|
int GetBitmapPlacement() const { return m_bitmapPlacement; }
|
|
|
|
|
|
|
|
// Set/get minimum bitmap width
|
|
|
|
void SetMinimumBitmapWidth(int w) { m_bitmapMinimumWidth = w; }
|
|
|
|
int GetMinimumBitmapWidth() const { return m_bitmapMinimumWidth; }
|
|
|
|
|
|
|
|
// Tile bitmap
|
|
|
|
static bool TileBitmap(const wxRect& rect, wxDC& dc, const wxBitmap& bitmap);
|
|
|
|
|
2005-09-25 16:23:30 -04:00
|
|
|
protected:
|
2006-05-28 10:19:18 -04:00
|
|
|
// for compatibility only, doesn't do anything any more
|
|
|
|
void FinishLayout() { }
|
2005-09-25 16:23:30 -04:00
|
|
|
|
2007-12-29 11:35:39 -05:00
|
|
|
// Do fit, and adjust to screen size if necessary
|
|
|
|
virtual void DoWizardLayout();
|
|
|
|
|
|
|
|
// Resize bitmap if necessary
|
|
|
|
virtual bool ResizeBitmap(wxBitmap& bmp);
|
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
// was the dialog really created?
|
|
|
|
bool WasCreated() const { return m_btnPrev != NULL; }
|
|
|
|
|
1999-09-29 18:47:56 -04:00
|
|
|
// event handlers
|
|
|
|
void OnCancel(wxCommandEvent& event);
|
|
|
|
void OnBackOrNext(wxCommandEvent& event);
|
2001-11-02 12:29:38 -05:00
|
|
|
void OnHelp(wxCommandEvent& event);
|
1999-09-29 18:47:56 -04:00
|
|
|
|
2002-05-22 19:36:20 -04:00
|
|
|
void OnWizEvent(wxWizardEvent& event);
|
|
|
|
|
2003-07-20 16:48:52 -04:00
|
|
|
void AddBitmapRow(wxBoxSizer *mainColumn);
|
|
|
|
void AddStaticLine(wxBoxSizer *mainColumn);
|
|
|
|
void AddBackNextPair(wxBoxSizer *buttonRow);
|
|
|
|
void AddButtonRow(wxBoxSizer *mainColumn);
|
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
// the page size requested by user
|
|
|
|
wxSize m_sizePage;
|
|
|
|
|
|
|
|
// the dialog position from the ctor
|
|
|
|
wxPoint m_posWizard;
|
|
|
|
|
1999-09-29 18:47:56 -04:00
|
|
|
// wizard state
|
|
|
|
wxWizardPage *m_page; // the current page or NULL
|
2000-01-20 21:26:25 -05:00
|
|
|
wxBitmap m_bitmap; // the default bitmap to show
|
1999-09-29 18:47:56 -04:00
|
|
|
|
|
|
|
// wizard controls
|
|
|
|
wxButton *m_btnPrev, // the "<Back" button
|
|
|
|
*m_btnNext; // the "Next>" or "Finish" button
|
2000-01-20 21:26:25 -05:00
|
|
|
wxStaticBitmap *m_statbmp; // the control for the bitmap
|
1999-09-29 18:47:56 -04:00
|
|
|
|
2003-07-20 16:48:52 -04:00
|
|
|
// Border around page area sizer requested using SetBorder()
|
|
|
|
int m_border;
|
2004-06-17 12:22:36 -04:00
|
|
|
|
2003-07-20 16:48:52 -04:00
|
|
|
// Whether RunWizard() was called
|
|
|
|
bool m_started;
|
2004-06-17 12:22:36 -04:00
|
|
|
|
2005-09-26 09:30:54 -04:00
|
|
|
// Whether was modal (modeless has to be destroyed on finish or cancel)
|
|
|
|
bool m_wasModal;
|
|
|
|
|
2006-05-28 10:19:18 -04:00
|
|
|
// True if pages are laid out using the sizer
|
|
|
|
bool m_usingSizer;
|
|
|
|
|
2003-07-20 16:48:52 -04:00
|
|
|
// Page area sizer will be inserted here with padding
|
|
|
|
wxBoxSizer *m_sizerBmpAndPage;
|
2004-06-17 12:22:36 -04:00
|
|
|
|
2003-07-20 16:48:52 -04:00
|
|
|
// Actual position and size of pages
|
|
|
|
wxWizardSizer *m_sizerPage;
|
2004-06-17 12:22:36 -04:00
|
|
|
|
2007-12-29 11:35:39 -05:00
|
|
|
// Bitmap background colour if resizing bitmap
|
|
|
|
wxColour m_bitmapBackgroundColour;
|
|
|
|
|
|
|
|
// Bitmap placement flags
|
|
|
|
int m_bitmapPlacement;
|
|
|
|
|
|
|
|
// Minimum bitmap width
|
|
|
|
int m_bitmapMinimumWidth;
|
|
|
|
|
2003-07-20 16:48:52 -04:00
|
|
|
friend class wxWizardSizer;
|
2004-06-17 12:22:36 -04:00
|
|
|
|
1999-09-29 18:47:56 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxWizard)
|
|
|
|
DECLARE_EVENT_TABLE()
|
2003-01-02 18:38:11 -05:00
|
|
|
DECLARE_NO_COPY_CLASS(wxWizard)
|
1999-09-29 18:47:56 -04:00
|
|
|
};
|
|
|
|
|
2005-09-25 16:49:40 -04:00
|
|
|
#endif // _WX_GENERIC_WIZARD_H_
|