Tweak wxStatusBar size for macOS 11

Finder's status bar size increased by 4pt in Big Sur.
This commit is contained in:
Václav Slavík
2021-01-01 12:14:45 +01:00
parent e687d0c4f6
commit d28771cfb5

View File

@@ -24,14 +24,28 @@
#endif // WX_PRECOMP #endif // WX_PRECOMP
#include "wx/osx/private.h" #include "wx/osx/private.h"
#include "wx/osx/private/available.h"
namespace
{
int GetMacStatusbarHeight()
{
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_16
if ( WX_IS_MACOS_AVAILABLE(10, 16) )
return 28;
else
#endif
return 24;
}
} // anonymous namespace
wxBEGIN_EVENT_TABLE(wxFrame, wxFrameBase) wxBEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
EVT_ACTIVATE(wxFrame::OnActivate) EVT_ACTIVATE(wxFrame::OnActivate)
EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged) EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
wxEND_EVENT_TABLE() wxEND_EVENT_TABLE()
#define WX_MAC_STATUSBAR_HEIGHT 24
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// creation/destruction // creation/destruction
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -106,7 +120,7 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
wxStatusBar *statusBar; wxStatusBar *statusBar;
statusBar = new wxStatusBar(this, id, style, name); statusBar = new wxStatusBar(this, id, style, name);
statusBar->SetSize(100, WX_MAC_STATUSBAR_HEIGHT); statusBar->SetSize(100, GetMacStatusbarHeight());
statusBar->SetFieldsCount(number); statusBar->SetFieldsCount(number);
return statusBar; return statusBar;
@@ -115,7 +129,7 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
void wxFrame::SetStatusBar(wxStatusBar *statbar) void wxFrame::SetStatusBar(wxStatusBar *statbar)
{ {
wxFrameBase::SetStatusBar(statbar); wxFrameBase::SetStatusBar(statbar);
m_nowpeer->SetBottomBorderThickness(statbar ? WX_MAC_STATUSBAR_HEIGHT : 0); m_nowpeer->SetBottomBorderThickness(statbar ? GetMacStatusbarHeight() : 0);
} }
void wxFrame::PositionStatusBar() void wxFrame::PositionStatusBar()
@@ -127,7 +141,7 @@ void wxFrame::PositionStatusBar()
// Since we wish the status bar to be directly under the client area, // Since we wish the status bar to be directly under the client area,
// we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS. // we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
m_frameStatusBar->SetSize(0, h, w, WX_MAC_STATUSBAR_HEIGHT); m_frameStatusBar->SetSize(0, h, w, GetMacStatusbarHeight());
} }
} }
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
@@ -223,7 +237,7 @@ void wxFrame::DoGetClientSize(int *x, int *y) const
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
if ( GetStatusBar() && GetStatusBar()->IsShown() && y ) if ( GetStatusBar() && GetStatusBar()->IsShown() && y )
*y -= WX_MAC_STATUSBAR_HEIGHT; *y -= GetMacStatusbarHeight();
#endif #endif
#if wxUSE_TOOLBAR #if wxUSE_TOOLBAR