summaryrefslogtreecommitdiff
path: root/Applications/Calculator/main.cpp
diff options
context:
space:
mode:
authorJami Kettunen <jami.kettunen@protonmail.com>2019-12-31 00:12:52 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-12-31 01:46:42 +0100
commit74a18c86c987fd11b085e3e802755ff74ac9f15b (patch)
tree14591ee57983ebe9e34c78f0f63e251821632f34 /Applications/Calculator/main.cpp
parent33b8d37dd3a4f6dd2a5f3d3c2d96b7441ba0a488 (diff)
downloadserenity-74a18c86c987fd11b085e3e802755ff74ac9f15b.zip
Applications: Implement some missing MenuBars & AboutDialogs
Diffstat (limited to 'Applications/Calculator/main.cpp')
-rw-r--r--Applications/Calculator/main.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/Applications/Calculator/main.cpp b/Applications/Calculator/main.cpp
index 85dd112d86..f38251eb42 100644
--- a/Applications/Calculator/main.cpp
+++ b/Applications/Calculator/main.cpp
@@ -1,5 +1,9 @@
#include "CalculatorWidget.h"
+#include <LibDraw/PNGLoader.h>
+#include <LibGUI/GAboutDialog.h>
+#include <LibGUI/GAction.h>
#include <LibGUI/GApplication.h>
+#include <LibGUI/GMenuBar.h>
#include <LibGUI/GWindow.h>
int main(int argc, char** argv)
@@ -16,5 +20,23 @@ int main(int argc, char** argv)
window->show();
window->set_icon(GraphicsBitmap::load_from_file("/res/icons/16x16/app-calculator.png"));
+
+ auto menubar = make<GMenuBar>();
+
+ auto app_menu = GMenu::construct("Calculator");
+ app_menu->add_action(GCommonActions::make_quit_action([](auto&) {
+ GApplication::the().quit(0);
+ return;
+ }));
+ menubar->add_menu(move(app_menu));
+
+ auto help_menu = GMenu::construct("Help");
+ help_menu->add_action(GAction::create("About", [&](const GAction&) {
+ GAboutDialog::show("Calculator", load_png("/res/icons/16x16/app-calculator.png"), window);
+ }));
+ menubar->add_menu(move(help_menu));
+
+ app.set_menubar(move(menubar));
+
return app.exec();
}