Render statusbar natively on macOS

Instead of trying to mimic native statusbar background rendering in our
own code, use NSWindow setContentBorderThickness:forEdge: to extend the
border that is drawn by the system. This is the canonical way of doing
statusbars ("bottom bar") in AppKit.

The text is still drawn generically, but that's a much smaller issue
than trying to match the border gradient.
This commit is contained in:
Václav Slavík
2020-12-31 18:51:46 +01:00
parent 5ebd76c5db
commit e687d0c4f6
7 changed files with 27 additions and 48 deletions

View File

@@ -329,6 +329,8 @@ public :
virtual void SetRepresentedFilename(const wxString& filename) wxOVERRIDE;
virtual void SetBottomBorderThickness(int thickness) wxOVERRIDE;
wxNonOwnedWindow* GetWXPeer() { return m_wxPeer; }
CGWindowLevel GetWindowLevel() const wxOVERRIDE { return m_macWindowLevel; }

View File

@@ -984,6 +984,8 @@ public :
virtual void SetRepresentedFilename(const wxString& WXUNUSED(filename)) { }
virtual void SetBottomBorderThickness(int WXUNUSED(thickness)) { }
#if wxOSX_USE_IPHONE
virtual CGFloat GetWindowLevel() const { return 0.0; }
#else

View File

@@ -71,6 +71,8 @@ public:
long style = wxSTB_DEFAULT_STYLE,
wxWindowID id = 0,
const wxString& name = wxASCII_STR(wxStatusLineNameStr)) wxOVERRIDE;
virtual void SetStatusBar(wxStatusBar *statbar) wxOVERRIDE;
#endif // wxUSE_STATUSBAR
void PositionBars();

View File

@@ -38,9 +38,7 @@ protected:
virtual void InitColours() wxOVERRIDE;
private:
wxColour m_textActive, m_textInactive,
m_bgActiveFrom, m_bgActiveTo,
m_borderActive, m_borderInactive;
wxColour m_textActive, m_textInactive;
wxDECLARE_DYNAMIC_CLASS(wxStatusBarMac);
wxDECLARE_EVENT_TABLE();