diff options
author | Andreas Kling <kling@serenityos.org> | 2020-04-04 12:18:40 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-04-04 12:58:05 +0200 |
commit | 26eeaef0a8211fd666fa3eaa6b12c1c5fe56b93f (patch) | |
tree | d2ea5c324e86332b35e35dcab951d6894d36e5f4 /Libraries/LibGUI/MenuBar.h | |
parent | faac43597a6fcf6ea477bcfa883931d928c56f32 (diff) | |
download | serenity-26eeaef0a8211fd666fa3eaa6b12c1c5fe56b93f.zip |
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);
Diffstat (limited to 'Libraries/LibGUI/MenuBar.h')
-rw-r--r-- | Libraries/LibGUI/MenuBar.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Libraries/LibGUI/MenuBar.h b/Libraries/LibGUI/MenuBar.h index f68c7929f4..695911a18e 100644 --- a/Libraries/LibGUI/MenuBar.h +++ b/Libraries/LibGUI/MenuBar.h @@ -37,7 +37,8 @@ public: MenuBar(); ~MenuBar(); - void add_menu(NonnullRefPtr<Menu>); + Menu& add_menu(String name); + void append_menu(NonnullRefPtr<Menu>); void notify_added_to_application(Badge<Application>); void notify_removed_from_application(Badge<Application>); |