From 5b703b6a24ff719d1ba16121ac41ea0f5b41671f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 21 Jul 2018 14:38:31 +0200 Subject: [PATCH] Always use default margins for wxBitmapButton under Mac Previously this was only done when wxBU_AUTODRAW was specified, making this the only place in wxWidgets where this style was actually used. This was not ideal, as the same code, not using wxBU_AUTODRAW, worked just fine under MSW and GTK, but created ugly-looking buttons under Mac, so do the right thing by default and let people call SetMargins(0, 0) if they really don't want to have any margins. Closes #18170. --- docs/changes.txt | 4 ++++ src/osx/bmpbuttn_osx.cpp | 12 ++---------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 7936144c7b..f93ec456f7 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -47,6 +47,10 @@ Changes in behaviour not resulting in compilation errors event handlers if you want the standard key combinations such as Alt-Space or Alt-F4 to work. +- wxOSX port uses default button margins for wxBitmapButton by default, for + consistency with the other ports. You now need to call SetMargins(0, 0) + explicitly if you really don't want to have any margins in your buttons. + Changes in behaviour which may result in build errors ----------------------------------------------------- diff --git a/src/osx/bmpbuttn_osx.cpp b/src/osx/bmpbuttn_osx.cpp index f2088bd480..5f26d49e71 100644 --- a/src/osx/bmpbuttn_osx.cpp +++ b/src/osx/bmpbuttn_osx.cpp @@ -38,16 +38,8 @@ bool wxBitmapButton::Create( wxWindow *parent, validator, name) ) return false; - if ( style & wxBU_AUTODRAW ) - { - m_marginX = - m_marginY = wxDEFAULT_BUTTON_MARGIN; - } - else - { - m_marginX = - m_marginY = 0; - } + m_marginX = + m_marginY = wxDEFAULT_BUTTON_MARGIN; m_bitmaps[State_Normal] = bitmap;