fix a bug for bitmap changing in wxWizard (patch 474975)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12268 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2001-11-02 17:30:42 +00:00
parent f80bf90194
commit 7cc5041d03

View File

@ -264,9 +264,19 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward)
// button or not (initially the label is "Next") // button or not (initially the label is "Next")
bool btnLabelWasNext = TRUE; bool btnLabelWasNext = TRUE;
// and this tells us whether we already had the default bitmap before // Modified 10-20-2001 Robert Cavanaugh.
int bmpWasDefault; // 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 PreviousBitmap = wxNullBitmap;
wxBitmap ThisBitmap = wxNullBitmap;
// check for previous page
if ( m_page ) if ( m_page )
{ {
// send the event to the old page // send the event to the old page
@ -281,15 +291,15 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward)
m_page->Hide(); m_page->Hide();
btnLabelWasNext = m_page->GetNext() != (wxWizardPage *)NULL; btnLabelWasNext = m_page->GetNext() != (wxWizardPage *)NULL;
bmpWasDefault = !m_page->GetBitmap().Ok();
} // Get the bitmap of the previous page (if it exists)
else // no previous page if(m_page->GetBitmap().Ok())
{ {
// always set the bitmap PreviousBitmap = m_page->GetBitmap();
bmpWasDefault = -1; }
} }
// set the new one // set the new page
m_page = page; m_page = page;
// is this the end? // is this the end?
@ -297,11 +307,10 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward)
{ {
// terminate successfully // terminate successfully
EndModal(wxID_OK); EndModal(wxID_OK);
return TRUE; return TRUE;
} }
// send the event to the new page now // send the change event to the new page now
wxWizardEvent event(wxEVT_WIZARD_PAGE_CHANGED, GetId(), goingForward); wxWizardEvent event(wxEVT_WIZARD_PAGE_CHANGED, GetId(), goingForward);
(void)m_page->GetEventHandler()->ProcessEvent(event); (void)m_page->GetEventHandler()->ProcessEvent(event);
@ -310,9 +319,19 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward)
m_page->SetSize(m_x, m_y, m_width, m_height); m_page->SetSize(m_x, m_y, m_width, m_height);
m_page->Show(); m_page->Show();
// change the bitmap if necessary (and if we have it at all) // check if bitmap needs to be updated
int bmpIsDefault = !m_page->GetBitmap().Ok(); // update default flag as well
if ( m_statbmp && (bmpIsDefault != bmpWasDefault) ) if(m_page->GetBitmap().Ok())
{
ThisBitmap = m_page->GetBitmap();
bmpIsDefault = FALSE;
}
// 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 && (ThisBitmap != PreviousBitmap) )
{ {
wxBitmap bmp; wxBitmap bmp;
if ( bmpIsDefault ) if ( bmpIsDefault )