mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Minesweeper: Replace Label with Image component to show flag and timer
This commit is contained in:
parent
0a2dc1f5c0
commit
d0411f3756
Notes:
sideshowbarker
2024-07-19 05:34:35 +09:00
Author: https://github.com/asliturk Commit: https://github.com/SerenityOS/serenity/commit/d0411f37564 Pull-request: https://github.com/SerenityOS/serenity/pull/2573
1 changed files with 9 additions and 4 deletions
|
@ -31,6 +31,7 @@
|
|||
#include <LibGUI/Application.h>
|
||||
#include <LibGUI/BoxLayout.h>
|
||||
#include <LibGUI/Button.h>
|
||||
#include <LibGUI/Image.h>
|
||||
#include <LibGUI/Label.h>
|
||||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/MenuBar.h>
|
||||
|
@ -65,15 +66,19 @@ int main(int argc, char** argv)
|
|||
container.set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
|
||||
container.set_preferred_size(0, 36);
|
||||
container.set_layout<GUI::HorizontalBoxLayout>();
|
||||
auto& flag_icon_label = container.add<GUI::Label>();
|
||||
flag_icon_label.set_icon(Gfx::Bitmap::load_from_file("/res/icons/minesweeper/flag.png"));
|
||||
|
||||
auto& flag_image = container.add<GUI::Image>();
|
||||
flag_image.load_from_file("/res/icons/minesweeper/flag.png");
|
||||
|
||||
auto& flag_label = container.add<GUI::Label>();
|
||||
auto& face_button = container.add<GUI::Button>();
|
||||
face_button.set_button_style(Gfx::ButtonStyle::CoolBar);
|
||||
face_button.set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fill);
|
||||
face_button.set_preferred_size(36, 0);
|
||||
auto& time_icon_label = container.add<GUI::Label>();
|
||||
time_icon_label.set_icon(Gfx::Bitmap::load_from_file("/res/icons/minesweeper/timer.png"));
|
||||
|
||||
auto& time_image = container.add<GUI::Image>();
|
||||
time_image.load_from_file("/res/icons/minesweeper/timer.png");
|
||||
|
||||
auto& time_label = container.add<GUI::Label>();
|
||||
auto& field = widget.add<Field>(flag_label, time_label, face_button, [&](auto size) {
|
||||
size.set_height(size.height() + container.preferred_size().height());
|
||||
|
|
Loading…
Reference in a new issue