From 11a449ac9b11fbff75fb86e3bd487c762c92f962 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Thu, 8 Jan 2009 13:56:03 +0000 Subject: [PATCH] Add the same margin to wxBitmapToggleButton as to wxBitmapButton git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57906 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/osx/carbon/tglbtn.h | 3 +++ src/osx/tglbtn_osx.cpp | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/wx/osx/carbon/tglbtn.h b/include/wx/osx/carbon/tglbtn.h index 44d4df5b9c..fde10d7980 100644 --- a/include/wx/osx/carbon/tglbtn.h +++ b/include/wx/osx/carbon/tglbtn.h @@ -51,6 +51,9 @@ public: private: wxBitmap m_bitmap; + int m_marginX, + m_marginY; + protected: virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; } virtual wxSize DoGetBestSize() const; diff --git a/src/osx/tglbtn_osx.cpp b/src/osx/tglbtn_osx.cpp index a5fa2bc151..09c9a7c9dc 100644 --- a/src/osx/tglbtn_osx.cpp +++ b/src/osx/tglbtn_osx.cpp @@ -115,6 +115,9 @@ bool wxBitmapToggleButton::Create(wxWindow *parent, wxWindowID id, m_bitmap = label; + m_marginX = + m_marginY = wxDEFAULT_BUTTON_MARGIN; + if ( !wxControl::Create(parent, id, pos, size, style, validator, name) ) return false; @@ -129,8 +132,12 @@ wxSize wxBitmapToggleButton::DoGetBestSize() const { if (!m_bitmap.IsOk()) return wxSize(20,20); - - return wxSize ( m_bitmap.GetWidth()+6, m_bitmap.GetHeight()+6 ) ; + + wxSize best; + best.x = m_bitmap.GetWidth() + 2 * m_marginX; + best.y = m_bitmap.GetHeight() + 2 * m_marginY; + + return best; } void wxBitmapToggleButton::SetValue(bool val) -- 2.47.2