mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:18:13 +00:00
LibGUI+WindowServer: Propagate action icon changes to buttons and menus
Previously when setting an action's icon we would only change the bitmap stored by the action. This patch adds logic to propagate that change to toolbar buttons as well as window menus. This fixes an issue in SoundPlayer that would cause the play button not to reflect the play state.
This commit is contained in:
parent
cc9afeab41
commit
524f4be5af
5 changed files with 25 additions and 4 deletions
|
@ -74,7 +74,8 @@ void MenuItem::update_window_server()
|
|||
return;
|
||||
auto& action = *m_action;
|
||||
auto shortcut_text = action.shortcut().is_valid() ? action.shortcut().to_string() : String();
|
||||
ConnectionToWindowServer::the().async_update_menu_item(m_menu_id, m_identifier, -1, action.text(), action.is_enabled(), action.is_checkable(), action.is_checkable() ? action.is_checked() : false, m_default, shortcut_text);
|
||||
auto icon = action.icon() ? action.icon()->to_shareable_bitmap() : Gfx::ShareableBitmap();
|
||||
ConnectionToWindowServer::the().async_update_menu_item(m_menu_id, m_identifier, -1, action.text(), action.is_enabled(), action.is_checkable(), action.is_checkable() ? action.is_checked() : false, m_default, shortcut_text, icon);
|
||||
}
|
||||
|
||||
void MenuItem::set_menu_id(Badge<Menu>, unsigned int menu_id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue