From f40ea601bfc6c5524800184d3f3ae36f26ad197b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 4 Oct 2006 23:02:13 +0000 Subject: [PATCH] honour wxBU_EXACTFIT in wxToggleButton (patch 1567892) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41632 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/msw/tglbtn.cpp | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 98bd418cc1..b72835a0b5 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -80,6 +80,7 @@ wxMSW: - Fixed a bug whereby static controls didn't use the correct text colour if the parent's background colour had been set (most noticeable when switching to a high-contrast theme). +- Respect wxBU_EXACTFIT style in wxToggleButton (Alexander Borovsky) wxMac: diff --git a/src/msw/tglbtn.cpp b/src/msw/tglbtn.cpp index a0b22727df..906c430116 100644 --- a/src/msw/tglbtn.cpp +++ b/src/msw/tglbtn.cpp @@ -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; -- 2.45.2