mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:17:44 +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:
parent
6e4e3cefb2
commit
62125796c3
1 changed files with 20 additions and 5 deletions
|
@ -11,7 +11,6 @@
|
||||||
#include <LibGUI/BoxLayout.h>
|
#include <LibGUI/BoxLayout.h>
|
||||||
#include <LibGUI/Button.h>
|
#include <LibGUI/Button.h>
|
||||||
#include <LibGUI/Icon.h>
|
#include <LibGUI/Icon.h>
|
||||||
#include <LibGUI/ImageWidget.h>
|
|
||||||
#include <LibGUI/Label.h>
|
#include <LibGUI/Label.h>
|
||||||
#include <LibGUI/Menu.h>
|
#include <LibGUI/Menu.h>
|
||||||
#include <LibGUI/Menubar.h>
|
#include <LibGUI/Menubar.h>
|
||||||
|
@ -70,19 +69,35 @@ int main(int argc, char** argv)
|
||||||
container.set_fixed_height(36);
|
container.set_fixed_height(36);
|
||||||
container.set_layout<GUI::HorizontalBoxLayout>();
|
container.set_layout<GUI::HorizontalBoxLayout>();
|
||||||
|
|
||||||
auto& flag_image = container.add<GUI::ImageWidget>();
|
container.layout()->add_spacer();
|
||||||
flag_image.load_from_file("/res/icons/minesweeper/flag.png");
|
|
||||||
|
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>();
|
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>();
|
auto& face_button = container.add<GUI::Button>();
|
||||||
face_button.set_focus_policy(GUI::FocusPolicy::TabFocus);
|
face_button.set_focus_policy(GUI::FocusPolicy::TabFocus);
|
||||||
face_button.set_button_style(Gfx::ButtonStyle::Coolbar);
|
face_button.set_button_style(Gfx::ButtonStyle::Coolbar);
|
||||||
face_button.set_fixed_size(36, 36);
|
face_button.set_fixed_size(36, 36);
|
||||||
|
|
||||||
auto& time_image = container.add<GUI::ImageWidget>();
|
container.layout()->add_spacer();
|
||||||
time_image.load_from_file("/res/icons/minesweeper/timer.png");
|
|
||||||
|
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>();
|
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) {
|
auto& field = widget.add<Field>(flag_label, time_label, face_button, [&](auto size) {
|
||||||
size.set_height(size.height() + container.min_size().height());
|
size.set_height(size.height() + container.min_size().height());
|
||||||
window->resize(size);
|
window->resize(size);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue