Base+Demos: Add icons to WidgetGallery

This commit is contained in:
thankyouverycool 2020-07-08 14:44:32 -04:00 committed by Andreas Kling
parent ce5ae83963
commit 066ae29c07
Notes: sideshowbarker 2024-07-19 05:00:47 +09:00
4 changed files with 25 additions and 1 deletions

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 471 B

View file

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