mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 10:01:13 +09:00
LibGUI: Add MenuBar::add_menu(name)
This allows us to construct menus in a more natural way: auto& file_menu = menubar->add_menu("File"); file_menu.add_action(...); Instead of the old way: auto file_menu = GUI::Menu::construct(); file_menu->add_action(...); menubar->add_menu(file_menu);
This commit is contained in:
parent
faac43597a
commit
26eeaef0a8
Notes:
sideshowbarker
2024-07-19 07:56:34 +09:00
Author: https://github.com/awesomekling
Commit: 26eeaef0a8
26 changed files with 261 additions and 331 deletions
|
@ -41,7 +41,14 @@ MenuBar::~MenuBar()
|
|||
unrealize_menubar();
|
||||
}
|
||||
|
||||
void MenuBar::add_menu(NonnullRefPtr<Menu> menu)
|
||||
Menu& MenuBar::add_menu(String name)
|
||||
{
|
||||
auto menu = Menu::construct(move(name));
|
||||
append_menu(menu);
|
||||
return *menu;
|
||||
}
|
||||
|
||||
void MenuBar::append_menu(NonnullRefPtr<Menu> menu)
|
||||
{
|
||||
m_menus.append(move(menu));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue