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.
This commit is contained in:
inalone 2021-04-30 23:53:18 +01:00 committed by Linus Groh
parent 51f88cb00d
commit 4dbf40399b
Notes: sideshowbarker 2024-07-18 18:51:01 +09:00
3 changed files with 24 additions and 0 deletions

View file

@ -23,9 +23,12 @@
*/
#include <LibCore/ElapsedTimer.h>
#include <LibGUI/Action.h>
#include <LibGUI/Application.h>
#include <LibGUI/Icon.h>
#include <LibGUI/Label.h>
#include <LibGUI/Menu.h>
#include <LibGUI/Menubar.h>
#include <LibGUI/Painter.h>
#include <LibGUI/Widget.h>
#include <LibGUI/Window.h>
@ -218,6 +221,11 @@ int main(int argc, char** argv)
window->set_resizable(false);
window->resize(640, 400);
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& fire = window->set_main_widget<Fire>();
auto& time = fire.add<GUI::Label>();

View file

@ -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>();

View file

@ -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>
@ -123,6 +126,11 @@ int main(int argc, char** argv)
window->set_resizable(false);
window->resize(WIDTH * 2, HEIGHT * 3);
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>();