summaryrefslogtreecommitdiff
path: root/Userland/Games
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2023-02-16 21:07:06 +0000
committerSam Atkins <atkinssj@gmail.com>2023-02-18 16:56:56 +0000
commit77ad0fdb0726aba2ecaf7ea9764a642671d1fd6f (patch)
tree956e10f4c4713e20c03f4aed06f08133f5fcc2e7 /Userland/Games
parent9561ec15f47fdba66a4e8872fd03aae8d0f2df22 (diff)
downloadserenity-77ad0fdb0726aba2ecaf7ea9764a642671d1fd6f.zip
Userland: Specify margins and spacing in the GUI::Layout constructor
Diffstat (limited to 'Userland/Games')
-rw-r--r--Userland/Games/GameOfLife/main.cpp3
-rw-r--r--Userland/Games/Hearts/Game.cpp4
-rw-r--r--Userland/Games/Hearts/SettingsDialog.cpp9
3 files changed, 5 insertions, 11 deletions
diff --git a/Userland/Games/GameOfLife/main.cpp b/Userland/Games/GameOfLife/main.cpp
index b369f1a5bd..eef4f0c587 100644
--- a/Userland/Games/GameOfLife/main.cpp
+++ b/Userland/Games/GameOfLife/main.cpp
@@ -60,8 +60,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
main_toolbar.layout()->set_margins({ 0, 6 });
auto& board_widget_container = *main_widget->find_descendant_of_type_named<GUI::Widget>("board_widget_container");
- auto board_layout = TRY(board_widget_container.try_set_layout<GUI::VerticalBoxLayout>());
- board_layout->set_spacing(0);
+ (void)TRY(board_widget_container.try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins {}, 0));
auto board_widget = TRY(board_widget_container.try_add<BoardWidget>(board_rows, board_columns));
board_widget->randomize_cells();
diff --git a/Userland/Games/Hearts/Game.cpp b/Userland/Games/Hearts/Game.cpp
index e6e0fe1bca..2996d21c7d 100644
--- a/Userland/Games/Hearts/Game.cpp
+++ b/Userland/Games/Hearts/Game.cpp
@@ -124,9 +124,7 @@ void Game::show_score_card(bool game_over)
auto score_widget = score_dialog->set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
score_widget->set_fill_with_background_color(true);
- auto& layout = score_widget->set_layout<GUI::HorizontalBoxLayout>();
- layout.set_margins(10);
- layout.set_spacing(15);
+ score_widget->set_layout<GUI::HorizontalBoxLayout>(10, 15);
auto& card_container = score_widget->add<GUI::Widget>();
auto& score_card = card_container.add<ScoreCard>(m_players, game_over);
diff --git a/Userland/Games/Hearts/SettingsDialog.cpp b/Userland/Games/Hearts/SettingsDialog.cpp
index f528d11e06..27a4016e03 100644
--- a/Userland/Games/Hearts/SettingsDialog.cpp
+++ b/Userland/Games/Hearts/SettingsDialog.cpp
@@ -22,12 +22,10 @@ SettingsDialog::SettingsDialog(GUI::Window* parent, DeprecatedString player_name
auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
main_widget->set_fill_with_background_color(true);
- auto& layout = main_widget->set_layout<GUI::VerticalBoxLayout>();
- layout.set_margins(4);
+ main_widget->set_layout<GUI::VerticalBoxLayout>(4);
auto& name_box = main_widget->add<GUI::Widget>();
- auto& input_layout = name_box.set_layout<GUI::HorizontalBoxLayout>();
- input_layout.set_spacing(4);
+ name_box.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 4);
auto& name_label = name_box.add<GUI::Label>("Name:");
name_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
@@ -39,8 +37,7 @@ SettingsDialog::SettingsDialog(GUI::Window* parent, DeprecatedString player_name
};
auto& button_box = main_widget->add<GUI::Widget>();
- auto& button_layout = button_box.set_layout<GUI::HorizontalBoxLayout>();
- button_layout.set_spacing(10);
+ button_box.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 12);
button_box.add<GUI::Button>(String::from_utf8_short_string("Cancel"sv)).on_click = [this](auto) {
done(ExecResult::Cancel);