1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:08:12 +00:00

LibGUI: Add Menu::set_children_actions_enabled() helper

This adds a helper function to Menu that allows us to set all the
children enabled/disabled.
This commit is contained in:
Marcus Nilsson 2022-01-09 00:28:05 +01:00 committed by Linus Groh
parent 18e6da6d4d
commit 708ec90bba
2 changed files with 10 additions and 0 deletions

View file

@ -164,6 +164,14 @@ Action* Menu::action_at(size_t index)
return m_items[index].action();
}
void Menu::set_children_actions_enabled(bool enabled)
{
for (auto& item : m_items) {
if (item.action())
item.action()->set_enabled(enabled);
}
}
void Menu::visibility_did_change(Badge<WindowServerConnection>, bool visible)
{
if (m_visible == visible)