From 1e023926ec5e304729bff81f8650ff82129f338f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 15 Aug 2002 17:47:13 +0000 Subject: [PATCH] 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 --- src/msw/button.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/msw/button.cpp b/src/msw/button.cpp index 172cf7de5b..6060421549 100644 --- a/src/msw/button.cpp +++ b/src/msw/button.cpp @@ -134,29 +134,33 @@ WXDWORD wxButton::MSWGetStyle(long style, WXDWORD *exstyle) const wxSize wxButton::DoGetBestSize() const { - wxString label = wxGetWindowText(GetHWND()); int wBtn; - GetTextExtent(label, &wBtn, NULL); + GetTextExtent(wxGetWindowText(GetHWND()), &wBtn, NULL); int wChar, hChar; 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; // the button height is proportional to the height of the font used int hBtn = BUTTON_HEIGHT_FROM_CHAR_HEIGHT(hChar); - if (!HasFlag(wxBU_EXACTFIT)) + // 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) ) { wxSize sz = GetDefaultSize(); - if (wBtn > sz.x) sz.x = wBtn; - if (hBtn > sz.y) sz.y = hBtn; + if (wBtn > sz.x) + sz.x = wBtn; + if (hBtn > sz.y) + sz.y = hBtn; + return sz; } - else - return wxSize(wBtn, hBtn); + return wxSize(wBtn, hBtn); } /* static */ -- 2.45.2