summaryrefslogtreecommitdiff
path: root/Applications/DisplayProperties
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-04-04 12:18:40 +0200
committerAndreas Kling <kling@serenityos.org>2020-04-04 12:58:05 +0200
commit26eeaef0a8211fd666fa3eaa6b12c1c5fe56b93f (patch)
treed2ea5c324e86332b35e35dcab951d6894d36e5f4 /Applications/DisplayProperties
parentfaac43597a6fcf6ea477bcfa883931d928c56f32 (diff)
downloadserenity-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 'Applications/DisplayProperties')
-rw-r--r--Applications/DisplayProperties/main.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/Applications/DisplayProperties/main.cpp b/Applications/DisplayProperties/main.cpp
index fef9f35eec..2e064ef54b 100644
--- a/Applications/DisplayProperties/main.cpp
+++ b/Applications/DisplayProperties/main.cpp
@@ -60,20 +60,17 @@ int main(int argc, char** argv)
window->set_main_widget(instance.root_widget());
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-display-properties.png"));
- // Let's create the menubar first
auto menubar = make<GUI::MenuBar>();
- auto app_menu = GUI::Menu::construct("Display Properties");
- app_menu->add_action(GUI::CommonActions::make_quit_action([&](const GUI::Action&) {
+ auto& app_menu = menubar->add_menu("Display Properties");
+ app_menu.add_action(GUI::CommonActions::make_quit_action([&](const GUI::Action&) {
app.quit();
}));
- menubar->add_menu(move(app_menu));
- auto help_menu = GUI::Menu::construct("Help");
- help_menu->add_action(GUI::Action::create("About", [&](const GUI::Action&) {
+ auto& help_menu = menubar->add_menu("Help");
+ help_menu.add_action(GUI::Action::create("About", [&](const GUI::Action&) {
GUI::AboutDialog::show("Display Properties", Gfx::Bitmap::load_from_file("/res/icons/32x32/app-display-properties.png"), window);
}));
- menubar->add_menu(move(help_menu));
app.set_menubar(move(menubar));
window->show();