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
This commit is contained in:
@@ -593,19 +593,22 @@ wxSize wxBitmapButton::DoGetBestSize() const
|
|||||||
if ( m_bmpNormal.Ok() )
|
if ( m_bmpNormal.Ok() )
|
||||||
{
|
{
|
||||||
#if wxUSE_UXTHEME
|
#if wxUSE_UXTHEME
|
||||||
if ( (GetWindowStyleFlag() & wxBU_AUTODRAW) && wxUxThemeEngine::GetIfActive() )
|
if ( wxUxThemeEngine::GetIfActive() )
|
||||||
{
|
{
|
||||||
wxUxThemeHandle theme((wxBitmapButton *)this, L"BUTTON");
|
wxUxThemeHandle theme((wxBitmapButton *)this, L"BUTTON");
|
||||||
|
|
||||||
// calculate content area margins
|
|
||||||
// assuming here that each state is the same size
|
|
||||||
MARGINS margins;
|
MARGINS margins;
|
||||||
wxUxThemeEngine::Get()->GetThemeMargins(theme, NULL,
|
wxUxThemeEngine::Get()->GetThemeMargins(theme, NULL,
|
||||||
BP_PUSHBUTTON, PBS_NORMAL,
|
BP_PUSHBUTTON, PBS_NORMAL,
|
||||||
TMT_CONTENTMARGINS, NULL,
|
TMT_CONTENTMARGINS, NULL,
|
||||||
&margins);
|
&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);
|
CacheBestSize(best);
|
||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user