Handle wxEVT_SYS_COLOUR_CHANGED in wxAUI classes

Update the colours used when the system theme changes.

This is especially important to use the colour scheme compatible with
macOS 10.14+ dark mode.

Note that this commit is best viewed with "git diff --color-moved".

Closes https://github.com/wxWidgets/wxWidgets/pull/916
This commit is contained in:
Daniel Kulp
2018-11-01 11:02:30 -04:00
committed by Vadim Zeitlin
parent 974b7c0990
commit 727a100a6a
11 changed files with 161 additions and 76 deletions

View File

@@ -344,6 +344,10 @@ public:
virtual int ShowDropDown(
wxWindow* wnd,
const wxAuiToolBarItemArray& items) = 0;
// Provide opportunity for subclasses to recalculate colours
virtual void UpdateColoursFromSystem() {}
};
@@ -429,6 +433,8 @@ public:
virtual int ShowDropDown(wxWindow* wnd,
const wxAuiToolBarItemArray& items) wxOVERRIDE;
virtual void UpdateColoursFromSystem() wxOVERRIDE;
protected:
wxBitmap m_buttonDropDownBmp;
@@ -651,6 +657,7 @@ protected: // handlers
void OnLeaveWindow(wxMouseEvent& evt);
void OnCaptureLost(wxMouseCaptureLostEvent& evt);
void OnSetCursor(wxSetCursorEvent& evt);
void OnSysColourChanged(wxSysColourChangedEvent& event);
protected:

View File

@@ -226,6 +226,7 @@ protected:
void OnKillFocus(wxFocusEvent& event);
void OnChar(wxKeyEvent& event);
void OnCaptureLost(wxMouseCaptureLostEvent& evt);
void OnSysColourChanged(wxSysColourChangedEvent& event);
protected:
@@ -408,6 +409,7 @@ protected:
void OnTabRightUp(wxAuiNotebookEvent& evt);
void OnTabBgDClick(wxAuiNotebookEvent& evt);
void OnNavigationKeyNotebook(wxNavigationKeyEvent& event);
void OnSysColourChanged(wxSysColourChangedEvent& event);
// set selection to the given window (which must be non-NULL and be one of
// our pages, otherwise an assert is raised)

View File

@@ -76,6 +76,9 @@ public:
int buttonState,
const wxRect& rect,
wxAuiPaneInfo& pane) = 0;
// Provide opportunity for subclasses to recalculate colours
virtual void UpdateColoursFromSystem() {}
};
@@ -136,6 +139,9 @@ public:
wxAuiPaneInfo& pane);
#endif
virtual void UpdateColoursFromSystem() wxOVERRIDE;
protected:
void DrawCaptionBackground(wxDC& dc, const wxRect& rect, bool active);

View File

@@ -616,6 +616,7 @@ protected:
void OnChildFocus(wxChildFocusEvent& evt);
void OnHintFadeTimer(wxTimerEvent& evt);
void OnFindManager(wxAuiManagerEvent& evt);
void OnSysColourChanged(wxSysColourChangedEvent& event);
protected:

View File

@@ -109,6 +109,9 @@ public:
wxWindow* wnd,
const wxAuiNotebookPageArray& pages,
const wxSize& requiredBmpSize) = 0;
// Provide opportunity for subclasses to recalculate colours
virtual void UpdateColoursFromSystem() {}
};
@@ -185,6 +188,9 @@ public:
const wxAuiNotebookPageArray& pages,
const wxSize& requiredBmpSize) wxOVERRIDE;
// Provide opportunity for subclasses to recalculate colours
virtual void UpdateColoursFromSystem() wxOVERRIDE;
protected:
wxFont m_normalFont;