mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:37:34 +00:00
LibGUI: Add 'remove_all_actions' method to 'Menu'
This commit is contained in:
parent
8ede1a6a6f
commit
dbfe385879
2 changed files with 9 additions and 0 deletions
|
@ -64,6 +64,14 @@ void Menu::add_action(NonnullRefPtr<Action> action)
|
|||
MUST(try_add_action(move(action)));
|
||||
}
|
||||
|
||||
void Menu::remove_all_actions()
|
||||
{
|
||||
for (auto& item : m_items) {
|
||||
WindowServerConnection::the().async_remove_menu_item(m_menu_id, item.identifier());
|
||||
}
|
||||
m_items.clear();
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<Menu>> Menu::try_add_submenu(String name)
|
||||
{
|
||||
// NOTE: We grow the vector first, to get allocation failure handled immediately.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue