diff --git a/src/generic/spinctlg.cpp b/src/generic/spinctlg.cpp index 0cb596a13d..e8c65c1a53 100644 --- a/src/generic/spinctlg.cpp +++ b/src/generic/spinctlg.cpp @@ -49,11 +49,15 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxSpinDoubleEvent, wxNotifyEvent); // ---------------------------------------------------------------------------- // The margin between the text control and the spin: the value here is the same -// as the margin between the spin button and its "buddy" text control in wxMSW -// so the generic control looks similarly to the native one there, we might -// need to use different value for the other platforms (and maybe even -// determine it dynamically?). +// as the margin between the spin button and its "buddy" text control in wxMSW, +// and the commonly used spacing on macOS, so the generic control looks +// similarly to the native one there, we might need to use different value for +// other platforms (and maybe even determine it dynamically?). +#ifdef __WXOSX__ +static const wxCoord MARGIN = 4; +#else static const wxCoord MARGIN = 1; +#endif #define SPINCTRLBUT_MAX 32000 // large to avoid wrap around trouble @@ -241,6 +245,10 @@ bool wxSpinCtrlGenericBase::Create(wxWindow *parent, m_value = AdjustAndSnap(d); } +#ifdef __WXOSX__ + MacClipsToBounds(false); +#endif + m_textCtrl = new wxSpinCtrlTextGeneric(this, DoValueToText(m_value), style); m_spinButton = new wxSpinCtrlButtonGeneric(this, style); diff --git a/src/osx/spinbutt_osx.cpp b/src/osx/spinbutt_osx.cpp index d95092f699..855c6cc675 100644 --- a/src/osx/spinbutt_osx.cpp +++ b/src/osx/spinbutt_osx.cpp @@ -13,6 +13,7 @@ #include "wx/spinbutt.h" #include "wx/osx/private.h" +#include "wx/osx/private/available.h" wxSpinButton::wxSpinButton() @@ -80,7 +81,14 @@ bool wxSpinButton::OSXHandleClicked( double WXUNUSED(timestampsec) ) wxSize wxSpinButton::DoGetBestSize() const { - return wxSize( 16, 24 ); + if ( WX_IS_MACOS_AVAILABLE(26, 0) ) + { + return wxSize(21, 28); + } + else + { + return wxSize(13, 22); + } } void wxSpinButton::TriggerScrollEvent(wxEventType scrollEvent) diff --git a/src/osx/window_osx.cpp b/src/osx/window_osx.cpp index 2f6a6b66d8..760a412fc6 100644 --- a/src/osx/window_osx.cpp +++ b/src/osx/window_osx.cpp @@ -1061,13 +1061,6 @@ wxSize wxWindowMac::DoGetBestSize() const r.height = 16 ; } else -#endif -#if wxUSE_SPINBTN - if ( IsKindOf( CLASSINFO( wxSpinButton ) ) ) - { - r.height = 24 ; - } - else #endif { // return wxWindowBase::DoGetBestSize() ;