mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
MouseDemo: Add menu, using the new icon :^)
This commit is contained in:
parent
fe178b6234
commit
b80ad2d791
Notes:
sideshowbarker
2024-07-19 06:59:49 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/b80ad2d7918 Pull-request: https://github.com/SerenityOS/serenity/pull/2093
1 changed files with 15 additions and 0 deletions
|
@ -1,9 +1,14 @@
|
|||
#include <LibGUI/AboutDialog.h>
|
||||
#include <LibGUI/Action.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/Frame.h>
|
||||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/MenuBar.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
|
||||
static unsigned s_mouse_button_state;
|
||||
|
||||
|
@ -95,6 +100,16 @@ int main(int argc, char** argv)
|
|||
main_widget.add<MouseButtonIndicator>("Back", GUI::MouseButton::Back);
|
||||
main_widget.add<MouseButtonIndicator>("Forward", GUI::MouseButton::Forward);
|
||||
|
||||
auto menubar = GUI::MenuBar::construct();
|
||||
auto& app_menu = menubar->add_menu("Mouse Demo");
|
||||
app_menu.add_action(GUI::CommonActions::make_quit_action([&](auto&) { app.quit(); }));
|
||||
|
||||
auto& help_menu = menubar->add_menu("Help");
|
||||
help_menu.add_action(GUI::Action::create("About", [&](auto&) {
|
||||
GUI::AboutDialog::show("Mouse Demo", Gfx::Bitmap::load_from_file("/res/icons/32x32/app-mouse.png"), window);
|
||||
}));
|
||||
|
||||
app.set_menubar(move(menubar));
|
||||
window->show();
|
||||
return app.exec();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue