Changed processing of a wxEVT_SYS_COLOUR_CHANGED event.

Only UI is updated. The application doesn't recreated now
This commit is contained in:
YuSanka 2020-05-21 17:29:00 +02:00
parent 4348b177d6
commit db32c1f15a
13 changed files with 170 additions and 0 deletions

View file

@ -190,6 +190,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
event.Skip();
});
/*
Bind(wxEVT_SYS_COLOUR_CHANGED, [this](wxSysColourChangedEvent& event)
{
bool recreate_gui = false;
@ -210,6 +211,7 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
wxGetApp().recreate_GUI(_L("Changing of an application in respect to the system mode") + dots);
event.Skip();
});
*/
wxGetApp().persist_window_geometry(this, true);
@ -575,6 +577,28 @@ void MainFrame::on_dpi_changed(const wxRect &suggested_rect)
this->Maximize(is_maximized);
}
void MainFrame::on_sys_color_changed()
{
wxBusyCursor wait;
// update label colors in respect to the system mode
wxGetApp().init_label_colours();
wxGetApp().preset_bundle->load_default_preset_bitmaps();
// update Plater
wxGetApp().plater()->sys_color_changed();
// update Tabs
for (auto tab : wxGetApp().tabs_list)
tab->sys_color_changed();
// msw_rescale_menu updates just icons, so use it
wxMenuBar* menu_bar = this->GetMenuBar();
for (size_t id = 0; id < menu_bar->GetMenuCount(); id++)
msw_rescale_menu(menu_bar->GetMenu(id));
}
void MainFrame::init_menubar()
{
#ifdef __APPLE__