]> git.saurik.com Git - wxWidgets.git/commitdiff
Fall back to the valid normal bitmap if no state-specific bitmap is set.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 15 Jun 2011 21:31:48 +0000 (21:31 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 15 Jun 2011 21:31:48 +0000 (21:31 +0000)
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

src/msw/anybutton.cpp

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