Update the icon set + toolbars when the system color theme changes
This ensures the icons switch from dark<->light when set to the automatic theme.
This commit is contained in:
parent
3146d03aaa
commit
57518fd0f9
|
@ -99,6 +99,8 @@ BEGIN_EVENT_TABLE( EDA_BASE_FRAME, wxFrame )
|
|||
EVT_MENU_HIGHLIGHT_ALL( EDA_BASE_FRAME::OnMenuEvent )
|
||||
EVT_MOVE( EDA_BASE_FRAME::OnMove )
|
||||
EVT_MAXIMIZE( EDA_BASE_FRAME::OnMaximize )
|
||||
|
||||
EVT_SYS_COLOUR_CHANGED( EDA_BASE_FRAME::onSystemColorChange )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType,
|
||||
|
@ -470,6 +472,7 @@ void EDA_BASE_FRAME::ThemeChanged()
|
|||
{
|
||||
ClearScaledBitmapCache();
|
||||
|
||||
// Update all the toolbars to have new icons
|
||||
wxAuiPaneInfoArray panes = m_auimgr.GetAllPanes();
|
||||
|
||||
for( size_t i = 0; i < panes.GetCount(); ++i )
|
||||
|
@ -1126,3 +1129,29 @@ wxSize EDA_BASE_FRAME::GetWindowSize()
|
|||
|
||||
return winSize;
|
||||
}
|
||||
|
||||
|
||||
void EDA_BASE_FRAME::HandleSystemColorChange()
|
||||
{
|
||||
// Update the icon theme when the system theme changes and update the toolbars
|
||||
if( GetBitmapStore()->ThemeChanged() )
|
||||
ThemeChanged();
|
||||
|
||||
// This isn't handled by ThemeChanged()
|
||||
if( GetMenuBar() )
|
||||
{
|
||||
// For icons in menus, icon scaling & hotkeys
|
||||
ReCreateMenuBar();
|
||||
GetMenuBar()->Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EDA_BASE_FRAME::onSystemColorChange( wxSysColourChangedEvent& aEvent )
|
||||
{
|
||||
// Call the handler to update the colors used in the frame
|
||||
HandleSystemColorChange();
|
||||
|
||||
// Skip the change event to ensure the rest of the window controls get it
|
||||
aEvent.Skip();
|
||||
}
|
||||
|
|
|
@ -421,7 +421,7 @@ public:
|
|||
/**
|
||||
* Recreates the menu bar.
|
||||
*
|
||||
* Needed when the language is changed
|
||||
* Needed when the language or icons are changed
|
||||
*/
|
||||
virtual void ReCreateMenuBar();
|
||||
|
||||
|
@ -567,6 +567,11 @@ public:
|
|||
return Close( aForce );
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the UI in response to a change in the system colors.
|
||||
*/
|
||||
virtual void HandleSystemColorChange();
|
||||
|
||||
protected:
|
||||
///< Default style flags used for wxAUI toolbars.
|
||||
static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND;
|
||||
|
@ -601,6 +606,8 @@ protected:
|
|||
virtual bool canCloseWindow( wxCloseEvent& aCloseEvent ) { return true; }
|
||||
virtual void doCloseWindow() { }
|
||||
|
||||
void onSystemColorChange( wxSysColourChangedEvent& aEvent );
|
||||
|
||||
/**
|
||||
* Called when when the units setting has changed to allow for any derived classes
|
||||
* to handle refreshing and controls that have units based measurements in them.
|
||||
|
|
Loading…
Reference in New Issue