1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:47:35 +00:00

Minesweeper: Tweak main UI layout a little bit

Move the clock/flag icons closer to their respective text labels.
This commit is contained in:
Andreas Kling 2021-05-03 18:07:15 +02:00
parent 6e4e3cefb2
commit 62125796c3

View file

@ -11,7 +11,6 @@
#include <LibGUI/BoxLayout.h>
#include <LibGUI/Button.h>
#include <LibGUI/Icon.h>
#include <LibGUI/ImageWidget.h>
#include <LibGUI/Label.h>
#include <LibGUI/Menu.h>
#include <LibGUI/Menubar.h>
@ -70,19 +69,35 @@ int main(int argc, char** argv)
container.set_fixed_height(36);
container.set_layout<GUI::HorizontalBoxLayout>();
auto& flag_image = container.add<GUI::ImageWidget>();
flag_image.load_from_file("/res/icons/minesweeper/flag.png");
container.layout()->add_spacer();
auto& flag_image = container.add<GUI::Label>();
flag_image.set_icon(Gfx::Bitmap::load_from_file("/res/icons/minesweeper/flag.png"));
flag_image.set_fixed_width(16);
auto& flag_label = container.add<GUI::Label>();
flag_label.set_autosize(true);
flag_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
container.layout()->add_spacer();
auto& face_button = container.add<GUI::Button>();
face_button.set_focus_policy(GUI::FocusPolicy::TabFocus);
face_button.set_button_style(Gfx::ButtonStyle::Coolbar);
face_button.set_fixed_size(36, 36);
auto& time_image = container.add<GUI::ImageWidget>();
time_image.load_from_file("/res/icons/minesweeper/timer.png");
container.layout()->add_spacer();
auto& time_image = container.add<GUI::Label>();
time_image.set_fixed_width(16);
time_image.set_icon(Gfx::Bitmap::load_from_file("/res/icons/minesweeper/timer.png"));
auto& time_label = container.add<GUI::Label>();
time_label.set_autosize(true);
time_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
container.layout()->add_spacer();
auto& field = widget.add<Field>(flag_label, time_label, face_button, [&](auto size) {
size.set_height(size.height() + container.min_size().height());
window->resize(size);