mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:37: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
|
@ -44,8 +44,7 @@ ShutdownDialog::ShutdownDialog()
|
|||
{
|
||||
auto widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
|
||||
widget->set_fill_with_background_color(true);
|
||||
widget->set_layout<GUI::VerticalBoxLayout>();
|
||||
widget->layout()->set_spacing(0);
|
||||
widget->set_layout<GUI::VerticalBoxLayout>(GUI::Margins {}, 0);
|
||||
|
||||
auto& banner_image = widget->add<GUI::ImageWidget>();
|
||||
banner_image.load_from_file("/res/graphics/brand-banner.png"sv);
|
||||
|
@ -55,8 +54,7 @@ ShutdownDialog::ShutdownDialog()
|
|||
|
||||
auto& left_container = content_container.add<GUI::Widget>();
|
||||
left_container.set_fixed_width(60);
|
||||
left_container.set_layout<GUI::VerticalBoxLayout>();
|
||||
left_container.layout()->set_margins({ 12, 0, 0 });
|
||||
left_container.set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 12, 0, 0 });
|
||||
|
||||
auto& icon_wrapper = left_container.add<GUI::Widget>();
|
||||
icon_wrapper.set_fixed_size(32, 48);
|
||||
|
@ -66,8 +64,7 @@ ShutdownDialog::ShutdownDialog()
|
|||
icon_image.set_bitmap(Gfx::Bitmap::load_from_file("/res/icons/32x32/shutdown.png"sv).release_value_but_fixme_should_propagate_errors());
|
||||
|
||||
auto& right_container = content_container.add<GUI::Widget>();
|
||||
right_container.set_layout<GUI::VerticalBoxLayout>();
|
||||
right_container.layout()->set_margins({ 12, 12, 8, 0 });
|
||||
right_container.set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 12, 12, 8, 0 });
|
||||
|
||||
auto& label = right_container.add<GUI::Label>("What would you like to do?");
|
||||
label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
|
||||
|
@ -90,12 +87,11 @@ ShutdownDialog::ShutdownDialog()
|
|||
}
|
||||
}
|
||||
|
||||
right_container.layout()->add_spacer();
|
||||
right_container.add_spacer().release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
auto& button_container = right_container.add<GUI::Widget>();
|
||||
button_container.set_fixed_height(23);
|
||||
button_container.set_layout<GUI::HorizontalBoxLayout>();
|
||||
button_container.layout()->set_spacing(5);
|
||||
button_container.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 5);
|
||||
button_container.add_spacer().release_value_but_fixme_should_propagate_errors();
|
||||
auto& ok_button = button_container.add<GUI::Button>(String::from_utf8_short_string("OK"sv));
|
||||
ok_button.set_fixed_size(80, 23);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue