From a0a48a3f0d4c0478177c4668ba8d4aab9ba9b426 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 2 Nov 2001 17:22:44 +0000 Subject: [PATCH] wxWizardPage may be loaded from resource (patch 470683) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12266 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + docs/latex/wx/wizpage.tex | 10 +++++++++- include/wx/wizard.h | 18 ++++++++++++------ src/generic/wizard.cpp | 21 ++++++++++++++++++--- 4 files changed, 40 insertions(+), 10 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index b95bf4162a..4575772d37 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -46,6 +46,7 @@ All (GUI): - wxStreamToTextRedirector to allow easily redirect cout to wxTextCtrl added - fixed bug with using wxExecute() to capture huge amounts of output - new wxCalendarCtrl styles added (Søren Erland Vestø) +- wxWizardPage can be loaded from WXR (Robert Cavanaugh) - wxDirSelector() added (Paul A. Thiessen) wxHTML: diff --git a/docs/latex/wx/wizpage.tex b/docs/latex/wx/wizpage.tex index b7a89640bf..e26ff44198 100644 --- a/docs/latex/wx/wizpage.tex +++ b/docs/latex/wx/wizpage.tex @@ -50,13 +50,21 @@ should be very rarely needed. \membersection{wxWizardPage::wxWizardPage}\label{wxwizardpagewxwizardpage} -\func{}{wxWizardPage}{\param{wxWizard* }{parent}, \param{const wxBitmap\& }{bitmap = wxNullBitmap}} +\func{}{wxWizardPage}{\param{wxWizard* }{parent}, \param{const wxBitmap\& }{bitmap = wxNullBitmap}, \param{const wxChar }{*resource = NULL}} 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 be of the same size). Notice that no other parameters are needed because the wizard will resize and reposition the page anyhow. +\wxheading{Parameters} + +\docparam{parent}{The parent wizard} + +\docparam{bitmap}{The page-specific bitmap if different from the global one} + +\docparam{resource}{Load the page from the specified resource if non NULL} + \membersection{wxWizardPage::GetPrev}\label{wxwizardpagegetprev} \constfunc{wxWizardPage*}{GetPrev}{\void} diff --git a/include/wx/wizard.h b/include/wx/wizard.h index 3e36959f8d..65e7d18ec4 100644 --- a/include/wx/wizard.h +++ b/include/wx/wizard.h @@ -4,7 +4,9 @@ // 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: +// Modified by: Robert Cavanaugh +// Added capability to use .WXR resource files in Wizard pages +// Added wxWIZARD_HELP event // Created: 15.08.99 // RCS-ID: $Id$ // Copyright: (c) 1999 Vadim Zeitlin @@ -48,7 +50,9 @@ public: // of the default one for this wizard (should be of the same size). Notice // that no other parameters are needed because the wizard will resize and // reposition the page anyhow - wxWizardPage(wxWizard *parent, const wxBitmap& bitmap = wxNullBitmap); + wxWizardPage(wxWizard *parent, + const wxBitmap& bitmap = wxNullBitmap, + const wxChar* resource = NULL); // these functions are used by the wizard to show another page when the // user chooses "Back" or "Next" button @@ -59,10 +63,10 @@ public: // cases - override this method if you want to create the bitmap to be used // dynamically or to do something even more fancy. It's ok to return // wxNullBitmap from here - the default one will be used then. - virtual wxBitmap GetBitmap() const { return m_bitmap; } + virtual wxBitmap GetBitmap() const { return m_PageBitmap; } protected: - wxBitmap m_bitmap; + wxBitmap m_PageBitmap; private: DECLARE_ABSTRACT_CLASS(wxWizardPage) @@ -83,8 +87,10 @@ public: // ctor takes the previous and next pages wxWizardPageSimple(wxWizard *parent = NULL, // let it be default ctor too wxWizardPage *prev = (wxWizardPage *)NULL, - wxWizardPage *next = (wxWizardPage *)NULL) - : wxWizardPage(parent) + wxWizardPage *next = (wxWizardPage *)NULL, + const wxBitmap& bitmap = wxNullBitmap, + const wxChar* resource = NULL) + : wxWizardPage(parent, bitmap, resource) { m_prev = prev; m_next = next; diff --git a/src/generic/wizard.cpp b/src/generic/wizard.cpp index a81c20a7aa..fba5373b09 100644 --- a/src/generic/wizard.cpp +++ b/src/generic/wizard.cpp @@ -2,7 +2,10 @@ // Name: generic/wizard.cpp // Purpose: generic implementation of wxWizard class // Author: Vadim Zeitlin -// Modified by: +// Modified by: Robert Cavanaugh +// 1) Added capability for wxWizardPage to accept resources +// 2) Added "Help" button handler stub +// 3) Fixed ShowPage() bug on displaying bitmaps // Created: 15.08.99 // RCS-ID: $Id$ // Copyright: (c) 1999 Vadim Zeitlin @@ -73,9 +76,21 @@ IMPLEMENT_DYNAMIC_CLASS(wxWizardEvent, wxNotifyEvent) // wxWizardPage // ---------------------------------------------------------------------------- -wxWizardPage::wxWizardPage(wxWizard *parent, const wxBitmap& bitmap) - : wxPanel(parent), m_bitmap(bitmap) +wxWizardPage::wxWizardPage(wxWizard *parent, + const wxBitmap& bitmap, + const wxChar *resource) + : wxPanel(parent) { + if ( resource != NULL ) + { + if ( !LoadFromResource(this, resource) ) + { + wxFAIL_MSG(wxT("wxWizardPage LoadFromResource failed!!!!")); + } + } + + m_PageBitmap = bitmap; + // initially the page is hidden, it's shown only when it becomes current Hide(); } -- 2.47.2