mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:37:35 +00:00
Demos: Use GUI::Icon::default_icon to set application icon
This commit is contained in:
parent
3482b9b937
commit
27ead7e2c2
7 changed files with 29 additions and 9 deletions
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <LibCore/ElapsedTimer.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/Label.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
|
@ -206,7 +207,9 @@ int main(int argc, char** argv)
|
|||
cube.set_stat_label(time);
|
||||
|
||||
window->show();
|
||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-cube.png"));
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-cube");
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
|
||||
return app->exec();
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibGUI/AboutDialog.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/MenuBar.h>
|
||||
#include <LibGUI/Window.h>
|
||||
|
@ -78,9 +79,11 @@ int main(int argc, char* argv[])
|
|||
extra_columns = num_eyes % max_in_row;
|
||||
}
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-eyes");
|
||||
|
||||
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_icon(app_icon.bitmap_for_size(16));
|
||||
window->resize(75 * (full_rows > 0 ? max_in_row : extra_columns), 100 * (full_rows + (extra_columns > 0 ? 1 : 0)));
|
||||
window->set_has_alpha_channel(true);
|
||||
|
||||
|
@ -92,7 +95,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
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);
|
||||
GUI::AboutDialog::show("Eyes Demo", app_icon.bitmap_for_size(32), window);
|
||||
}));
|
||||
|
||||
app->set_menubar(move(menubar));
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
|
||||
#include <LibCore/ElapsedTimer.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/Label.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
|
@ -229,7 +230,9 @@ int main(int argc, char** argv)
|
|||
fire.set_stat_label(time);
|
||||
|
||||
window->show();
|
||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-fire.png"));
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-fire");
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
|
||||
return app->exec();
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/Button.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/Label.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
|
@ -34,11 +35,12 @@
|
|||
int main(int argc, char** argv)
|
||||
{
|
||||
auto app = GUI::Application::construct(argc, argv);
|
||||
auto app_icon = GUI::Icon::default_icon("app-hello-world");
|
||||
|
||||
auto window = GUI::Window::construct();
|
||||
window->resize(240, 160);
|
||||
window->set_title("Hello World!");
|
||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-hello-world.png"));
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
|
||||
auto& main_widget = window->set_main_widget<GUI::Widget>();
|
||||
main_widget.set_fill_with_background_color(true);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
|
@ -203,7 +204,9 @@ int main(int argc, char** argv)
|
|||
window->set_title("LibGfx Demo");
|
||||
window->set_resizable(false);
|
||||
window->resize(WIDTH, HEIGHT);
|
||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-libgfx-demo.png"));
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-libgfx-demo");
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
window->set_main_widget<Canvas>();
|
||||
window->show();
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/Frame.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/MenuBar.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
|
@ -172,9 +173,11 @@ private:
|
|||
int main(int argc, char** argv)
|
||||
{
|
||||
auto app = GUI::Application::construct(argc, argv);
|
||||
auto app_icon = GUI::Icon::default_icon("app-mouse");
|
||||
|
||||
auto window = GUI::Window::construct();
|
||||
window->set_title("Mouse button demo");
|
||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-mouse.png"));
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
window->resize(160, 155);
|
||||
|
||||
auto& main_widget = window->set_main_widget<MainFrame>();
|
||||
|
@ -186,7 +189,7 @@ int main(int argc, char** argv)
|
|||
|
||||
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);
|
||||
GUI::AboutDialog::show("Mouse Demo", app_icon.bitmap_for_size(32), window);
|
||||
}));
|
||||
|
||||
app->set_menubar(move(menubar));
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <LibGUI/Action.h>
|
||||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/Event.h>
|
||||
#include <LibGUI/Icon.h>
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
#include <LibGUI/Window.h>
|
||||
|
@ -145,7 +146,9 @@ int main(int argc, char** argv)
|
|||
screensaver_window.update();
|
||||
|
||||
window->show();
|
||||
window->set_icon(Gfx::Bitmap::load_from_file("/res/icons/16x16/app-screensaver.png"));
|
||||
|
||||
auto app_icon = GUI::Icon::default_icon("app-screensaver");
|
||||
window->set_icon(app_icon.bitmap_for_size(16));
|
||||
|
||||
return app->exec();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue