+ if ( m_usingSizer )
+ {
+ m_sizerBmpAndPage->Add(m_sizerPage, flags);
+
+ // now that our layout is computed correctly, hide the pages
+ // artificially shown in wxWizardSizer::Insert() back again
+ m_sizerPage->HidePages();
+ }
+ }
+
+
+ // 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;
+
+ // remember the old bitmap (if any) to compare with the new one later
+ wxBitmap bmpPrev;
+
+ // 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);
+
+ bmpPrev = m_page->GetBitmap();
+
+ if ( !m_usingSizer )
+ m_sizerBmpAndPage->Detach(m_page);
+ }
+
+ // set the new page
+ m_page = page;
+
+ // is this the end?
+ if ( !m_page )
+ {
+ // terminate successfully
+ if ( IsModal() )
+ {
+ EndModal(wxID_OK);
+ }
+ else
+ {
+ SetReturnCode(wxID_OK);
+ Hide();
+ }
+
+ // 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();
+
+ if ( m_usingSizer )
+ {
+ // wxWizardSizer::RecalcSizes wants to be called when m_page changes
+ m_sizerPage->RecalcSizes();
+ }
+ else // pages are not managed by the sizer
+ {
+ m_sizerBmpAndPage->Add(m_page, flags);
+ m_sizerBmpAndPage->SetItemMinSize(m_page, GetPageSize());
+ }
+
+#if wxUSE_STATBMP
+ // update the bitmap if:it changed
+ if ( m_statbmp )
+ {
+ wxBitmap bmp = m_page->GetBitmap();
+ if ( !bmp.Ok() )
+ bmp = m_bitmap;
+
+ if ( !bmpPrev.Ok() )
+ bmpPrev = m_bitmap;
+
+ if ( !bmp.IsSameAs(bmpPrev) )
+ m_statbmp->SetBitmap(bmp);
+ }
+#endif // wxUSE_STATBMP
+
+
+ // and update the buttons state
+ m_btnPrev->Enable(HasPrevPage(m_page));
+
+ bool hasNext = HasNextPage(m_page);
+ if ( btnLabelWasNext != hasNext )
+ {
+ if ( hasNext )
+ m_btnNext->SetLabel(_("&Next >"));
+ else
+ m_btnNext->SetLabel(_("&Finish"));
+ }
+ // nothing to do: the label was already correct
+
+ m_btnNext->SetDefault();
+
+
+ // 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();
+
+ if ( !m_usingSizer )
+ m_sizerBmpAndPage->Layout();
+
+ if ( !m_started )
+ {
+ m_started = true;
+
+ if ( wxSystemSettings::GetScreenType() > wxSYS_SCREEN_PDA )
+ {
+ GetSizer()->SetSizeHints(this);
+ if ( m_posWizard == wxDefaultPosition )
+ CentreOnScreen();
+ }