diff options
author | inalone <myles.gordon@protonmail.com> | 2021-04-30 23:53:18 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-05-01 01:11:35 +0200 |
commit | 4dbf40399b2c36a74c0e1ef821e2475c9d30a5f7 (patch) | |
tree | dca6c3150e8246ac011cf0ca3cba68cf3d110a13 /Userland/Demos/LibGfxDemo/main.cpp | |
parent | 51f88cb00d0ab221223b6eea1bc28e133e9d282a (diff) | |
download | serenity-4dbf40399b2c36a74c0e1ef821e2475c9d30a5f7.zip |
Demos: Added Alt+F4 funtionality to demos that lacked it
The Fire, LibGfxDemo and LibGfxScaleDemo demos did not have Alt+F4
functionality as they lacked menubars - I just added basic menubars with
Quit entries to allow this shortcut with the demos that didn't have it.
Diffstat (limited to 'Userland/Demos/LibGfxDemo/main.cpp')
-rw-r--r-- | Userland/Demos/LibGfxDemo/main.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Demos/LibGfxDemo/main.cpp b/Userland/Demos/LibGfxDemo/main.cpp index 653050bc67..0077855bea 100644 --- a/Userland/Demos/LibGfxDemo/main.cpp +++ b/Userland/Demos/LibGfxDemo/main.cpp @@ -4,8 +4,11 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include <LibGUI/Action.h> #include <LibGUI/Application.h> #include <LibGUI/Icon.h> +#include <LibGUI/Menu.h> +#include <LibGUI/Menubar.h> #include <LibGUI/Painter.h> #include <LibGUI/Widget.h> #include <LibGUI/Window.h> @@ -201,6 +204,11 @@ int main(int argc, char** argv) window->set_resizable(false); window->resize(WIDTH, HEIGHT); + auto menubar = GUI::Menubar::construct(); + auto& app_menu = menubar->add_menu("File"); + app_menu.add_action(GUI::CommonActions::make_quit_action([&](auto&) { app->quit(); })); + window->set_menubar(move(menubar)); + auto app_icon = GUI::Icon::default_icon("app-libgfx-demo"); window->set_icon(app_icon.bitmap_for_size(16)); window->set_main_widget<Canvas>(); |