Send wxEVT_SYS_COLOUR_CHANGED on dark/light theme change in wxMSW
wxOSX already does it, so do it in wxMSW too for consistency and because it seems useful to be able to react to the same event in all cases. Update the drawing sample to refresh its system colours scheme whenever the theme is changed.
This commit is contained in:
parent
7ce2ba9b0c
commit
a7b39f63b3
2 changed files with 14 additions and 0 deletions
|
|
@ -524,6 +524,13 @@ MyCanvas::MyCanvas(MyFrame *parent)
|
|||
m_useBuffer = false;
|
||||
m_showBBox = false;
|
||||
m_sizeDIP = wxSize(0, 0);
|
||||
|
||||
Bind(wxEVT_SYS_COLOUR_CHANGED, [this](wxSysColourChangedEvent& event) {
|
||||
event.Skip();
|
||||
|
||||
if ( m_show == File_ShowSystemColours )
|
||||
Refresh();
|
||||
});
|
||||
}
|
||||
|
||||
void MyCanvas::DrawTestBrushes(wxDC& dc)
|
||||
|
|
|
|||
|
|
@ -5106,6 +5106,13 @@ bool wxWindowMSW::HandleCaptureChanged(WXHWND hWndGainedCapture)
|
|||
|
||||
bool wxWindowMSW::HandleSettingChange(WXWPARAM wParam, WXLPARAM lParam)
|
||||
{
|
||||
// Check for the special case of changing the system light/dark mode.
|
||||
if ( lParam && wxStrcmp((TCHAR*)lParam, wxT("ImmersiveColorSet")) == 0 )
|
||||
{
|
||||
// Forward to the existing function generating an event for this.
|
||||
HandleSysColorChange();
|
||||
}
|
||||
|
||||
// despite MSDN saying "(This message cannot be sent directly to a window.)"
|
||||
// we need to send this to child windows (it is only sent to top-level
|
||||
// windows) so {list,tree}ctrls can adjust their font size if necessary
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue