+bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward)
+{
+ wxASSERT_MSG( page != m_page, wxT("this is useless") );
+
+ // we'll use this to decide whether we have to change the label of this
+ // button or not (initially the label is "Next")
+ bool btnLabelWasNext = true;
+
+ // Modified 10-20-2001 Robert Cavanaugh.
+ // Fixed bug for displaying a new bitmap
+ // in each *consecutive* page
+
+ // flag to indicate if this page uses a new bitmap
+ bool bmpIsDefault = true;
+
+ // use these labels to determine if we need to change the bitmap
+ // for this page
+ wxBitmap bmpPrev, bmpCur;
+
+ // check for previous page
+ if ( m_page )
+ {
+ // send the event to the old page
+ wxWizardEvent event(wxEVT_WIZARD_PAGE_CHANGING, GetId(), goingForward, m_page);
+ if ( m_page->GetEventHandler()->ProcessEvent(event) &&
+ !event.IsAllowed() )
+ {
+ // vetoed by the page
+ return false;
+ }
+
+ m_page->Hide();
+
+ btnLabelWasNext = HasNextPage(m_page);
+
+ // Get the bitmap of the previous page (if it exists)
+ if ( m_page->GetBitmap().Ok() )
+ {
+ bmpPrev = m_page->GetBitmap();
+ }
+ }
+
+ // set the new page
+ m_page = page;
+
+ // is this the end?
+ if ( !m_page )
+ {
+ // terminate successfully
+ EndModal(wxID_OK);
+
+ // and notify the user code (this is especially useful for modeless
+ // wizards)
+ wxWizardEvent event(wxEVT_WIZARD_FINISHED, GetId(), false, 0);
+ (void)GetEventHandler()->ProcessEvent(event);
+
+ return true;
+ }
+
+ // position and show the new page
+ (void)m_page->TransferDataToWindow();
+
+ // wxWizardSizer::RecalcSizes wants to be called when m_page changes
+ m_sizerPage->RecalcSizes();
+
+ // check if bitmap needs to be updated
+ // update default flag as well
+ if ( m_page->GetBitmap().Ok() )
+ {
+ bmpCur = m_page->GetBitmap();
+ bmpIsDefault = false;
+ }
+
+#if wxUSE_STATBMP
+ // change the bitmap if:
+ // 1) a default bitmap was selected in constructor
+ // 2) this page was constructed with a bitmap
+ // 3) this bitmap is not the previous bitmap
+ if ( m_statbmp && (bmpCur != bmpPrev) )
+ {
+ wxBitmap bmp;
+ if ( bmpIsDefault )
+ bmp = m_bitmap;
+ else
+ bmp = m_page->GetBitmap();
+ m_statbmp->SetBitmap(bmp);
+ }
+#endif
+
+ // and update the buttons state
+ m_btnPrev->Enable(HasPrevPage(m_page));
+
+ bool hasNext = HasNextPage(m_page);
+ if ( btnLabelWasNext != hasNext )
+ {
+ // need to update
+ if (btnLabelWasNext)
+ m_btnNext->SetLabel(_("&Finish"));
+ else
+ m_btnNext->SetLabel(_("&Next >"));
+ }
+ m_btnNext->SetDefault();
+ // nothing to do: the label was already correct
+
+ // send the change event to the new page now
+ wxWizardEvent event(wxEVT_WIZARD_PAGE_CHANGED, GetId(), goingForward, m_page);
+ (void)m_page->GetEventHandler()->ProcessEvent(event);
+
+ // and finally show it
+ m_page->Show();
+ m_page->SetFocus();
+
+ return true;