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

Userland: Specify margins and spacing in the GUI::Layout constructor

This commit is contained in:
Sam Atkins 2023-02-16 21:07:06 +00:00 committed by Sam Atkins
parent 9561ec15f4
commit 77ad0fdb07
64 changed files with 136 additions and 288 deletions

View file

@ -24,8 +24,7 @@ CoverWizardPage::CoverWizardPage()
m_banner_image_widget->load_from_file("/res/graphics/wizard-banner-simple.png"sv);
m_content_widget = add<Widget>();
m_content_widget->set_layout<VerticalBoxLayout>();
m_content_widget->layout()->set_margins(20);
m_content_widget->set_layout<VerticalBoxLayout>(20);
m_header_label = m_content_widget->add<Label>();
m_header_label->set_font(Gfx::FontDatabase::the().get("Pebbleton", 14, 700, Gfx::FontWidth::Normal, 0));

View file

@ -29,8 +29,7 @@ WizardDialog::WizardDialog(Window* parent_window)
auto main_widget = set_main_widget<Widget>().release_value_but_fixme_should_propagate_errors();
main_widget->set_fill_with_background_color(true);
main_widget->set_layout<VerticalBoxLayout>();
main_widget->layout()->set_spacing(0);
main_widget->set_layout<VerticalBoxLayout>(GUI::Margins {}, 0);
m_page_container_widget = main_widget->add<Widget>();
m_page_container_widget->set_fixed_size(500, 315);
@ -40,10 +39,8 @@ WizardDialog::WizardDialog(Window* parent_window)
separator.set_fixed_height(2);
auto& nav_container_widget = main_widget->add<Widget>();
nav_container_widget.set_layout<HorizontalBoxLayout>();
nav_container_widget.set_layout<HorizontalBoxLayout>(GUI::Margins { 0, 10 }, 0);
nav_container_widget.set_fixed_height(42);
nav_container_widget.layout()->set_margins({ 0, 10 });
nav_container_widget.layout()->set_spacing(0);
nav_container_widget.add_spacer().release_value_but_fixme_should_propagate_errors();
m_back_button = nav_container_widget.add<DialogButton>(String::from_utf8_short_string("< Back"sv));

View file

@ -17,16 +17,14 @@ namespace GUI {
WizardPage::WizardPage(DeprecatedString const& title_text, DeprecatedString const& subtitle_text)
: AbstractWizardPage()
{
set_layout<VerticalBoxLayout>();
layout()->set_spacing(0);
set_layout<VerticalBoxLayout>(GUI::Margins {}, 0);
auto& header_widget = add<Widget>();
header_widget.set_fill_with_background_color(true);
header_widget.set_background_role(Gfx::ColorRole::Base);
header_widget.set_fixed_height(58);
header_widget.set_layout<VerticalBoxLayout>();
header_widget.layout()->set_margins({ 15, 30, 0 });
header_widget.set_layout<VerticalBoxLayout>(GUI::Margins { 15, 30, 0 });
m_title_label = header_widget.add<Label>(title_text);
m_title_label->set_font(Gfx::FontDatabase::default_font().bold_variant());
m_title_label->set_fixed_height(m_title_label->font().glyph_height() + 2);
@ -40,8 +38,7 @@ WizardPage::WizardPage(DeprecatedString const& title_text, DeprecatedString cons
separator.set_fixed_height(2);
m_body_widget = add<Widget>();
m_body_widget->set_layout<VerticalBoxLayout>();
m_body_widget->layout()->set_margins(20);
m_body_widget->set_layout<VerticalBoxLayout>(20);
}
void WizardPage::set_page_title(DeprecatedString const& text)