From e9f935cb70df10fb95df5a884178265b716b69c9 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 10 Aug 2010 18:58:06 +0000 Subject: [PATCH] Fix wxBitmapButton initial best size determination in wxMSW. This was broken during wxButton/wxBitmapButton merge and wxBitmapButton was not created with the correct initial size if the default size was specified when creating it any longer. Fix this by calling SetInitialSize() once again after setting the bitmap. See #12323. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65236 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/msw/bmpbuttn.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/docs/changes.txt b/docs/changes.txt index 9aa667e0be..f43e582e44 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -407,6 +407,7 @@ MSW: - Fix Cygwin 1.7 build (David Gangola). - Allow using wxDC::DrawText() with multiline texts. +- Fix wxBitmapButton best size determination broken in 2.9.1. All (GUI): diff --git a/src/msw/bmpbuttn.cpp b/src/msw/bmpbuttn.cpp index aea2db8f61..217b1aec63 100644 --- a/src/msw/bmpbuttn.cpp +++ b/src/msw/bmpbuttn.cpp @@ -136,6 +136,13 @@ bool wxBitmapButton::Create(wxWindow *parent, SetBitmapLabel(bitmap); + if ( !size.IsFullySpecified() ) + { + // As our bitmap has just changed, our best size has changed as well so + // reset the initial size using the new value. + SetInitialSize(size); + } + return true; } -- 2.45.2