From 0d7ab26e7d2b42a6150f28f859af19eeda85dc9b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 14 Jul 2020 15:46:05 +0200 Subject: [PATCH] Factor out wxGenericTreeCtrl::InitVisualAttributes() No real changes, just avoid calling an event handler directly. --- include/wx/generic/treectlg.h | 9 ++++++++- src/generic/treectlg.cpp | 5 ++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/wx/generic/treectlg.h b/include/wx/generic/treectlg.h index 1892000920..af48e36853 100644 --- a/include/wx/generic/treectlg.h +++ b/include/wx/generic/treectlg.h @@ -354,7 +354,14 @@ protected: private: bool m_hasExplicitFont; - void OnSysColourChanged(wxSysColourChangedEvent&); + void OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event)) + { + InitVisualAttributes(); + } + + // (Re)initialize colours, fonts, pens, brushes used by the control using + // the current system colours and font. + void InitVisualAttributes(); // Reset the state of the last find (i.e. keyboard incremental search) // operation. diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index cb09103d89..befce9c8a9 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -983,8 +983,7 @@ bool wxGenericTreeCtrl::Create(wxWindow *parent, } m_hasExplicitFont = m_hasFont; - wxSysColourChangedEvent evt; - OnSysColourChanged(evt); + InitVisualAttributes(); SetInitialSize(size); @@ -1007,7 +1006,7 @@ void wxGenericTreeCtrl::EnableBellOnNoMatch( bool on ) m_findBell = on; } -void wxGenericTreeCtrl::OnSysColourChanged(wxSysColourChangedEvent&) +void wxGenericTreeCtrl::InitVisualAttributes() { const wxVisualAttributes attr(GetDefaultAttributes()); SetOwnForegroundColour(attr.colFg);