mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 19:47:42 +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:
parent
18e6da6d4d
commit
708ec90bba
2 changed files with 10 additions and 0 deletions
|
@ -164,6 +164,14 @@ Action* Menu::action_at(size_t index)
|
||||||
return m_items[index].action();
|
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)
|
void Menu::visibility_did_change(Badge<WindowServerConnection>, bool visible)
|
||||||
{
|
{
|
||||||
if (m_visible == visible)
|
if (m_visible == visible)
|
||||||
|
|
|
@ -45,6 +45,8 @@ public:
|
||||||
|
|
||||||
void visibility_did_change(Badge<WindowServerConnection>, bool visible);
|
void visibility_did_change(Badge<WindowServerConnection>, bool visible);
|
||||||
|
|
||||||
|
void set_children_actions_enabled(bool enabled);
|
||||||
|
|
||||||
Function<void(bool)> on_visibility_change;
|
Function<void(bool)> on_visibility_change;
|
||||||
|
|
||||||
bool is_visible() const { return m_visible; }
|
bool is_visible() const { return m_visible; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue