diff --git a/include/wx/platform.h b/include/wx/platform.h index aed10665c3..03f9d0b9e2 100644 --- a/include/wx/platform.h +++ b/include/wx/platform.h @@ -470,6 +470,9 @@ # ifndef MAC_OS_VERSION_14_0 # define MAC_OS_VERSION_14_0 140000 # endif +# ifndef MAC_OS_VERSION_26_0 +# define MAC_OS_VERSION_26_0 260000 +# endif # if __MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_13 # ifndef NSAppKitVersionNumber10_10 # define NSAppKitVersionNumber10_10 1343 diff --git a/src/osx/carbon/frame.cpp b/src/osx/carbon/frame.cpp index 066a7d5e7d..a01e074282 100644 --- a/src/osx/carbon/frame.cpp +++ b/src/osx/carbon/frame.cpp @@ -128,11 +128,14 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id, void wxFrame::SetStatusBar(wxStatusBar *statbar) { wxFrameBase::SetStatusBar(statbar); + +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0 if ( WX_IS_MACOS_AVAILABLE(11, 0) ) { // textured borders are unwanted, statusbar renders w/o them } else +#endif { m_nowpeer->SetBottomBorderThickness(statbar ? GetMacStatusbarHeight() : 0); } diff --git a/src/osx/carbon/statbrma.cpp b/src/osx/carbon/statbrma.cpp index 90670dd524..c0c4ebd714 100644 --- a/src/osx/carbon/statbrma.cpp +++ b/src/osx/carbon/statbrma.cpp @@ -73,6 +73,7 @@ bool wxStatusBarMac::Create(wxWindow *parent, wxWindowID id, void wxStatusBarMac::InitColours() { +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_26_0 if ( WX_IS_MACOS_AVAILABLE(26, 0) ) { if ( wxSystemSettings::GetAppearance().IsDark() ) @@ -90,7 +91,10 @@ void wxStatusBarMac::InitColours() m_separator = wxColour(0xD9, 0xD9, 0xD9); } } - else if ( WX_IS_MACOS_AVAILABLE(11, 0) ) + else +#endif // MAC_OS_VERSION_26_0 +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0 + if ( WX_IS_MACOS_AVAILABLE(11, 0) ) { if ( wxSystemSettings::GetAppearance().IsDark() ) { @@ -111,7 +115,10 @@ void wxStatusBarMac::InitColours() m_separator = wxColour(0xCC, 0xCC, 0xCC); } } - else if ( WX_IS_MACOS_AVAILABLE(10, 14) ) + else +#endif // MAC_OS_VERSION_11_0 +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14 + if ( WX_IS_MACOS_AVAILABLE(10, 14) ) { if ( wxSystemSettings::GetAppearance().IsDark() ) { @@ -124,7 +131,9 @@ void wxStatusBarMac::InitColours() m_textInactive = wxColour(0xB1, 0xB1, 0xB1); } } - else // 10.10 Yosemite to 10.13: + else +#endif // MAC_OS_X_VERSION_10_14 + // 10.10 Yosemite to 10.13: { m_textActive = wxColour(0x40, 0x40, 0x40); m_textInactive = wxColour(0x4B, 0x4B, 0x4B); @@ -153,11 +162,15 @@ void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event)) break; } +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_26_0 if ( WX_IS_MACOS_AVAILABLE(26, 0) ) { // don't paint the background, handled by the OS } - else if ( WX_IS_MACOS_AVAILABLE(11, 0) ) + else +#endif +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0 + if ( WX_IS_MACOS_AVAILABLE(11, 0) ) { // we _do_ need to paint the background on Big Sur up to Tahoe // to match Finder's appearance: @@ -165,13 +178,16 @@ void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event)) dc.Clear(); } // else: background is rendered by OS, it is part of NSWindow border +#endif +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0 // Draw horizontal separator above the status bar: if ( WX_IS_MACOS_AVAILABLE(11, 0) ) { dc.SetPen(m_separator); dc.DrawLine(0, 0, GetSize().x, 0); } +#endif // Draw the text: @@ -188,11 +204,16 @@ void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event)) void wxStatusBarMac::InitCornerInset() { +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_26_0 if ( WX_IS_MACOS_AVAILABLE(26, 0) ) m_cornerInset = 8; - else if ( WX_IS_MACOS_AVAILABLE(11, 0) ) + else +#endif +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_11_0 + if ( WX_IS_MACOS_AVAILABLE(11, 0) ) m_cornerInset = 4; else +#endif m_cornerInset = 0; } diff --git a/src/osx/cocoa/notebook.mm b/src/osx/cocoa/notebook.mm index 0925dcaa91..b04993c031 100644 --- a/src/osx/cocoa/notebook.mm +++ b/src/osx/cocoa/notebook.mm @@ -91,11 +91,13 @@ // On macOS 26 Tahoe, the mere presence of drawRect: in derived class, // even if it just calls super's implementation, triggers legacy // rendering of NSTabView. +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_26_0 if (WX_IS_MACOS_AVAILABLE(26, 0)) { wxOSXCocoaClassAddWXMethods(self, wxOSXSKIP_DRAW); } else +#endif { wxOSXCocoaClassAddWXMethods(self); } diff --git a/src/osx/spinbutt_osx.cpp b/src/osx/spinbutt_osx.cpp index 855c6cc675..e55a6a8f0c 100644 --- a/src/osx/spinbutt_osx.cpp +++ b/src/osx/spinbutt_osx.cpp @@ -81,11 +81,13 @@ bool wxSpinButton::OSXHandleClicked( double WXUNUSED(timestampsec) ) wxSize wxSpinButton::DoGetBestSize() const { +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_26_0 if ( WX_IS_MACOS_AVAILABLE(26, 0) ) { return wxSize(21, 28); } else +#endif { return wxSize(13, 22); } diff --git a/src/osx/textctrl_osx.cpp b/src/osx/textctrl_osx.cpp index 3dcaddc14d..fc0d71fa81 100644 --- a/src/osx/textctrl_osx.cpp +++ b/src/osx/textctrl_osx.cpp @@ -232,8 +232,10 @@ wxSize wxTextCtrl::DoGetSizeFromTextSize(int xlen, int ylen) const break ; } +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_VERSION_26_0 if ( WX_IS_MACOS_AVAILABLE(26, 0) ) hText += 3; +#endif // the numbers above include the border size, so subtract it before // possibly adding it back below