summaryrefslogtreecommitdiff
path: root/Applications/DisplayProperties
diff options
context:
space:
mode:
authorJesse Buhagiar <jesse.buhagiar@student.rmit.edu.au>2019-12-29 00:59:56 +1100
committerAndreas Kling <awesomekling@gmail.com>2019-12-30 14:03:31 +0100
commitba98666b057f04dc21493820f55376a62be4bd36 (patch)
tree3a6624c9f90ee124f4a2503a04c89dadaf1e88e9 /Applications/DisplayProperties
parenta7040078e519574d076744dcdd6437d2916b80a3 (diff)
downloadserenity-ba98666b057f04dc21493820f55376a62be4bd36.zip
DisplayProperties: Add a menubar
Add a menubar to the `DisplayProperties` application to make it more consistent with the other programs in the system.
Diffstat (limited to 'Applications/DisplayProperties')
-rw-r--r--Applications/DisplayProperties/main.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/Applications/DisplayProperties/main.cpp b/Applications/DisplayProperties/main.cpp
index d1c840b8c6..2f1e7fcf71 100644
--- a/Applications/DisplayProperties/main.cpp
+++ b/Applications/DisplayProperties/main.cpp
@@ -1,7 +1,11 @@
#include "DisplayProperties.h"
#include <LibDraw/PNGLoader.h>
+#include <LibGUI/GAboutDialog.h>
+#include <LibGUI/GAction.h>
#include <LibGUI/GApplication.h>
#include <LibGUI/GBoxLayout.h>
+#include <LibGUI/GMenu.h>
+#include <LibGUI/GMenuBar.h>
#include <LibGUI/GWidget.h>
#include <LibGUI/GWindow.h>
@@ -12,12 +16,28 @@ int main(int argc, char** argv)
auto window = GWindow::construct();
window->set_title("Display Properties");
- window->move_to(100,100);
+ window->move_to(100, 100);
window->resize(400, 448);
window->set_resizable(false);
window->set_main_widget(instance.root_widget());
window->set_icon(load_png("/res/icons/16x16/app-display-properties.png"));
+ // Let's create the menubar first
+ auto menubar = make<GMenuBar>();
+
+ auto app_menu = GMenu::construct("Display Properties");
+ app_menu->add_action(GCommonActions::make_quit_action([&](const GAction&) {
+ app.quit();
+ }));
+ menubar->add_menu(move(app_menu));
+
+ auto help_menu = GMenu::construct("Help");
+ help_menu->add_action(GAction::create("About", [&](const GAction&) {
+ GAboutDialog::show("Display Properties", load_png("/res/icons/32x32/app-display-properties.png"), window);
+ }));
+ menubar->add_menu(move(help_menu));
+
+ app.set_menubar(move(menubar));
window->show();
return app.exec();
}