diff options
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibGUI/Menu.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Menu.h | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/Menu.cpp b/Userland/Libraries/LibGUI/Menu.cpp index d5e6da3dd9..9764e64855 100644 --- a/Userland/Libraries/LibGUI/Menu.cpp +++ b/Userland/Libraries/LibGUI/Menu.cpp @@ -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) diff --git a/Userland/Libraries/LibGUI/Menu.h b/Userland/Libraries/LibGUI/Menu.h index de83bdb167..690e814c50 100644 --- a/Userland/Libraries/LibGUI/Menu.h +++ b/Userland/Libraries/LibGUI/Menu.h @@ -45,6 +45,8 @@ public: void visibility_did_change(Badge<WindowServerConnection>, bool visible); + void set_children_actions_enabled(bool enabled); + Function<void(bool)> on_visibility_change; bool is_visible() const { return m_visible; } |