mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 03:07:35 +00:00
Userland: Specify margins and spacing in the GUI::Layout constructor
This commit is contained in:
parent
9561ec15f4
commit
77ad0fdb07
64 changed files with 136 additions and 288 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue