summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2020-07-08 14:44:32 -0400
committerAndreas Kling <kling@serenityos.org>2020-07-08 23:48:26 +0200
commit066ae29c07b4d0f7ba35f93a834e175c238071b0 (patch)
tree52bfca8160c67043b09833e87b35b103cb25f0c8
parentce5ae8396398bfc81b2ee3009992f6bc802e3045 (diff)
downloadserenity-066ae29c07b4d0f7ba35f93a834e175c238071b0.zip
Base+Demos: Add icons to WidgetGallery
-rw-r--r--Base/res/apps/WidgetGallery.af6
-rwxr-xr-xBase/res/icons/16x16/app-widget-gallery.pngbin0 -> 195 bytes
-rwxr-xr-xBase/res/icons/32x32/app-widget-gallery.pngbin0 -> 471 bytes
-rw-r--r--Demos/WidgetGallery/main.cpp20
4 files changed, 25 insertions, 1 deletions
diff --git a/Base/res/apps/WidgetGallery.af b/Base/res/apps/WidgetGallery.af
index 785792191e..536109cea2 100644
--- a/Base/res/apps/WidgetGallery.af
+++ b/Base/res/apps/WidgetGallery.af
@@ -1,4 +1,8 @@
[App]
-Name=WidgetGallery
+Name=Widget Gallery
Executable=/bin/WidgetGallery
Category=Demos
+
+[Icons]
+16x16=/res/icons/16x16/app-widget-gallery.png
+32x32=/res/icons/32x32/app-widget-gallery.png
diff --git a/Base/res/icons/16x16/app-widget-gallery.png b/Base/res/icons/16x16/app-widget-gallery.png
new file mode 100755
index 0000000000..bc0453edb1
--- /dev/null
+++ b/Base/res/icons/16x16/app-widget-gallery.png
Binary files differ
diff --git a/Base/res/icons/32x32/app-widget-gallery.png b/Base/res/icons/32x32/app-widget-gallery.png
new file mode 100755
index 0000000000..9e2963dbad
--- /dev/null
+++ b/Base/res/icons/32x32/app-widget-gallery.png
Binary files differ
diff --git a/Demos/WidgetGallery/main.cpp b/Demos/WidgetGallery/main.cpp
index fce83bac40..46889b1a6e 100644
--- a/Demos/WidgetGallery/main.cpp
+++ b/Demos/WidgetGallery/main.cpp
@@ -26,14 +26,19 @@
*/
#include <LibCore/Timer.h>
+#include <LibGUI/AboutDialog.h>
+#include <LibGUI/Action.h>
#include <LibGUI/Application.h>
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Button.h>
#include <LibGUI/CheckBox.h>
#include <LibGUI/ColorInput.h>
#include <LibGUI/GroupBox.h>
+#include <LibGUI/Icon.h>
#include <LibGUI/Image.h>
#include <LibGUI/Label.h>
+#include <LibGUI/Menu.h>
+#include <LibGUI/MenuBar.h>
#include <LibGUI/MessageBox.h>
#include <LibGUI/ProgressBar.h>
#include <LibGUI/RadioButton.h>
@@ -49,9 +54,22 @@ int main(int argc, char** argv)
{
auto app = GUI::Application::construct(argc, argv);
+ auto app_icon = GUI::Icon::default_icon("app-widget-gallery");
+
auto window = GUI::Window::construct();
window->set_rect(100, 100, 433, 487);
window->set_title("Widget Gallery");
+ window->set_icon(app_icon.bitmap_for_size(16));
+
+ auto menubar = GUI::MenuBar::construct();
+
+ auto& app_menu = menubar->add_menu("Widget Gallery");
+ 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("Widget Gallery", app_icon.bitmap_for_size(32), window);
+ }));
auto& root_widget = window->set_main_widget<GUI::Widget>();
root_widget.set_fill_with_background_color(true);
@@ -314,6 +332,8 @@ int main(int argc, char** argv)
window->set_override_cursor(GUI::StandardCursor::Wait);
};
+ app->set_menubar(move(menubar));
+
window->show();
return app->exec();