Fall back to the valid normal bitmap if no state-specific bitmap is set.

After the recent changes we could try to use an invalid bitmap in wxMSW toggle
button code as GetNormalState() could return State_Pressed and then we used
the bitmap for the pressed state unconditionally even if it wasn't set.

It seems more correct to always fall back to the normal bitmap as the pressed
state is already taken into account by GetButtonState().

This fixes unit test failures under MSW after the button classes refactoring.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67946 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-06-15 21:31:48 +00:00
parent 8770af492a
commit 42440b08ea

View File

@@ -1142,7 +1142,7 @@ bool wxAnyButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis)
{ {
wxBitmap bmp = m_imageData->GetBitmap(GetButtonState(this, state)); wxBitmap bmp = m_imageData->GetBitmap(GetButtonState(this, state));
if ( !bmp.IsOk() ) if ( !bmp.IsOk() )
bmp = m_imageData->GetBitmap(GetNormalState()); bmp = m_imageData->GetBitmap(State_Normal);
const wxSize sizeBmp = bmp.GetSize(); const wxSize sizeBmp = bmp.GetSize();
const wxSize margin = m_imageData->GetBitmapMargins(); const wxSize margin = m_imageData->GetBitmapMargins();