diff options
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibGUI/Breadcrumbbar.cpp | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/ColorPicker.cpp | 23 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/CommandPalette.cpp | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/EmojiInputDialog.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/InputBox.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/MessageBox.cpp | 11 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/ProcessChooser.cpp | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/SettingsWindow.cpp | 7 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Statusbar.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Toolbar.cpp | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/ToolbarContainer.cpp | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Wizards/CoverWizardPage.cpp | 3 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp | 7 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/Wizards/WizardPage.cpp | 9 |
14 files changed, 27 insertions, 65 deletions
diff --git a/Userland/Libraries/LibGUI/Breadcrumbbar.cpp b/Userland/Libraries/LibGUI/Breadcrumbbar.cpp index 79b83b3d43..a8db7bf70f 100644 --- a/Userland/Libraries/LibGUI/Breadcrumbbar.cpp +++ b/Userland/Libraries/LibGUI/Breadcrumbbar.cpp @@ -60,8 +60,7 @@ private: Breadcrumbbar::Breadcrumbbar() { - auto& layout = set_layout<HorizontalBoxLayout>(); - layout.set_spacing(0); + set_layout<HorizontalBoxLayout>(GUI::Margins {}, 0); } void Breadcrumbbar::clear_segments() diff --git a/Userland/Libraries/LibGUI/ColorPicker.cpp b/Userland/Libraries/LibGUI/ColorPicker.cpp index f481924c7f..b4d757e47b 100644 --- a/Userland/Libraries/LibGUI/ColorPicker.cpp +++ b/Userland/Libraries/LibGUI/ColorPicker.cpp @@ -207,31 +207,25 @@ void ColorPicker::set_color_has_alpha_channel(bool has_alpha) void ColorPicker::build_ui() { auto root_container = set_main_widget<Widget>().release_value_but_fixme_should_propagate_errors(); - root_container->set_layout<VerticalBoxLayout>(); - root_container->layout()->set_margins(4); + root_container->set_layout<VerticalBoxLayout>(4); root_container->set_fill_with_background_color(true); auto& tab_widget = root_container->add<GUI::TabWidget>(); auto& tab_palette = tab_widget.add_tab<Widget>("Palette"); - tab_palette.set_layout<VerticalBoxLayout>(); - tab_palette.layout()->set_margins(4); - tab_palette.layout()->set_spacing(4); + tab_palette.set_layout<VerticalBoxLayout>(4, 4); build_ui_palette(tab_palette); auto& tab_custom_color = tab_widget.add_tab<Widget>("Custom Color"); - tab_custom_color.set_layout<VerticalBoxLayout>(); - tab_custom_color.layout()->set_margins(4); - tab_custom_color.layout()->set_spacing(4); + tab_custom_color.set_layout<VerticalBoxLayout>(4, 4); build_ui_custom(tab_custom_color); auto& button_container = root_container->add<Widget>(); button_container.set_preferred_height(GUI::SpecialDimension::Fit); - button_container.set_layout<HorizontalBoxLayout>(); - button_container.layout()->set_spacing(4); - button_container.layout()->add_spacer(); + button_container.set_layout<HorizontalBoxLayout>(4); + button_container.add_spacer().release_value_but_fixme_should_propagate_errors(); auto& ok_button = button_container.add<DialogButton>(); ok_button.set_text(String::from_utf8_short_string("OK"sv)); @@ -315,14 +309,11 @@ void ColorPicker::build_ui_custom(Widget& root_container) // Right Side auto& vertical_container = horizontal_container.add<Widget>(); - vertical_container.set_layout<VerticalBoxLayout>(); - vertical_container.layout()->set_margins({ 0, 0, 0, 8 }); + vertical_container.set_layout<VerticalBoxLayout>(GUI::Margins { 0, 0, 0, 8 }); vertical_container.set_min_width(120); auto& preview_container = vertical_container.add<Frame>(); - preview_container.set_layout<VerticalBoxLayout>(); - preview_container.layout()->set_margins(2); - preview_container.layout()->set_spacing(0); + preview_container.set_layout<VerticalBoxLayout>(2, 0); preview_container.set_fixed_height(100); // Current color diff --git a/Userland/Libraries/LibGUI/CommandPalette.cpp b/Userland/Libraries/LibGUI/CommandPalette.cpp index 2d2ad31f7d..4bf7c9c5db 100644 --- a/Userland/Libraries/LibGUI/CommandPalette.cpp +++ b/Userland/Libraries/LibGUI/CommandPalette.cpp @@ -186,8 +186,7 @@ CommandPalette::CommandPalette(GUI::Window& parent_window, ScreenPosition screen main_widget->set_frame_shape(Gfx::FrameShape::Window); 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); m_text_box = main_widget->add<GUI::TextBox>(); m_table_view = main_widget->add<GUI::TableView>(); diff --git a/Userland/Libraries/LibGUI/EmojiInputDialog.cpp b/Userland/Libraries/LibGUI/EmojiInputDialog.cpp index 4d6ba70caf..b0a12d8777 100644 --- a/Userland/Libraries/LibGUI/EmojiInputDialog.cpp +++ b/Userland/Libraries/LibGUI/EmojiInputDialog.cpp @@ -219,9 +219,7 @@ void EmojiInputDialog::update_displayed_emoji() for (size_t row = 0; row < rows && index < m_emojis.size(); ++row) { auto& horizontal_container = m_emojis_widget->add<Widget>(); horizontal_container.set_preferred_height(SpecialDimension::Fit); - - auto& horizontal_layout = horizontal_container.set_layout<HorizontalBoxLayout>(); - horizontal_layout.set_spacing(0); + horizontal_container.set_layout<HorizontalBoxLayout>(GUI::Margins {}, 0); for (size_t column = 0; column < columns; ++column) { bool found_match = false; diff --git a/Userland/Libraries/LibGUI/InputBox.cpp b/Userland/Libraries/LibGUI/InputBox.cpp index 1417727e23..834a0f09c9 100644 --- a/Userland/Libraries/LibGUI/InputBox.cpp +++ b/Userland/Libraries/LibGUI/InputBox.cpp @@ -67,13 +67,10 @@ void InputBox::build() int title_width = widget->font().width(title()) + 24 /* icon, plus a little padding -- not perfect */; int max_width = max(text_width, title_width); - widget->set_layout<VerticalBoxLayout>(); + widget->set_layout<VerticalBoxLayout>(6, 6); widget->set_fill_with_background_color(true); widget->set_preferred_height(SpecialDimension::Fit); - widget->layout()->set_margins(6); - widget->layout()->set_spacing(6); - auto& label_editor_container = widget->add<Widget>(); label_editor_container.set_layout<HorizontalBoxLayout>(); label_editor_container.set_preferred_height(SpecialDimension::Fit); @@ -101,9 +98,8 @@ void InputBox::build() button_container_outer.set_layout<VerticalBoxLayout>(); auto& button_container_inner = button_container_outer.add<Widget>(); - button_container_inner.set_layout<HorizontalBoxLayout>(); + button_container_inner.set_layout<HorizontalBoxLayout>(GUI::Margins {}, 6); button_container_inner.set_preferred_height(SpecialDimension::Fit); - button_container_inner.layout()->set_spacing(6); button_container_inner.add_spacer().release_value_but_fixme_should_propagate_errors(); m_ok_button = button_container_inner.add<DialogButton>(); diff --git a/Userland/Libraries/LibGUI/MessageBox.cpp b/Userland/Libraries/LibGUI/MessageBox.cpp index b76692407a..b056a03d10 100644 --- a/Userland/Libraries/LibGUI/MessageBox.cpp +++ b/Userland/Libraries/LibGUI/MessageBox.cpp @@ -121,15 +121,11 @@ void MessageBox::build() int total_text_height = number_of_lines * padded_text_height; int icon_width = 0; - widget->set_layout<VerticalBoxLayout>(); + widget->set_layout<VerticalBoxLayout>(8, 6); widget->set_fill_with_background_color(true); - widget->layout()->set_margins(8); - widget->layout()->set_spacing(6); - auto& message_container = widget->add<Widget>(); - message_container.set_layout<HorizontalBoxLayout>(); - message_container.layout()->set_spacing(8); + message_container.set_layout<HorizontalBoxLayout>(GUI::Margins {}, 8); if (m_type != Type::None) { auto& icon_image = message_container.add<ImageWidget>(); @@ -147,9 +143,8 @@ void MessageBox::build() label.set_text_alignment(Gfx::TextAlignment::CenterLeft); auto& button_container = widget->add<Widget>(); - button_container.set_layout<HorizontalBoxLayout>(); + button_container.set_layout<HorizontalBoxLayout>(GUI::Margins {}, 8); button_container.set_fixed_height(24); - button_container.layout()->set_spacing(8); constexpr int button_width = 80; int button_count = 0; diff --git a/Userland/Libraries/LibGUI/ProcessChooser.cpp b/Userland/Libraries/LibGUI/ProcessChooser.cpp index 58f6d545ac..bbf8db72f1 100644 --- a/Userland/Libraries/LibGUI/ProcessChooser.cpp +++ b/Userland/Libraries/LibGUI/ProcessChooser.cpp @@ -48,8 +48,7 @@ ProcessChooser::ProcessChooser(StringView window_title, String button_label, Gfx auto& button_container = widget->add<GUI::Widget>(); button_container.set_fixed_height(30); - button_container.set_layout<GUI::HorizontalBoxLayout>(); - button_container.layout()->set_margins({ 0, 4, 0 }); + button_container.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 0, 4, 0 }); button_container.add_spacer().release_value_but_fixme_should_propagate_errors(); auto& select_button = button_container.add<GUI::Button>(m_button_label); diff --git a/Userland/Libraries/LibGUI/SettingsWindow.cpp b/Userland/Libraries/LibGUI/SettingsWindow.cpp index 3e35e1d18d..95bf8a7235 100644 --- a/Userland/Libraries/LibGUI/SettingsWindow.cpp +++ b/Userland/Libraries/LibGUI/SettingsWindow.cpp @@ -34,16 +34,13 @@ ErrorOr<NonnullRefPtr<SettingsWindow>> SettingsWindow::create(DeprecatedString t auto main_widget = TRY(window->set_main_widget<GUI::Widget>()); main_widget->set_fill_with_background_color(true); - (void)TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>()); - main_widget->layout()->set_margins(4); - main_widget->layout()->set_spacing(6); + (void)TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>(4, 6)); window->m_tab_widget = TRY(main_widget->try_add<GUI::TabWidget>()); auto button_container = TRY(main_widget->try_add<GUI::Widget>()); button_container->set_preferred_size({ SpecialDimension::Grow, SpecialDimension::Fit }); - (void)TRY(button_container->try_set_layout<GUI::HorizontalBoxLayout>()); - button_container->layout()->set_spacing(6); + (void)TRY(button_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 6)); if (show_defaults_button == ShowDefaultsButton::Yes) { window->m_reset_button = TRY(button_container->try_add<GUI::DialogButton>(TRY(String::from_utf8("Defaults"sv)))); diff --git a/Userland/Libraries/LibGUI/Statusbar.cpp b/Userland/Libraries/LibGUI/Statusbar.cpp index 911c878d2c..3da3ef5423 100644 --- a/Userland/Libraries/LibGUI/Statusbar.cpp +++ b/Userland/Libraries/LibGUI/Statusbar.cpp @@ -20,9 +20,7 @@ namespace GUI { Statusbar::Statusbar(int count) { set_fixed_height(18); - set_layout<HorizontalBoxLayout>(); - layout()->set_margins(0); - layout()->set_spacing(2); + set_layout<HorizontalBoxLayout>(0, 2); m_corner = add<ResizeCorner>(); set_segment_count(count); diff --git a/Userland/Libraries/LibGUI/Toolbar.cpp b/Userland/Libraries/LibGUI/Toolbar.cpp index d09306eb13..bf1ef4f83c 100644 --- a/Userland/Libraries/LibGUI/Toolbar.cpp +++ b/Userland/Libraries/LibGUI/Toolbar.cpp @@ -34,9 +34,7 @@ Toolbar::Toolbar(Orientation orientation, int button_size) else set_fixed_width(button_size); - set_layout<BoxLayout>(orientation); - layout()->set_spacing(0); - layout()->set_margins({ 2, 2, 2, 2 }); + set_layout<BoxLayout>(orientation, GUI::Margins { 2, 2, 2, 2 }, 0); } class ToolbarButton final : public Button { diff --git a/Userland/Libraries/LibGUI/ToolbarContainer.cpp b/Userland/Libraries/LibGUI/ToolbarContainer.cpp index a583bf593b..49c63b104b 100644 --- a/Userland/Libraries/LibGUI/ToolbarContainer.cpp +++ b/Userland/Libraries/LibGUI/ToolbarContainer.cpp @@ -23,8 +23,7 @@ ToolbarContainer::ToolbarContainer(Gfx::Orientation orientation) set_frame_shape(Gfx::FrameShape::Box); set_frame_shadow(Gfx::FrameShadow::Sunken); - auto& layout = set_layout<VerticalBoxLayout>(); - layout.set_spacing(2); + set_layout<VerticalBoxLayout>(GUI::Margins {}, 2); set_shrink_to_fit(true); } diff --git a/Userland/Libraries/LibGUI/Wizards/CoverWizardPage.cpp b/Userland/Libraries/LibGUI/Wizards/CoverWizardPage.cpp index 338ba3e27c..c054f7968e 100644 --- a/Userland/Libraries/LibGUI/Wizards/CoverWizardPage.cpp +++ b/Userland/Libraries/LibGUI/Wizards/CoverWizardPage.cpp @@ -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)); diff --git a/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp b/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp index d17fc553bc..c9abe0bd37 100644 --- a/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp +++ b/Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp @@ -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)); diff --git a/Userland/Libraries/LibGUI/Wizards/WizardPage.cpp b/Userland/Libraries/LibGUI/Wizards/WizardPage.cpp index 48899acb83..9082392e08 100644 --- a/Userland/Libraries/LibGUI/Wizards/WizardPage.cpp +++ b/Userland/Libraries/LibGUI/Wizards/WizardPage.cpp @@ -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) |