don't draw borders for bitmap buttons with wxBORDER_NONE style
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61116 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
b5a5362e55
commit
86ac84b8ce
@ -601,7 +601,11 @@ wxSize wxButton::DoGetBestSize() const
|
||||
// account for the user-specified margins
|
||||
size += 2*m_imageData->GetBitmapMargins();
|
||||
|
||||
// and also for the margins we always add internally
|
||||
// and also for the margins we always add internally (unless we have no
|
||||
// border at all in which case the button has exactly the same size as
|
||||
// bitmap and so no margins should be used)
|
||||
if ( !HasFlag(wxBORDER_NONE) )
|
||||
{
|
||||
int marginH = 0,
|
||||
marginV = 0;
|
||||
#if wxUSE_UXTHEME
|
||||
@ -611,24 +615,22 @@ wxSize wxButton::DoGetBestSize() const
|
||||
|
||||
MARGINS margins;
|
||||
wxUxThemeEngine::Get()->GetThemeMargins(theme, NULL,
|
||||
BP_PUSHBUTTON, PBS_NORMAL,
|
||||
TMT_CONTENTMARGINS, NULL,
|
||||
BP_PUSHBUTTON,
|
||||
PBS_NORMAL,
|
||||
TMT_CONTENTMARGINS,
|
||||
NULL,
|
||||
&margins);
|
||||
|
||||
// XP doesn't draw themed buttons correctly when the client area is
|
||||
// smaller than 8x8 - enforce this minimum size for small bitmaps
|
||||
// XP doesn't draw themed buttons correctly when the client
|
||||
// area is smaller than 8x8 - enforce this minimum size for
|
||||
// small bitmaps
|
||||
size.IncTo(wxSize(8, 8));
|
||||
|
||||
// don't add margins for the borderless buttons, they don't need
|
||||
// them and it just makes them appear larger than needed
|
||||
if ( !HasFlag(wxBORDER_NONE) )
|
||||
{
|
||||
marginH = margins.cxLeftWidth + margins.cxRightWidth
|
||||
+ 2*XP_BUTTON_EXTRA_MARGIN;
|
||||
marginV = margins.cyTopHeight + margins.cyBottomHeight
|
||||
+ 2*XP_BUTTON_EXTRA_MARGIN;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif // wxUSE_UXTHEME
|
||||
{
|
||||
@ -637,6 +639,7 @@ wxSize wxButton::DoGetBestSize() const
|
||||
}
|
||||
|
||||
size.IncBy(marginH, marginV);
|
||||
}
|
||||
|
||||
CacheBestSize(size);
|
||||
}
|
||||
@ -1263,6 +1266,8 @@ bool wxButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis)
|
||||
CopyRect(&rectBtn, &lpDIS->rcItem);
|
||||
|
||||
// draw the button background
|
||||
if ( !HasFlag(wxBORDER_NONE) )
|
||||
{
|
||||
#if wxUSE_UXTHEME
|
||||
if ( wxUxThemeEngine::GetIfActive() )
|
||||
{
|
||||
@ -1308,6 +1313,7 @@ bool wxButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// draw the image, if any
|
||||
|
Loading…
Reference in New Issue
Block a user