X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f1e01716310cb6e3bfcf5894b442d277bc32789a..ce7208d49d5ce2ca1dc0b3b83f14f1d04f29c4bf:/src/msw/tglbtn.cpp?ds=sidebyside diff --git a/src/msw/tglbtn.cpp b/src/msw/tglbtn.cpp index e3e986fe8c..906c430116 100644 --- a/src/msw/tglbtn.cpp +++ b/src/msw/tglbtn.cpp @@ -114,7 +114,7 @@ wxSize wxToggleButton::DoGetBestSize() const { wxString label = wxGetWindowText(GetHWND()); int wBtn; - GetTextExtent(wxStripMenuCodes(label), &wBtn, NULL); + GetTextExtent(GetLabelText(label), &wBtn, NULL); int wChar, hChar; wxGetCharSize(GetHWND(), &wChar, &hChar, GetFont()); @@ -126,14 +126,18 @@ wxSize wxToggleButton::DoGetBestSize() const int hBtn = BUTTON_HEIGHT_FROM_CHAR_HEIGHT(hChar); #if wxUSE_BUTTON - wxSize sz = wxButton::GetDefaultSize(); - if (wBtn > sz.x) - sz.x = wBtn; - if (hBtn > sz.y) - sz.y = hBtn; -#else + // make all buttons of at least standard size unless wxBU_EXACTFIT is given + if ( !HasFlag(wxBU_EXACTFIT) ) + { + const wxSize szMin = wxButton::GetDefaultSize(); + if ( wBtn < szMin.x ) + wBtn = szMin.x; + if ( hBtn < szMin.y ) + hBtn = szMin.y; + } +#endif // wxUSE_BUTTON + wxSize sz(wBtn, hBtn); -#endif CacheBestSize(sz); return sz;