X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8907154c1a8a6882c6797d1f16393ddfb23e7f3a..96b2cbe8b39292fed91654ff0d1f4b1c16561acb:/src/msw/tglbtn.cpp diff --git a/src/msw/tglbtn.cpp b/src/msw/tglbtn.cpp index 55368ab31c..7a0e49c862 100644 --- a/src/msw/tglbtn.cpp +++ b/src/msw/tglbtn.cpp @@ -2,8 +2,8 @@ // Name: src/msw/tglbtn.cpp // Purpose: Definition of the wxToggleButton class, which implements a // toggle button under wxMSW. -// Author: John Norris, minor changes by Axel Schlueter -// and William Gallafent. +// Author: John Norris, minor changes by Axel Schlueter +// and William Gallafent. // Modified by: // Created: 08.02.01 // RCS-ID: $Id$ @@ -25,10 +25,10 @@ #pragma hdrstop #endif -#include "wx/tglbtn.h" - #if wxUSE_TOGGLEBTN +#include "wx/tglbtn.h" + #ifndef WX_PRECOMP #include "wx/button.h" #include "wx/brush.h" @@ -83,11 +83,6 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id, return true; } -wxBorder wxToggleButton::GetDefaultBorder() const -{ - return wxBORDER_NONE; -} - WXDWORD wxToggleButton::MSWGetStyle(long style, WXDWORD *exstyle) const { WXDWORD msStyle = wxControl::MSWGetStyle(style, exstyle); @@ -114,7 +109,7 @@ wxSize wxToggleButton::DoGetBestSize() const { wxString label = wxGetWindowText(GetHWND()); int wBtn; - GetTextExtent(label, &wBtn, NULL); + GetTextExtent(GetLabelText(label), &wBtn, NULL); int wChar, hChar; wxGetCharSize(GetHWND(), &wChar, &hChar, GetFont()); @@ -126,14 +121,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; @@ -164,4 +163,3 @@ void wxToggleButton::Command(wxCommandEvent & event) } #endif // wxUSE_TOGGLEBTN -