From 74a18c86c987fd11b085e3e802755ff74ac9f15b Mon Sep 17 00:00:00 2001 From: Jami Kettunen Date: Tue, 31 Dec 2019 00:12:52 +0200 Subject: Applications: Implement some missing MenuBars & AboutDialogs --- Applications/Calculator/main.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'Applications/Calculator/main.cpp') 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 +#include +#include #include +#include #include 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(); + + 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(); } -- cgit v1.2.3