fixed a harmless warning (patch 595096) and added a comment
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16519 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -134,29 +134,33 @@ WXDWORD wxButton::MSWGetStyle(long style, WXDWORD *exstyle) const
|
|||||||
|
|
||||||
wxSize wxButton::DoGetBestSize() const
|
wxSize wxButton::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
wxString label = wxGetWindowText(GetHWND());
|
|
||||||
int wBtn;
|
int wBtn;
|
||||||
GetTextExtent(label, &wBtn, NULL);
|
GetTextExtent(wxGetWindowText(GetHWND()), &wBtn, NULL);
|
||||||
|
|
||||||
int wChar, hChar;
|
int wChar, hChar;
|
||||||
wxGetCharSize(GetHWND(), &wChar, &hChar, &GetFont());
|
wxGetCharSize(GetHWND(), &wChar, &hChar, &GetFont());
|
||||||
|
|
||||||
// add a margin - the button is wider than just its label
|
// add a margin -- the button is wider than just its label
|
||||||
wBtn += 3*wChar;
|
wBtn += 3*wChar;
|
||||||
|
|
||||||
// the button height is proportional to the height of the font used
|
// the button height is proportional to the height of the font used
|
||||||
int hBtn = BUTTON_HEIGHT_FROM_CHAR_HEIGHT(hChar);
|
int hBtn = BUTTON_HEIGHT_FROM_CHAR_HEIGHT(hChar);
|
||||||
|
|
||||||
|
// all buttons have at least the standard size unless the user explicitly
|
||||||
|
// wants them to be of smaller size and used wxBU_EXACTFIT style when
|
||||||
|
// creating the button
|
||||||
if ( !HasFlag(wxBU_EXACTFIT) )
|
if ( !HasFlag(wxBU_EXACTFIT) )
|
||||||
{
|
{
|
||||||
wxSize sz = GetDefaultSize();
|
wxSize sz = GetDefaultSize();
|
||||||
if (wBtn > sz.x) sz.x = wBtn;
|
if (wBtn > sz.x)
|
||||||
if (hBtn > sz.y) sz.y = hBtn;
|
sz.x = wBtn;
|
||||||
|
if (hBtn > sz.y)
|
||||||
|
sz.y = hBtn;
|
||||||
|
|
||||||
return sz;
|
return sz;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
return wxSize(wBtn, hBtn);
|
|
||||||
|
|
||||||
|
return wxSize(wBtn, hBtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
|
Reference in New Issue
Block a user