summaryrefslogtreecommitdiff
path: root/Demos
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2020-07-26 23:14:33 +0200
committerAndreas Kling <kling@serenityos.org>2020-07-29 01:34:22 +0200
commit5692fa6c3938d8e49c3ad4b5c82d0eabead1f419 (patch)
treec079ab9a0c60f0fa88ddbc18292bbb62e83d9b01 /Demos
parentbe89627bf593f0b1f819b0ae2f206e091f369acd (diff)
downloadserenity-5692fa6c3938d8e49c3ad4b5c82d0eabead1f419.zip
Eyes: Introduce and use icons
The icons are made using a screenshot which was then scaled down. The 16x16 icon needed some light post-processing to look good.
Diffstat (limited to 'Demos')
-rw-r--r--Demos/Eyes/main.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/Demos/Eyes/main.cpp b/Demos/Eyes/main.cpp
index 11bcea21e9..80f16e403c 100644
--- a/Demos/Eyes/main.cpp
+++ b/Demos/Eyes/main.cpp
@@ -26,8 +26,12 @@
#include "EyesWidget.h"
#include <LibCore/ArgsParser.h>
+#include <LibGUI/AboutDialog.h>
#include <LibGUI/Application.h>
+#include <LibGUI/Menu.h>
+#include <LibGUI/MenuBar.h>
#include <LibGUI/Window.h>
+#include <LibGfx/Bitmap.h>
int main(int argc, char* argv[])
{
@@ -76,10 +80,22 @@ int main(int argc, char* argv[])
auto window = GUI::Window::construct();
window->set_title("Eyes");
+ window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-eyes.png"));
window->set_rect(350, 270, 75 * (full_rows > 0 ? max_in_row : extra_columns), 100 * (full_rows + (extra_columns > 0 ? 1 : 0)));
window->set_has_alpha_channel(true);
auto& eyes = window->set_main_widget<EyesWidget>(num_eyes, full_rows, extra_columns);
+
+ auto menubar = GUI::MenuBar::construct();
+ auto& app_menu = menubar->add_menu("Eyes 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-eyes.png"), window);
+ }));
+
+ app->set_menubar(move(menubar));
window->show();
eyes.track_cursor_globally();