Always correctly invalid best size when bitmap changes.
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 23 Jul 2009 23:01:10 +0000 (23:01 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 23 Jul 2009 23:01:10 +0000 (23:01 +0000)
Previously it was done only when the initial bitmap was set, not when it was
subsequently changed.

Closes #11018.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61509 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/button.cpp

index 49b84f28496019adcd14c6e1e982978356280dd7..c81472bebc848e2dffde05228bb7419dece9f7eb 100644 (file)
@@ -959,16 +959,18 @@ void wxButton::DoSetBitmap(const wxBitmap& bitmap, State which)
             m_imageData = new wxODButtonImageData(this, bitmap);
             MakeOwnerDrawn();
         }
-
-        // if a bitmap was assigned to the bitmap, its best size must be
-        // changed to account for it
-        InvalidateBestSize();
     }
     else
     {
         m_imageData->SetBitmap(bitmap, which);
     }
 
+    // it should be enough to only invalidate the best size when the normal
+    // bitmap changes as all bitmaps assigned to the button should be of the
+    // same size anyhow
+    if ( which == State_Normal )
+        InvalidateBestSize();
+
     Refresh();
 }