mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
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:
parent
51f88cb00d
commit
4dbf40399b
Notes:
sideshowbarker
2024-07-18 18:51:01 +09:00
Author: https://github.com/inalone 🔰 Commit: https://github.com/SerenityOS/serenity/commit/4dbf40399b2 Pull-request: https://github.com/SerenityOS/serenity/pull/6767 Issue: https://github.com/SerenityOS/serenity/issues/5940
3 changed files with 24 additions and 0 deletions
|
@ -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>();
|
||||
|
|
|
@ -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>();
|
||||
|
|
|
@ -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>();
|
||||
|
|
Loading…
Reference in a new issue