X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2e4df4bfaf214faac6d4c7519f4aab5b8c7fd287..758bce950ba9236d0a9edc4c880c3ec73b5173f3:/src/generic/wizard.cpp?ds=sidebyside diff --git a/src/generic/wizard.cpp b/src/generic/wizard.cpp index 65360bcda5..a81c20a7aa 100644 --- a/src/generic/wizard.cpp +++ b/src/generic/wizard.cpp @@ -28,6 +28,8 @@ #pragma hdrstop #endif +#if wxUSE_WIZARDDLG + #ifndef WX_PRECOMP #include "wx/dynarray.h" #include "wx/intl.h" @@ -95,20 +97,29 @@ wxWizardPage *wxWizardPageSimple::GetNext() const // generic wxWizard implementation // ---------------------------------------------------------------------------- -wxWizard::wxWizard(wxWindow *parent, +void wxWizard::Init() +{ + m_posWizard = wxDefaultPosition; + m_page = (wxWizardPage *)NULL; + m_btnPrev = m_btnNext = NULL; + m_statbmp = NULL; +} + +bool wxWizard::Create(wxWindow *parent, int id, const wxString& title, const wxBitmap& bitmap, const wxPoint& pos) - : m_posWizard(pos), m_bitmap(bitmap) { + m_posWizard = pos; + m_bitmap = bitmap ; // just create the dialog itself here, the controls will be created in // DoCreateControls() called later when we know our final size m_page = (wxWizardPage *)NULL; m_btnPrev = m_btnNext = NULL; m_statbmp = NULL; - (void)wxDialog::Create(parent, id, title, pos); + return wxDialog::Create(parent, id, title, pos); } void wxWizard::DoCreateControls() @@ -187,13 +198,24 @@ void wxWizard::DoCreateControls() x = m_x + m_width - 3*sizeBtn.x - BUTTON_MARGIN; y += SEPARATOR_LINE_MARGIN; + + if (GetExtraStyle() & wxWIZARD_EX_HELPBUTTON) + { + x -= sizeBtn.x; + x -= BUTTON_MARGIN ; + + (void)new wxButton(this, wxID_HELP, _("&Help"), wxPoint(x, y), sizeBtn); + x += sizeBtn.x; + x += BUTTON_MARGIN ; + } + m_btnPrev = new wxButton(this, wxID_BACKWARD, _("< &Back"), wxPoint(x, y), sizeBtn); x += sizeBtn.x; m_btnNext = new wxButton(this, wxID_FORWARD, _("&Next >"), wxPoint(x, y), sizeBtn); x += sizeBtn.x + BUTTON_MARGIN; - (void)new wxButton(this, wxID_CANCEL, _("Cancel"), wxPoint(x, y), sizeBtn); + (void)new wxButton(this, wxID_CANCEL, _("&Cancel"), wxPoint(x, y), sizeBtn); // position and size the dialog // ---------------------------- @@ -225,7 +247,7 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward) bool btnLabelWasNext = TRUE; // and this tells us whether we already had the default bitmap before - bool bmpWasDefault = TRUE; + int bmpWasDefault; if ( m_page ) { @@ -243,6 +265,11 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward) btnLabelWasNext = m_page->GetNext() != (wxWizardPage *)NULL; bmpWasDefault = !m_page->GetBitmap().Ok(); } + else // no previous page + { + // always set the bitmap + bmpWasDefault = -1; + } // set the new one m_page = page; @@ -266,7 +293,7 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward) m_page->Show(); // change the bitmap if necessary (and if we have it at all) - bool bmpIsDefault = !m_page->GetBitmap().Ok(); + int bmpIsDefault = !m_page->GetBitmap().Ok(); if ( m_statbmp && (bmpIsDefault != bmpWasDefault) ) { wxBitmap bmp; @@ -393,3 +420,4 @@ wxWizardEvent::wxWizardEvent(wxEventType type, int id, bool direction) m_direction = direction; } +#endif // wxUSE_WIZARDDLG