From fc85e0db36b368de041dfaffbd308d2f5c861a60 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 16 Jun 2011 00:43:22 +0000 Subject: [PATCH] Use wxAnyButton's DoGetBestSize for toggle buttons git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67949 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/osx/tglbtn.h | 4 ---- src/osx/tglbtn_osx.cpp | 24 ------------------------ 2 files changed, 28 deletions(-) diff --git a/include/wx/osx/tglbtn.h b/include/wx/osx/tglbtn.h index 0a03538cdc..b262d60a7e 100644 --- a/include/wx/osx/tglbtn.h +++ b/include/wx/osx/tglbtn.h @@ -47,7 +47,6 @@ public: protected: virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } - virtual wxSize DoGetBestSize() const; private: DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton) @@ -79,9 +78,6 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxCheckBoxNameStr); -protected: - virtual wxSize DoGetBestSize() const; - private: DECLARE_DYNAMIC_CLASS_NO_COPY(wxBitmapToggleButton) }; diff --git a/src/osx/tglbtn_osx.cpp b/src/osx/tglbtn_osx.cpp index 8a5e348bdc..5eb31a43bc 100644 --- a/src/osx/tglbtn_osx.cpp +++ b/src/osx/tglbtn_osx.cpp @@ -76,18 +76,6 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id, return TRUE; } -wxSize wxToggleButton::DoGetBestSize() const -{ - int wBtn = 70 ; - int hBtn = 20 ; - - int lBtn = m_label.Length() * 8 + 12 ; - if (lBtn > wBtn) - wBtn = lBtn; - - return wxSize ( wBtn , hBtn ) ; -} - void wxToggleButton::SetValue(bool val) { GetPeer()->SetValue( val ) ; @@ -143,17 +131,5 @@ bool wxBitmapToggleButton::Create(wxWindow *parent, wxWindowID id, return TRUE; } -wxSize wxBitmapToggleButton::DoGetBestSize() const -{ - if (!GetBitmap().IsOk()) - return wxSize(20,20); - - wxSize best; - best.x = GetBitmap().GetWidth() + 2 * m_marginX; - best.y = GetBitmap().GetHeight() + 2 * m_marginY; - - return best; -} - #endif // wxUSE_TOGGLEBTN -- 2.47.2