From 93be446f3a957d9347ebb8b65f2a124c76f4bf68 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 28 Apr 2012 22:24:36 +0000 Subject: [PATCH] Fix wxBitmapButton best size calculation in wxOSX/Carbon. wxAnyButton refactoring broke the best size computation for Carbon, fix it to work as it did before. Closes #13830. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71298 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/carbon/anybutton.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/osx/carbon/anybutton.cpp b/src/osx/carbon/anybutton.cpp index 36a642a698..b24b73b47c 100644 --- a/src/osx/carbon/anybutton.cpp +++ b/src/osx/carbon/anybutton.cpp @@ -53,7 +53,17 @@ wxSize wxAnyButton::DoGetBestSize() const GetPeer()->GetBestRect( &bestsize ) ; int wBtn; - if ( EmptyRect( &bestsize ) || ( GetWindowStyle() & wxBU_EXACTFIT) ) + if ( GetBitmapLabel().IsOk() ) + { + sz.x = bestsize.right - bestsize.left ; + sz.y = bestsize.bottom - bestsize.top ; + sz.x = sz.x + MacGetLeftBorderSize() + + MacGetRightBorderSize(); + sz.y = sz.y + MacGetTopBorderSize() + + MacGetBottomBorderSize(); + wBtn = sz.x; + } + else if ( EmptyRect( &bestsize ) || ( GetWindowStyle() & wxBU_EXACTFIT) ) { Point bounds; -- 2.45.2