From 0d1c8f39baaaeb7a7f757091209eab471ef5dbc4 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 15 Jun 2006 16:01:17 +0000 Subject: [PATCH] bitmap button size was too small when uxtheme functions were used to get the margins git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39744 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/bmpbuttn.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/msw/bmpbuttn.cpp b/src/msw/bmpbuttn.cpp index 08cca12468..c47f2abc91 100644 --- a/src/msw/bmpbuttn.cpp +++ b/src/msw/bmpbuttn.cpp @@ -593,19 +593,22 @@ wxSize wxBitmapButton::DoGetBestSize() const if ( m_bmpNormal.Ok() ) { #if wxUSE_UXTHEME - if ( (GetWindowStyleFlag() & wxBU_AUTODRAW) && wxUxThemeEngine::GetIfActive() ) + if ( wxUxThemeEngine::GetIfActive() ) { wxUxThemeHandle theme((wxBitmapButton *)this, L"BUTTON"); - // calculate content area margins - // assuming here that each state is the same size MARGINS margins; wxUxThemeEngine::Get()->GetThemeMargins(theme, NULL, BP_PUSHBUTTON, PBS_NORMAL, TMT_CONTENTMARGINS, NULL, &margins); - wxSize best(m_bmpNormal.GetWidth() + 2 * (margins.cxLeftWidth + 1), - m_bmpNormal.GetHeight() + 2* (margins.cyTopHeight + 1)); + + // the margins we get are too small, part of the bitmap is + // truncated if we use them -- so add a little extra space + wxSize best(m_bmpNormal.GetWidth() + + margins.cxLeftWidth + margins.cxRightWidth + 5, + m_bmpNormal.GetHeight() + + margins.cyTopHeight + margins.cyBottomHeight + 5); CacheBestSize(best); return best; } -- 2.47.2