mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
WidgetGallery: Add Image component demo for png and animated gif files
This commit is contained in:
parent
49c801f7fd
commit
900aaf68d4
Notes:
sideshowbarker
2024-07-19 05:34:59 +09:00
Author: https://github.com/asliturk Commit: https://github.com/SerenityOS/serenity/commit/900aaf68d4e Pull-request: https://github.com/SerenityOS/serenity/pull/2573
1 changed files with 14 additions and 1 deletions
|
@ -31,6 +31,7 @@
|
|||
#include <LibGUI/CheckBox.h>
|
||||
#include <LibGUI/ColorInput.h>
|
||||
#include <LibGUI/GroupBox.h>
|
||||
#include <LibGUI/Image.h>
|
||||
#include <LibGUI/Label.h>
|
||||
#include <LibGUI/MessageBox.h>
|
||||
#include <LibGUI/ProgressBar.h>
|
||||
|
@ -48,7 +49,7 @@ int main(int argc, char** argv)
|
|||
GUI::Application app(argc, argv);
|
||||
|
||||
auto window = GUI::Window::construct();
|
||||
window->set_rect(100, 100, 400, 487);
|
||||
window->set_rect(100, 100, 433, 487);
|
||||
window->set_title("Widget Gallery");
|
||||
|
||||
auto& root_widget = window->set_main_widget<GUI::Widget>();
|
||||
|
@ -230,6 +231,18 @@ int main(int argc, char** argv)
|
|||
|
||||
tab_msgbox.layout()->add_spacer();
|
||||
|
||||
auto& tab_image = tab_widget.add_tab<GUI::Widget>("Image");
|
||||
tab_image.set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fill);
|
||||
tab_image.set_layout<GUI::VerticalBoxLayout>();
|
||||
tab_image.layout()->set_margins({ 4, 4, 4, 4 });
|
||||
tab_image.layout()->set_spacing(4);
|
||||
|
||||
auto& banner_image = tab_image.add<GUI::Image>();
|
||||
banner_image.load_from_file("/res/brand-banner.png");
|
||||
|
||||
auto& gif_animation_image = tab_image.add<GUI::Image>();
|
||||
gif_animation_image.load_from_file("/res/download-animation.gif");
|
||||
|
||||
window->show();
|
||||
|
||||
return app.exec();
|
||||
|
|
Loading…
Reference in a new issue