summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Base/res/devel/templates/serenity-application/main.cpp3
-rw-r--r--Userland/Applets/Audio/main.cpp4
-rw-r--r--Userland/Applications/Assistant/main.cpp7
-rw-r--r--Userland/Applications/Browser/BookmarksBarWidget.cpp4
-rw-r--r--Userland/Applications/Browser/DownloadWidget.cpp3
-rw-r--r--Userland/Applications/Browser/InspectorWidget.cpp21
-rw-r--r--Userland/Applications/Calendar/AddEventDialog.cpp9
-rw-r--r--Userland/Applications/CrashReporter/main.cpp18
-rw-r--r--Userland/Applications/FileManager/PropertiesWindow.cpp7
-rw-r--r--Userland/Applications/ImageViewer/MainWidget.cpp3
-rw-r--r--Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp3
-rw-r--r--Userland/Applications/PDFViewer/SidebarWidget.cpp6
-rw-r--r--Userland/Applications/Piano/MainWidget.cpp7
-rw-r--r--Userland/Applications/Piano/SamplerWidget.cpp7
-rw-r--r--Userland/Applications/PixelPaint/CreateNewImageDialog.cpp3
-rw-r--r--Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp4
-rw-r--r--Userland/Applications/PixelPaint/FilterParams.h3
-rw-r--r--Userland/Applications/PixelPaint/Filters/Bloom.cpp6
-rw-r--r--Userland/Applications/PixelPaint/Filters/FastBoxBlur.cpp12
-rw-r--r--Userland/Applications/PixelPaint/Filters/Sepia.cpp3
-rw-r--r--Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp4
-rw-r--r--Userland/Applications/PixelPaint/PaletteWidget.cpp9
-rw-r--r--Userland/Applications/PixelPaint/ToolPropertiesWidget.cpp3
-rw-r--r--Userland/Applications/PixelPaint/ToolboxWidget.cpp5
-rw-r--r--Userland/Applications/Spreadsheet/CellTypeDialog.cpp27
-rw-r--r--Userland/Applications/Spreadsheet/SpreadsheetView.cpp2
-rw-r--r--Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp6
-rw-r--r--Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp4
-rw-r--r--Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp12
-rw-r--r--Userland/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp3
-rw-r--r--Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp3
-rw-r--r--Userland/Applications/SystemMonitor/ProcessStateWidget.cpp3
-rw-r--r--Userland/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp3
-rw-r--r--Userland/Applications/SystemMonitor/ThreadStackWidget.cpp3
-rw-r--r--Userland/Applications/SystemMonitor/main.cpp3
-rw-r--r--Userland/Applications/Terminal/main.cpp6
-rw-r--r--Userland/Applications/ThemeEditor/MainWidget.cpp8
-rw-r--r--Userland/Demos/CatDog/main.cpp6
-rw-r--r--Userland/Demos/ModelGallery/GalleryWidget.cpp3
-rw-r--r--Userland/DevTools/HackStudio/HackStudioWidget.cpp9
-rw-r--r--Userland/DevTools/Profiler/main.cpp18
-rw-r--r--Userland/DevTools/SQLStudio/MainWidget.cpp3
-rw-r--r--Userland/Games/GameOfLife/main.cpp3
-rw-r--r--Userland/Games/Hearts/Game.cpp4
-rw-r--r--Userland/Games/Hearts/SettingsDialog.cpp9
-rw-r--r--Userland/Libraries/LibGUI/Breadcrumbbar.cpp3
-rw-r--r--Userland/Libraries/LibGUI/ColorPicker.cpp23
-rw-r--r--Userland/Libraries/LibGUI/CommandPalette.cpp3
-rw-r--r--Userland/Libraries/LibGUI/EmojiInputDialog.cpp4
-rw-r--r--Userland/Libraries/LibGUI/InputBox.cpp8
-rw-r--r--Userland/Libraries/LibGUI/MessageBox.cpp11
-rw-r--r--Userland/Libraries/LibGUI/ProcessChooser.cpp3
-rw-r--r--Userland/Libraries/LibGUI/SettingsWindow.cpp7
-rw-r--r--Userland/Libraries/LibGUI/Statusbar.cpp4
-rw-r--r--Userland/Libraries/LibGUI/Toolbar.cpp4
-rw-r--r--Userland/Libraries/LibGUI/ToolbarContainer.cpp3
-rw-r--r--Userland/Libraries/LibGUI/Wizards/CoverWizardPage.cpp3
-rw-r--r--Userland/Libraries/LibGUI/Wizards/WizardDialog.cpp7
-rw-r--r--Userland/Libraries/LibGUI/Wizards/WizardPage.cpp9
-rw-r--r--Userland/Services/NotificationServer/NotificationWindow.cpp4
-rw-r--r--Userland/Services/Taskbar/ClockWidget.cpp13
-rw-r--r--Userland/Services/Taskbar/QuickLaunchWidget.cpp3
-rw-r--r--Userland/Services/Taskbar/ShutdownDialog.cpp14
-rw-r--r--Userland/Services/Taskbar/TaskbarWindow.cpp6
64 files changed, 136 insertions, 288 deletions
diff --git a/Base/res/devel/templates/serenity-application/main.cpp b/Base/res/devel/templates/serenity-application/main.cpp
index 27582ff42f..49a750ba83 100644
--- a/Base/res/devel/templates/serenity-application/main.cpp
+++ b/Base/res/devel/templates/serenity-application/main.cpp
@@ -23,8 +23,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
main_widget->set_fill_with_background_color(true);
- auto layout = TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>());
- layout->set_margins(16);
+ (void)TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>(16));
auto button = TRY(main_widget->try_add<GUI::Button>("Click me!"));
button->on_click = [&](auto) {
diff --git a/Userland/Applets/Audio/main.cpp b/Userland/Applets/Audio/main.cpp
index 01135dd17d..6f4d1c81c8 100644
--- a/Userland/Applets/Audio/main.cpp
+++ b/Userland/Applets/Audio/main.cpp
@@ -82,9 +82,7 @@ private:
m_root_container = TRY(m_slider_window->set_main_widget<GUI::Frame>());
m_root_container->set_fill_with_background_color(true);
- m_root_container->set_layout<GUI::VerticalBoxLayout>();
- m_root_container->layout()->set_margins({ 4 });
- m_root_container->layout()->set_spacing(0);
+ m_root_container->set_layout<GUI::VerticalBoxLayout>(4, 0);
m_root_container->set_frame_shape(Gfx::FrameShape::Window);
m_percent_box = m_root_container->add<GUI::CheckBox>(String::from_utf8_short_string("\xE2\x84\xB9"sv));
diff --git a/Userland/Applications/Assistant/main.cpp b/Userland/Applications/Assistant/main.cpp
index 8a3da7be54..8f7287217f 100644
--- a/Userland/Applications/Assistant/main.cpp
+++ b/Userland/Applications/Assistant/main.cpp
@@ -182,12 +182,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto container = TRY(window->set_main_widget<GUI::Frame>());
container->set_fill_with_background_color(true);
container->set_frame_shape(Gfx::FrameShape::Window);
- auto& layout = container->set_layout<GUI::VerticalBoxLayout>();
- layout.set_margins({ 8 });
+ container->set_layout<GUI::VerticalBoxLayout>(8);
auto& text_box = container->add<GUI::TextBox>();
auto& results_container = container->add<GUI::Widget>();
- auto& results_layout = results_container.set_layout<GUI::VerticalBoxLayout>();
+ results_container.set_layout<GUI::VerticalBoxLayout>();
auto mark_selected_item = [&]() {
for (size_t i = 0; i < app_state.visible_result_count; ++i) {
@@ -250,7 +249,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto update_ui_timer = TRY(Core::Timer::create_single_shot(10, [&] {
results_container.remove_all_children();
- results_layout.set_margins(app_state.visible_result_count ? GUI::Margins { 4, 0, 0, 0 } : GUI::Margins { 0 });
+ results_container.layout()->set_margins(app_state.visible_result_count ? GUI::Margins { 4, 0, 0, 0 } : GUI::Margins { 0 });
for (size_t i = 0; i < app_state.visible_result_count; ++i) {
auto& result = app_state.results[i];
diff --git a/Userland/Applications/Browser/BookmarksBarWidget.cpp b/Userland/Applications/Browser/BookmarksBarWidget.cpp
index 9166057b48..6e9514b95b 100644
--- a/Userland/Applications/Browser/BookmarksBarWidget.cpp
+++ b/Userland/Applications/Browser/BookmarksBarWidget.cpp
@@ -103,9 +103,7 @@ BookmarksBarWidget& BookmarksBarWidget::the()
BookmarksBarWidget::BookmarksBarWidget(DeprecatedString const& bookmarks_file, bool enabled)
{
s_the = this;
- set_layout<GUI::HorizontalBoxLayout>();
- layout()->set_spacing(0);
- layout()->set_margins(2);
+ set_layout<GUI::HorizontalBoxLayout>(2, 0);
set_fixed_height(20);
diff --git a/Userland/Applications/Browser/DownloadWidget.cpp b/Userland/Applications/Browser/DownloadWidget.cpp
index c440eb1311..5155b9e596 100644
--- a/Userland/Applications/Browser/DownloadWidget.cpp
+++ b/Userland/Applications/Browser/DownloadWidget.cpp
@@ -59,8 +59,7 @@ DownloadWidget::DownloadWidget(const URL& url)
m_download->stream_into(*m_output_file_stream);
set_fill_with_background_color(true);
- auto& layout = set_layout<GUI::VerticalBoxLayout>();
- layout.set_margins(4);
+ set_layout<GUI::VerticalBoxLayout>(4);
auto& animation_container = add<GUI::Widget>();
animation_container.set_fixed_height(32);
diff --git a/Userland/Applications/Browser/InspectorWidget.cpp b/Userland/Applications/Browser/InspectorWidget.cpp
index 8e8ad57ee1..08ca2a415c 100644
--- a/Userland/Applications/Browser/InspectorWidget.cpp
+++ b/Userland/Applications/Browser/InspectorWidget.cpp
@@ -77,15 +77,13 @@ InspectorWidget::InspectorWidget()
{
set_fill_with_background_color(true);
- auto& layout = set_layout<GUI::VerticalBoxLayout>();
- layout.set_margins({ 4, 4, 4, 4 });
+ set_layout<GUI::VerticalBoxLayout>(4);
auto& splitter = add<GUI::VerticalSplitter>();
auto& top_tab_widget = splitter.add<GUI::TabWidget>();
auto& dom_tree_container = top_tab_widget.add_tab<GUI::Widget>("DOM");
- dom_tree_container.set_layout<GUI::VerticalBoxLayout>();
- dom_tree_container.layout()->set_margins({ 4, 4, 4, 4 });
+ dom_tree_container.set_layout<GUI::VerticalBoxLayout>(4);
m_dom_tree_view = dom_tree_container.add<GUI::TreeView>();
m_dom_tree_view->on_selection_change = [this] {
const auto& index = m_dom_tree_view->selection().first();
@@ -93,30 +91,25 @@ InspectorWidget::InspectorWidget()
};
auto& accessibility_tree_container = top_tab_widget.add_tab<GUI::Widget>("Accessibility");
- accessibility_tree_container.set_layout<GUI::VerticalBoxLayout>();
- accessibility_tree_container.layout()->set_margins({ 4, 4, 4, 4 });
+ accessibility_tree_container.set_layout<GUI::VerticalBoxLayout>(4);
m_accessibility_tree_view = accessibility_tree_container.add<GUI::TreeView>();
auto& bottom_tab_widget = splitter.add<GUI::TabWidget>();
auto& computed_style_table_container = bottom_tab_widget.add_tab<GUI::Widget>("Computed");
- computed_style_table_container.set_layout<GUI::VerticalBoxLayout>();
- computed_style_table_container.layout()->set_margins({ 4, 4, 4, 4 });
+ computed_style_table_container.set_layout<GUI::VerticalBoxLayout>(4);
m_computed_style_table_view = computed_style_table_container.add<GUI::TableView>();
auto& resolved_style_table_container = bottom_tab_widget.add_tab<GUI::Widget>("Resolved");
- resolved_style_table_container.set_layout<GUI::VerticalBoxLayout>();
- resolved_style_table_container.layout()->set_margins({ 4, 4, 4, 4 });
+ resolved_style_table_container.set_layout<GUI::VerticalBoxLayout>(4);
m_resolved_style_table_view = resolved_style_table_container.add<GUI::TableView>();
auto& custom_properties_table_container = bottom_tab_widget.add_tab<GUI::Widget>("Variables");
- custom_properties_table_container.set_layout<GUI::VerticalBoxLayout>();
- custom_properties_table_container.layout()->set_margins({ 4, 4, 4, 4 });
+ custom_properties_table_container.set_layout<GUI::VerticalBoxLayout>(4);
m_custom_properties_table_view = custom_properties_table_container.add<GUI::TableView>();
auto& box_model_widget = bottom_tab_widget.add_tab<GUI::Widget>("Box Model");
- box_model_widget.set_layout<GUI::VerticalBoxLayout>();
- box_model_widget.layout()->set_margins({ 4, 4, 4, 4 });
+ box_model_widget.set_layout<GUI::VerticalBoxLayout>(4);
m_element_size_view = box_model_widget.add<ElementSizePreviewWidget>();
m_element_size_view->set_should_hide_unnecessary_scrollbars(true);
diff --git a/Userland/Applications/Calendar/AddEventDialog.cpp b/Userland/Applications/Calendar/AddEventDialog.cpp
index 973871ed6c..2e02f94098 100644
--- a/Userland/Applications/Calendar/AddEventDialog.cpp
+++ b/Userland/Applications/Calendar/AddEventDialog.cpp
@@ -33,9 +33,8 @@ AddEventDialog::AddEventDialog(Core::DateTime date_time, Window* parent_window)
widget->set_layout<GUI::VerticalBoxLayout>();
auto& top_container = widget->add<GUI::Widget>();
- top_container.set_layout<GUI::VerticalBoxLayout>();
+ top_container.set_layout<GUI::VerticalBoxLayout>(4);
top_container.set_fixed_height(45);
- top_container.layout()->set_margins(4);
auto& add_label = top_container.add<GUI::Label>("Add title & date:");
add_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
@@ -46,14 +45,12 @@ AddEventDialog::AddEventDialog(Core::DateTime date_time, Window* parent_window)
event_title_textbox.set_fixed_height(20);
auto& middle_container = widget->add<GUI::Widget>();
- middle_container.set_layout<GUI::HorizontalBoxLayout>();
+ middle_container.set_layout<GUI::HorizontalBoxLayout>(4);
middle_container.set_fixed_height(25);
- middle_container.layout()->set_margins(4);
auto& time_container = widget->add<GUI::Widget>();
- time_container.set_layout<GUI::HorizontalBoxLayout>();
+ time_container.set_layout<GUI::HorizontalBoxLayout>(4);
time_container.set_fixed_height(25);
- time_container.layout()->set_margins(4);
auto& starting_month_combo = middle_container.add<GUI::ComboBox>();
starting_month_combo.set_only_allow_values_from_model(true);
diff --git a/Userland/Applications/CrashReporter/main.cpp b/Userland/Applications/CrashReporter/main.cpp
index d17bb5339d..60f67619ca 100644
--- a/Userland/Applications/CrashReporter/main.cpp
+++ b/Userland/Applications/CrashReporter/main.cpp
@@ -216,8 +216,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto& tab_widget = *widget->find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
auto backtrace_tab = TRY(tab_widget.try_add_tab<GUI::Widget>("Backtrace"));
- (void)TRY(backtrace_tab->try_set_layout<GUI::VerticalBoxLayout>());
- backtrace_tab->layout()->set_margins(4);
+ (void)TRY(backtrace_tab->try_set_layout<GUI::VerticalBoxLayout>(4));
auto backtrace_label = TRY(backtrace_tab->try_add<GUI::Label>("A backtrace for each thread alive during the crash is listed below:"));
backtrace_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
@@ -227,8 +226,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
backtrace_tab_widget->set_tab_position(GUI::TabWidget::TabPosition::Bottom);
auto cpu_registers_tab = TRY(tab_widget.try_add_tab<GUI::Widget>("CPU Registers"));
- cpu_registers_tab->set_layout<GUI::VerticalBoxLayout>();
- cpu_registers_tab->layout()->set_margins(4);
+ cpu_registers_tab->set_layout<GUI::VerticalBoxLayout>(4);
auto cpu_registers_label = TRY(cpu_registers_tab->try_add<GUI::Label>("The CPU register state for each thread alive during the crash is listed below:"));
cpu_registers_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
@@ -238,8 +236,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
cpu_registers_tab_widget->set_tab_position(GUI::TabWidget::TabPosition::Bottom);
auto environment_tab = TRY(tab_widget.try_add_tab<GUI::Widget>("Environment"));
- (void)TRY(environment_tab->try_set_layout<GUI::VerticalBoxLayout>());
- environment_tab->layout()->set_margins(4);
+ (void)TRY(environment_tab->try_set_layout<GUI::VerticalBoxLayout>(4));
auto environment_text_editor = TRY(environment_tab->try_add<GUI::TextEditor>());
environment_text_editor->set_text(DeprecatedString::join('\n', environment));
@@ -248,8 +245,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
environment_text_editor->set_should_hide_unnecessary_scrollbars(true);
auto memory_regions_tab = TRY(tab_widget.try_add_tab<GUI::Widget>("Memory Regions"));
- (void)TRY(memory_regions_tab->try_set_layout<GUI::VerticalBoxLayout>());
- memory_regions_tab->layout()->set_margins(4);
+ (void)TRY(memory_regions_tab->try_set_layout<GUI::VerticalBoxLayout>(4));
auto memory_regions_text_editor = TRY(memory_regions_tab->try_add<GUI::TextEditor>());
memory_regions_text_editor->set_text(DeprecatedString::join('\n', memory_regions));
@@ -307,8 +303,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
[&](auto results) -> ErrorOr<void> {
for (auto& backtrace : results.thread_backtraces) {
auto container = TRY(backtrace_tab_widget->try_add_tab<GUI::Widget>(backtrace.title));
- (void)TRY(container->template try_set_layout<GUI::VerticalBoxLayout>());
- container->layout()->set_margins(4);
+ (void)TRY(container->template try_set_layout<GUI::VerticalBoxLayout>(4));
auto backtrace_text_editor = TRY(container->template try_add<GUI::TextEditor>());
backtrace_text_editor->set_text(backtrace.text);
backtrace_text_editor->set_mode(GUI::TextEditor::Mode::ReadOnly);
@@ -319,8 +314,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
for (auto& cpu_registers : results.thread_cpu_registers) {
auto container = TRY(cpu_registers_tab_widget->try_add_tab<GUI::Widget>(cpu_registers.title));
- (void)TRY(container->template try_set_layout<GUI::VerticalBoxLayout>());
- container->layout()->set_margins(4);
+ (void)TRY(container->template try_set_layout<GUI::VerticalBoxLayout>(4));
auto cpu_registers_text_editor = TRY(container->template try_add<GUI::TextEditor>());
cpu_registers_text_editor->set_text(cpu_registers.text);
cpu_registers_text_editor->set_mode(GUI::TextEditor::Mode::ReadOnly);
diff --git a/Userland/Applications/FileManager/PropertiesWindow.cpp b/Userland/Applications/FileManager/PropertiesWindow.cpp
index 47b5a60a04..afebbe3700 100644
--- a/Userland/Applications/FileManager/PropertiesWindow.cpp
+++ b/Userland/Applications/FileManager/PropertiesWindow.cpp
@@ -53,9 +53,7 @@ PropertiesWindow::PropertiesWindow(DeprecatedString const& path, Window* parent_
ErrorOr<void> PropertiesWindow::create_widgets(bool disable_rename)
{
auto main_widget = TRY(set_main_widget<GUI::Widget>());
- (void)TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>());
- main_widget->layout()->set_spacing(6);
- main_widget->layout()->set_margins(4);
+ (void)TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>(4, 6));
main_widget->set_fill_with_background_color(true);
auto tab_widget = TRY(main_widget->try_add<GUI::TabWidget>());
@@ -151,9 +149,8 @@ ErrorOr<void> PropertiesWindow::create_widgets(bool disable_rename)
TRY(setup_permission_checkboxes(*others_read, *others_write, *others_execute, { S_IROTH, S_IWOTH, S_IXOTH }, m_mode));
auto button_widget = TRY(main_widget->try_add<GUI::Widget>());
- (void)TRY(button_widget->try_set_layout<GUI::HorizontalBoxLayout>());
+ (void)TRY(button_widget->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 5));
button_widget->set_fixed_height(22);
- button_widget->layout()->set_spacing(5);
TRY(button_widget->add_spacer());
diff --git a/Userland/Applications/ImageViewer/MainWidget.cpp b/Userland/Applications/ImageViewer/MainWidget.cpp
index 70b04f33c0..a585288c49 100644
--- a/Userland/Applications/ImageViewer/MainWidget.cpp
+++ b/Userland/Applications/ImageViewer/MainWidget.cpp
@@ -11,8 +11,7 @@ namespace ImageViewer {
MainWidget::MainWidget()
{
set_fill_with_background_color(true);
- set_layout<GUI::VerticalBoxLayout>();
- layout()->set_spacing(2);
+ set_layout<GUI::VerticalBoxLayout>(GUI::Margins {}, 2);
}
void MainWidget::keydown_event(GUI::KeyEvent& event)
diff --git a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp
index 8ddcbe394f..738e102d3e 100644
--- a/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp
+++ b/Userland/Applications/KeyboardMapper/KeyboardMapperWidget.cpp
@@ -39,8 +39,7 @@ bool KeyboardMapperWidget::request_close()
void KeyboardMapperWidget::create_frame()
{
set_fill_with_background_color(true);
- set_layout<GUI::VerticalBoxLayout>();
- layout()->set_margins(4);
+ set_layout<GUI::VerticalBoxLayout>(4);
auto& main_widget = add<GUI::Widget>();
main_widget.set_relative_rect(0, 0, 200, 200);
diff --git a/Userland/Applications/PDFViewer/SidebarWidget.cpp b/Userland/Applications/PDFViewer/SidebarWidget.cpp
index 35ca3df457..cb3cc14201 100644
--- a/Userland/Applications/PDFViewer/SidebarWidget.cpp
+++ b/Userland/Applications/PDFViewer/SidebarWidget.cpp
@@ -18,8 +18,7 @@ SidebarWidget::SidebarWidget()
auto& tab_bar = add<GUI::TabWidget>();
auto& outline_container = tab_bar.add_tab<GUI::Widget>("Outline");
- outline_container.set_layout<GUI::VerticalBoxLayout>();
- outline_container.layout()->set_margins(4);
+ outline_container.set_layout<GUI::VerticalBoxLayout>(4);
m_outline_tree_view = outline_container.add<GUI::TreeView>();
m_outline_tree_view->set_activates_on_selection(true);
@@ -34,8 +33,7 @@ SidebarWidget::SidebarWidget()
};
auto& thumbnails_container = tab_bar.add_tab<GUI::Widget>("Thumbnails");
- thumbnails_container.set_layout<GUI::VerticalBoxLayout>();
- thumbnails_container.layout()->set_margins(4);
+ thumbnails_container.set_layout<GUI::VerticalBoxLayout>(4);
// FIXME: Add thumbnail previews
}
diff --git a/Userland/Applications/Piano/MainWidget.cpp b/Userland/Applications/Piano/MainWidget.cpp
index 293cda7efe..351eb8032e 100644
--- a/Userland/Applications/Piano/MainWidget.cpp
+++ b/Userland/Applications/Piano/MainWidget.cpp
@@ -34,9 +34,7 @@ MainWidget::MainWidget(TrackManager& track_manager, AudioPlayerLoop& loop)
ErrorOr<void> MainWidget::initialize()
{
- (void)TRY(try_set_layout<GUI::VerticalBoxLayout>());
- layout()->set_spacing(2);
- layout()->set_margins(2);
+ (void)TRY(try_set_layout<GUI::VerticalBoxLayout>(2, 2));
set_fill_with_background_color(true);
m_wave_widget = TRY(try_add<WaveWidget>(m_track_manager));
@@ -51,8 +49,7 @@ ErrorOr<void> MainWidget::initialize()
m_player_widget = TRY(try_add<PlayerWidget>(m_track_manager, m_audio_loop));
m_keys_and_knobs_container = TRY(try_add<GUI::Widget>());
- (void)TRY(m_keys_and_knobs_container->try_set_layout<GUI::HorizontalBoxLayout>());
- m_keys_and_knobs_container->layout()->set_spacing(2);
+ (void)TRY(m_keys_and_knobs_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 2));
m_keys_and_knobs_container->set_fixed_height(130);
m_keys_and_knobs_container->set_fill_with_background_color(true);
diff --git a/Userland/Applications/Piano/SamplerWidget.cpp b/Userland/Applications/Piano/SamplerWidget.cpp
index 26ac5fdb6c..bfe7e4f779 100644
--- a/Userland/Applications/Piano/SamplerWidget.cpp
+++ b/Userland/Applications/Piano/SamplerWidget.cpp
@@ -40,14 +40,11 @@ void WaveEditor::paint_event(GUI::PaintEvent& event)
SamplerWidget::SamplerWidget(TrackManager& track_manager)
: m_track_manager(track_manager)
{
- set_layout<GUI::VerticalBoxLayout>();
- layout()->set_margins(10);
- layout()->set_spacing(10);
+ set_layout<GUI::VerticalBoxLayout>(10, 10);
set_fill_with_background_color(true);
m_open_button_and_recorded_sample_name_container = add<GUI::Widget>();
- m_open_button_and_recorded_sample_name_container->set_layout<GUI::HorizontalBoxLayout>();
- m_open_button_and_recorded_sample_name_container->layout()->set_spacing(10);
+ m_open_button_and_recorded_sample_name_container->set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 10);
m_open_button_and_recorded_sample_name_container->set_fixed_height(24);
m_open_button = m_open_button_and_recorded_sample_name_container->add<GUI::Button>();
diff --git a/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp b/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp
index 51999deca5..dec5c81ed9 100644
--- a/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp
+++ b/Userland/Applications/PixelPaint/CreateNewImageDialog.cpp
@@ -30,8 +30,7 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window)
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_label = main_widget->add<GUI::Label>("Name:");
name_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
diff --git a/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp b/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp
index f22569127a..b18123887f 100644
--- a/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp
+++ b/Userland/Applications/PixelPaint/CreateNewLayerDialog.cpp
@@ -22,9 +22,7 @@ CreateNewLayerDialog::CreateNewLayerDialog(Gfx::IntSize suggested_size, GUI::Win
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_label = main_widget->add<GUI::Label>("Name:");
name_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
diff --git a/Userland/Applications/PixelPaint/FilterParams.h b/Userland/Applications/PixelPaint/FilterParams.h
index 30c14168aa..e8d0d02b94 100644
--- a/Userland/Applications/PixelPaint/FilterParams.h
+++ b/Userland/Applications/PixelPaint/FilterParams.h
@@ -52,8 +52,7 @@ private:
main_widget->set_frame_shape(Gfx::FrameShape::Container);
main_widget->set_frame_shadow(Gfx::FrameShadow::Raised);
main_widget->set_fill_with_background_color(true);
- auto& layout = main_widget->template set_layout<GUI::VerticalBoxLayout>();
- layout.set_margins(4);
+ main_widget->template set_layout<GUI::VerticalBoxLayout>(4);
size_t index = 0;
size_t columns = N;
diff --git a/Userland/Applications/PixelPaint/Filters/Bloom.cpp b/Userland/Applications/PixelPaint/Filters/Bloom.cpp
index 3c504742ba..f2b106b98f 100644
--- a/Userland/Applications/PixelPaint/Filters/Bloom.cpp
+++ b/Userland/Applications/PixelPaint/Filters/Bloom.cpp
@@ -47,8 +47,7 @@ ErrorOr<RefPtr<GUI::Widget>> Bloom::get_settings_widget()
auto luma_lower_container = TRY(settings_widget->try_add<GUI::Widget>());
luma_lower_container->set_fixed_height(50);
- auto luma_lower_container_layout = TRY(luma_lower_container->try_set_layout<GUI::VerticalBoxLayout>());
- luma_lower_container_layout->set_margins({ 4, 0, 4, 0 });
+ (void)TRY(luma_lower_container->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
auto luma_lower_label = TRY(luma_lower_container->try_add<GUI::Label>("Luma lower bound:"));
luma_lower_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
@@ -64,8 +63,7 @@ ErrorOr<RefPtr<GUI::Widget>> Bloom::get_settings_widget()
auto radius_container = TRY(settings_widget->try_add<GUI::Widget>());
radius_container->set_fixed_height(50);
- auto radius_container_layout = TRY(radius_container->try_set_layout<GUI::VerticalBoxLayout>());
- radius_container_layout->set_margins({ 4, 0, 4, 0 });
+ (void)TRY(radius_container->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
auto radius_label = TRY(radius_container->try_add<GUI::Label>("Blur Radius:"));
radius_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
diff --git a/Userland/Applications/PixelPaint/Filters/FastBoxBlur.cpp b/Userland/Applications/PixelPaint/Filters/FastBoxBlur.cpp
index 4734ad30e2..aa4a26e4ea 100644
--- a/Userland/Applications/PixelPaint/Filters/FastBoxBlur.cpp
+++ b/Userland/Applications/PixelPaint/Filters/FastBoxBlur.cpp
@@ -86,8 +86,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
m_radius_container = TRY(settings_widget->try_add<GUI::Widget>());
m_radius_container->set_fixed_height(20);
- auto radius_container_layout = TRY(m_radius_container->try_set_layout<GUI::HorizontalBoxLayout>());
- radius_container_layout->set_margins({ 4, 0, 4, 0 });
+ (void)TRY(m_radius_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
auto radius_label = TRY(m_radius_container->try_add<GUI::Label>("Radius:"));
radius_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
@@ -104,8 +103,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
m_asymmetric_radius_container = TRY(settings_widget->try_add<GUI::Widget>());
m_asymmetric_radius_container->set_visible(false);
m_asymmetric_radius_container->set_fixed_height(50);
- auto asymmetric_radius_container_label = TRY(m_asymmetric_radius_container->try_set_layout<GUI::VerticalBoxLayout>());
- asymmetric_radius_container_label->set_margins({ 4, 0, 4, 0 });
+ (void)TRY(m_asymmetric_radius_container->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
auto radius_x_container = TRY(m_asymmetric_radius_container->try_add<GUI::Widget>());
radius_x_container->set_fixed_height(20);
@@ -142,8 +140,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
m_vector_container = TRY(settings_widget->try_add<GUI::Widget>());
m_vector_container->set_visible(false);
m_vector_container->set_fixed_height(50);
- auto vector_container_layout = TRY(m_vector_container->try_set_layout<GUI::VerticalBoxLayout>());
- vector_container_layout->set_margins({ 4, 0, 4, 0 });
+ (void)TRY(m_vector_container->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
auto angle_container = TRY(m_vector_container->try_add<GUI::Widget>());
angle_container->set_fixed_height(20);
@@ -179,8 +176,7 @@ ErrorOr<RefPtr<GUI::Widget>> FastBoxBlur::get_settings_widget()
auto gaussian_container = TRY(settings_widget->try_add<GUI::Widget>());
gaussian_container->set_fixed_height(20);
- auto gaussian_container_layout = TRY(gaussian_container->try_set_layout<GUI::HorizontalBoxLayout>());
- gaussian_container_layout->set_margins({ 4, 0, 4, 0 });
+ (void)TRY(gaussian_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
m_gaussian_checkbox = TRY(gaussian_container->try_add<GUI::CheckBox>(TRY(String::from_utf8("Approximate Gaussian Blur"sv))));
m_gaussian_checkbox->set_checked(m_approximate_gauss);
diff --git a/Userland/Applications/PixelPaint/Filters/Sepia.cpp b/Userland/Applications/PixelPaint/Filters/Sepia.cpp
index 438bb4487b..c32a2037d8 100644
--- a/Userland/Applications/PixelPaint/Filters/Sepia.cpp
+++ b/Userland/Applications/PixelPaint/Filters/Sepia.cpp
@@ -30,8 +30,7 @@ ErrorOr<RefPtr<GUI::Widget>> Sepia::get_settings_widget()
auto amount_container = TRY(settings_widget->try_add<GUI::Widget>());
amount_container->set_fixed_height(20);
- auto amount_layout = TRY(amount_container->try_set_layout<GUI::HorizontalBoxLayout>());
- amount_layout->set_margins({ 4, 0, 4, 0 });
+ (void)TRY(amount_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 4, 0, 4, 0 }));
auto amount_label = TRY(amount_container->try_add<GUI::Label>("Amount:"));
amount_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);
diff --git a/Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp b/Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp
index 96ec8d72da..f436773540 100644
--- a/Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp
+++ b/Userland/Applications/PixelPaint/LayerPropertiesWidget.cpp
@@ -24,9 +24,7 @@ LayerPropertiesWidget::LayerPropertiesWidget()
set_layout<GUI::VerticalBoxLayout>();
auto& group_box = add<GUI::GroupBox>("Layer properties"sv);
- auto& layout = group_box.set_layout<GUI::VerticalBoxLayout>();
-
- layout.set_margins({ 8 });
+ group_box.set_layout<GUI::VerticalBoxLayout>(8);
auto& name_container = group_box.add<GUI::Widget>();
name_container.set_fixed_height(20);
diff --git a/Userland/Applications/PixelPaint/PaletteWidget.cpp b/Userland/Applications/PixelPaint/PaletteWidget.cpp
index b5dd9b0833..7b53dde7eb 100644
--- a/Userland/Applications/PixelPaint/PaletteWidget.cpp
+++ b/Userland/Applications/PixelPaint/PaletteWidget.cpp
@@ -118,18 +118,15 @@ PaletteWidget::PaletteWidget()
m_color_container = add<GUI::Widget>();
m_color_container->set_relative_rect(m_secondary_color_widget->relative_rect().right() + 2, 2, 500, 33);
- m_color_container->set_layout<GUI::VerticalBoxLayout>();
- m_color_container->layout()->set_spacing(1);
+ m_color_container->set_layout<GUI::VerticalBoxLayout>(GUI::Margins {}, 1);
auto& top_color_container = m_color_container->add<GUI::Widget>();
top_color_container.set_name("top_color_container");
- top_color_container.set_layout<GUI::HorizontalBoxLayout>();
- top_color_container.layout()->set_spacing(1);
+ top_color_container.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 1);
auto& bottom_color_container = m_color_container->add<GUI::Widget>();
bottom_color_container.set_name("bottom_color_container");
- bottom_color_container.set_layout<GUI::HorizontalBoxLayout>();
- bottom_color_container.layout()->set_spacing(1);
+ bottom_color_container.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 1);
auto result = load_palette_path("/res/color-palettes/default.palette");
if (result.is_error()) {
diff --git a/Userland/Applications/PixelPaint/ToolPropertiesWidget.cpp b/Userland/Applications/PixelPaint/ToolPropertiesWidget.cpp
index cd0642165e..299ba1dda6 100644
--- a/Userland/Applications/PixelPaint/ToolPropertiesWidget.cpp
+++ b/Userland/Applications/PixelPaint/ToolPropertiesWidget.cpp
@@ -20,8 +20,7 @@ ToolPropertiesWidget::ToolPropertiesWidget()
set_layout<GUI::VerticalBoxLayout>();
m_group_box = add<GUI::GroupBox>("Tool properties"sv);
- auto& layout = m_group_box->set_layout<GUI::VerticalBoxLayout>();
- layout.set_margins({ 8 });
+ m_group_box->set_layout<GUI::VerticalBoxLayout>(8);
m_tool_widget_stack = m_group_box->add<GUI::StackWidget>();
m_blank_widget = m_tool_widget_stack->add<GUI::Widget>();
m_error_label = m_tool_widget_stack->add<GUI::Label>();
diff --git a/Userland/Applications/PixelPaint/ToolboxWidget.cpp b/Userland/Applications/PixelPaint/ToolboxWidget.cpp
index f116871d60..f8bb4341f1 100644
--- a/Userland/Applications/PixelPaint/ToolboxWidget.cpp
+++ b/Userland/Applications/PixelPaint/ToolboxWidget.cpp
@@ -39,10 +39,7 @@ ToolboxWidget::ToolboxWidget()
set_fill_with_background_color(true);
set_fixed_width(26);
-
- set_layout<GUI::VerticalBoxLayout>();
- layout()->set_spacing(0);
- layout()->set_margins(2);
+ set_layout<GUI::VerticalBoxLayout>(2, 0);
m_action_group.set_exclusive(true);
m_action_group.set_unchecking_allowed(false);
diff --git a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp
index de0f822e7e..4e38fe7413 100644
--- a/Userland/Applications/Spreadsheet/CellTypeDialog.cpp
+++ b/Userland/Applications/Spreadsheet/CellTypeDialog.cpp
@@ -46,7 +46,7 @@ CellTypeDialog::CellTypeDialog(Vector<Position> const& positions, Sheet& sheet,
resize(285, 360);
auto main_widget = set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
- main_widget->set_layout<GUI::VerticalBoxLayout>().set_margins(4);
+ main_widget->set_layout<GUI::VerticalBoxLayout>(4);
main_widget->set_fill_with_background_color(true);
auto& tab_widget = main_widget->add<GUI::TabWidget>();
@@ -54,8 +54,7 @@ CellTypeDialog::CellTypeDialog(Vector<Position> const& positions, Sheet& sheet,
auto& buttonbox = main_widget->add<GUI::Widget>();
buttonbox.set_shrink_to_fit(true);
- auto& button_layout = buttonbox.set_layout<GUI::HorizontalBoxLayout>();
- button_layout.set_spacing(10);
+ buttonbox.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 10);
buttonbox.add_spacer().release_value_but_fixme_should_propagate_errors();
auto& ok_button = buttonbox.add<GUI::Button>(String::from_utf8_short_string("OK"sv));
ok_button.set_fixed_width(80);
@@ -134,7 +133,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& po
}
auto& type_tab = tabs.add_tab<GUI::Widget>("Type");
- type_tab.set_layout<GUI::HorizontalBoxLayout>().set_margins(4);
+ type_tab.set_layout<GUI::HorizontalBoxLayout>(4);
{
auto& left_side = type_tab.add<GUI::Widget>();
left_side.set_layout<GUI::VerticalBoxLayout>();
@@ -199,14 +198,13 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& po
}
auto& alignment_tab = tabs.add_tab<GUI::Widget>("Alignment");
- alignment_tab.set_layout<GUI::VerticalBoxLayout>().set_margins(4);
+ alignment_tab.set_layout<GUI::VerticalBoxLayout>(4);
{
// FIXME: Frame?
// Horizontal alignment
{
auto& horizontal_alignment_selection_container = alignment_tab.add<GUI::Widget>();
- horizontal_alignment_selection_container.set_layout<GUI::HorizontalBoxLayout>();
- horizontal_alignment_selection_container.layout()->set_margins({ 4, 0, 0 });
+ horizontal_alignment_selection_container.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 4, 0, 0 });
horizontal_alignment_selection_container.set_fixed_height(22);
auto& horizontal_alignment_label = horizontal_alignment_selection_container.add<GUI::Label>();
@@ -237,8 +235,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& po
// Vertical alignment
{
auto& vertical_alignment_container = alignment_tab.add<GUI::Widget>();
- vertical_alignment_container.set_layout<GUI::HorizontalBoxLayout>();
- vertical_alignment_container.layout()->set_margins({ 4, 0, 0 });
+ vertical_alignment_container.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 4, 0, 0 });
vertical_alignment_container.set_fixed_height(22);
auto& vertical_alignment_label = vertical_alignment_container.add<GUI::Label>();
@@ -268,7 +265,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& po
}
auto& colors_tab = tabs.add_tab<GUI::Widget>("Color");
- colors_tab.set_layout<GUI::VerticalBoxLayout>().set_margins(4);
+ colors_tab.set_layout<GUI::VerticalBoxLayout>(4);
{
// Static formatting
{
@@ -279,8 +276,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& po
{
// FIXME: Somehow allow unsetting these.
auto& foreground_container = static_formatting_container.add<GUI::Widget>();
- foreground_container.set_layout<GUI::HorizontalBoxLayout>();
- foreground_container.layout()->set_margins({ 4, 0, 0 });
+ foreground_container.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 4, 0, 0 });
foreground_container.set_preferred_height(GUI::SpecialDimension::Fit);
auto& foreground_label = foreground_container.add<GUI::Label>();
@@ -299,8 +295,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, Vector<Position> const& po
{
// FIXME: Somehow allow unsetting these.
auto& background_container = static_formatting_container.add<GUI::Widget>();
- background_container.set_layout<GUI::HorizontalBoxLayout>();
- background_container.layout()->set_margins({ 4, 0, 0 });
+ background_container.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 4, 0, 0 });
background_container.set_preferred_height(GUI::SpecialDimension::Fit);
auto& background_label = background_container.add<GUI::Label>();
@@ -427,9 +422,7 @@ ConditionView::~ConditionView()
ConditionsView::ConditionsView()
{
- auto& layout = set_layout<GUI::VerticalBoxLayout>();
- layout.set_spacing(4);
- layout.set_margins({ 6 });
+ set_layout<GUI::VerticalBoxLayout>(6, 4);
}
void ConditionsView::set_formats(Vector<ConditionalFormat>* formats)
diff --git a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp
index 0dc712e119..a7f37e9d66 100644
--- a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp
+++ b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp
@@ -305,7 +305,7 @@ SpreadsheetView::SpreadsheetView(Sheet& sheet)
: m_sheet(sheet)
, m_sheet_model(SheetModel::create(*m_sheet))
{
- set_layout<GUI::VerticalBoxLayout>().set_margins(2);
+ set_layout<GUI::VerticalBoxLayout>(2);
m_table_view = add<InfinitelyScrollableTableView>();
m_table_view->set_grid_style(GUI::TableView::GridStyle::Both);
m_table_view->set_selection_behavior(GUI::AbstractView::SelectionBehavior::SelectItems);
diff --git a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp
index 5d8fcc72fa..d0a802e1f2 100644
--- a/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp
+++ b/Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp
@@ -31,7 +31,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe
: m_workbook(make<Workbook>(move(sheets), parent_window))
{
set_fill_with_background_color(true);
- set_layout<GUI::VerticalBoxLayout>().set_margins(2);
+ set_layout<GUI::VerticalBoxLayout>(2);
auto& toolbar_container = add<GUI::ToolbarContainer>();
auto& toolbar = toolbar_container.add<GUI::Toolbar>();
@@ -39,7 +39,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe
auto& container = add<GUI::VerticalSplitter>();
auto& top_bar = container.add<GUI::Frame>();
- top_bar.set_layout<GUI::HorizontalBoxLayout>().set_spacing(1);
+ top_bar.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 1);
top_bar.set_preferred_height(26);
auto& current_cell_label = top_bar.add<GUI::Label>("");
current_cell_label.set_fixed_width(50);
@@ -83,7 +83,7 @@ SpreadsheetWidget::SpreadsheetWidget(GUI::Window& parent_window, NonnullRefPtrVe
m_inline_documentation_window->set_resizable(false);
auto inline_widget = m_inline_documentation_window->set_main_widget<GUI::Frame>().release_value_but_fixme_should_propagate_errors();
inline_widget->set_fill_with_background_color(true);
- inline_widget->set_layout<GUI::VerticalBoxLayout>().set_margins(4);
+ inline_widget->set_layout<GUI::VerticalBoxLayout>(4);
inline_widget->set_frame_shape(Gfx::FrameShape::Box);
m_inline_documentation_label = inline_widget->add<GUI::Label>();
m_inline_documentation_label->set_fill_with_background_color(true);
diff --git a/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp b/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp
index 5c952bae9b..7f39c063a3 100644
--- a/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp
+++ b/Userland/Applications/SystemMonitor/MemoryStatsWidget.cpp
@@ -43,9 +43,7 @@ MemoryStatsWidget::MemoryStatsWidget(GraphWidget* graph)
set_fixed_height(110);
- set_layout<GUI::VerticalBoxLayout>();
- layout()->set_margins({ 8, 0, 0 });
- layout()->set_spacing(3);
+ set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 8, 0, 0 }, 3);
auto build_widgets_for_label = [this](DeprecatedString const& description) -> RefPtr<GUI::Label> {
auto& container = add<GUI::Widget>();
diff --git a/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp b/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp
index e1d4db4f5d..c09ec480d9 100644
--- a/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp
+++ b/Userland/Applications/SystemMonitor/NetworkStatisticsWidget.cpp
@@ -22,8 +22,7 @@ namespace SystemMonitor {
NetworkStatisticsWidget::NetworkStatisticsWidget()
{
on_first_show = [this](auto&) {
- set_layout<GUI::VerticalBoxLayout>();
- layout()->set_margins(4);
+ set_layout<GUI::VerticalBoxLayout>(4);
set_fill_with_background_color(true);
m_network_connected_bitmap = Gfx::Bitmap::load_from_file("/res/icons/16x16/network-connected.png"sv).release_value_but_fixme_should_propagate_errors();
@@ -38,8 +37,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
}
auto& adapters_group_box = add<GUI::GroupBox>("Adapters"sv);
- adapters_group_box.set_layout<GUI::VerticalBoxLayout>();
- adapters_group_box.layout()->set_margins(6);
+ adapters_group_box.set_layout<GUI::VerticalBoxLayout>(6);
adapters_group_box.set_fixed_height(120);
m_adapter_table_view = adapters_group_box.add<GUI::TableView>();
@@ -94,8 +92,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
};
auto& tcp_sockets_group_box = add<GUI::GroupBox>("TCP Sockets"sv);
- tcp_sockets_group_box.set_layout<GUI::VerticalBoxLayout>();
- tcp_sockets_group_box.layout()->set_margins(6);
+ tcp_sockets_group_box.set_layout<GUI::VerticalBoxLayout>(6);
m_tcp_socket_table_view = tcp_sockets_group_box.add<GUI::TableView>();
@@ -115,8 +112,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
m_tcp_socket_table_view->set_model(MUST(GUI::SortingProxyModel::create(*m_tcp_socket_model)));
auto& udp_sockets_group_box = add<GUI::GroupBox>("UDP Sockets"sv);
- udp_sockets_group_box.set_layout<GUI::VerticalBoxLayout>();
- udp_sockets_group_box.layout()->set_margins(6);
+ udp_sockets_group_box.set_layout<GUI::VerticalBoxLayout>(6);
m_udp_socket_table_view = udp_sockets_group_box.add<GUI::TableView>();
diff --git a/Userland/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp b/Userland/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp
index bd3a1117f1..c1a5db07c5 100644
--- a/Userland/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp
+++ b/Userland/Applications/SystemMonitor/ProcessFileDescriptorMapWidget.cpp
@@ -17,8 +17,7 @@ namespace SystemMonitor {
ProcessFileDescriptorMapWidget::ProcessFileDescriptorMapWidget()
{
- set_layout<GUI::VerticalBoxLayout>();
- layout()->set_margins(4);
+ set_layout<GUI::VerticalBoxLayout>(4);
m_table_view = add<GUI::TableView>();
Vector<GUI::JsonArrayModel::FieldSpec> pid_fds_fields;
diff --git a/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp b/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp
index dfe9a341e0..2feabf542c 100644
--- a/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp
+++ b/Userland/Applications/SystemMonitor/ProcessMemoryMapWidget.cpp
@@ -51,8 +51,7 @@ public:
ProcessMemoryMapWidget::ProcessMemoryMapWidget()
{
- set_layout<GUI::VerticalBoxLayout>();
- layout()->set_margins(4);
+ set_layout<GUI::VerticalBoxLayout>(4);
m_table_view = add<GUI::TableView>();
Vector<GUI::JsonArrayModel::FieldSpec> pid_vm_fields;
pid_vm_fields.empend(
diff --git a/Userland/Applications/SystemMonitor/ProcessStateWidget.cpp b/Userland/Applications/SystemMonitor/ProcessStateWidget.cpp
index 7236e7a906..2ac88a3c3d 100644
--- a/Userland/Applications/SystemMonitor/ProcessStateWidget.cpp
+++ b/Userland/Applications/SystemMonitor/ProcessStateWidget.cpp
@@ -95,8 +95,7 @@ private:
ProcessStateWidget::ProcessStateWidget()
{
- set_layout<GUI::VerticalBoxLayout>();
- layout()->set_margins(4);
+ set_layout<GUI::VerticalBoxLayout>(4);
m_table_view = add<GUI::TableView>();
m_table_view->set_model(adopt_ref(*new ProcessStateModel(ProcessModel::the(), 0)));
m_table_view->column_header().set_visible(false);
diff --git a/Userland/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp b/Userland/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp
index dbf549f474..e064543976 100644
--- a/Userland/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp
+++ b/Userland/Applications/SystemMonitor/ProcessUnveiledPathsWidget.cpp
@@ -18,8 +18,7 @@ namespace SystemMonitor {
ProcessUnveiledPathsWidget::ProcessUnveiledPathsWidget()
{
- set_layout<GUI::VerticalBoxLayout>();
- layout()->set_margins(4);
+ set_layout<GUI::VerticalBoxLayout>(4);
m_table_view = add<GUI::TableView>();
Vector<GUI::JsonArrayModel::FieldSpec> pid_unveil_fields;
diff --git a/Userland/Applications/SystemMonitor/ThreadStackWidget.cpp b/Userland/Applications/SystemMonitor/ThreadStackWidget.cpp
index 4f14651bc0..4bb4ef6ae5 100644
--- a/Userland/Applications/SystemMonitor/ThreadStackWidget.cpp
+++ b/Userland/Applications/SystemMonitor/ThreadStackWidget.cpp
@@ -73,8 +73,7 @@ private:
ThreadStackWidget::ThreadStackWidget()
{
- set_layout<GUI::VerticalBoxLayout>();
- layout()->set_margins(4);
+ set_layout<GUI::VerticalBoxLayout>(4);
m_stack_table = add<GUI::TableView>();
m_stack_table->set_model(adopt_ref(*new ThreadStackModel()));
}
diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp
index 7f16f626fa..b08a07e984 100644
--- a/Userland/Applications/SystemMonitor/main.cpp
+++ b/Userland/Applications/SystemMonitor/main.cpp
@@ -561,8 +561,7 @@ void build_performance_tab(GUI::Widget& graphs_container)
Vector<SystemMonitor::GraphWidget&> cpu_graphs;
for (auto row = 0u; row < cpu_graph_rows; ++row) {
auto& cpu_graph_row = cpu_graph_group_box.add<GUI::Widget>();
- cpu_graph_row.set_layout<GUI::HorizontalBoxLayout>();
- cpu_graph_row.layout()->set_margins(6);
+ cpu_graph_row.set_layout<GUI::HorizontalBoxLayout>(6);
cpu_graph_row.set_fixed_height(108);
for (auto i = 0u; i < cpu_graphs_per_row; ++i) {
auto& cpu_graph = cpu_graph_row.add<SystemMonitor::GraphWidget>();
diff --git a/Userland/Applications/Terminal/main.cpp b/Userland/Applications/Terminal/main.cpp
index 07da8ba674..a947218e90 100644
--- a/Userland/Applications/Terminal/main.cpp
+++ b/Userland/Applications/Terminal/main.cpp
@@ -175,12 +175,10 @@ static ErrorOr<NonnullRefPtr<GUI::Window>> create_find_window(VT::TerminalWidget
auto main_widget = TRY(window->set_main_widget<GUI::Widget>());
main_widget->set_fill_with_background_color(true);
main_widget->set_background_role(ColorRole::Button);
- (void)TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>());
- main_widget->layout()->set_margins(4);
+ (void)TRY(main_widget->try_set_layout<GUI::VerticalBoxLayout>(4));
auto find = TRY(main_widget->try_add<GUI::Widget>());
- (void)TRY(find->try_set_layout<GUI::HorizontalBoxLayout>());
- find->layout()->set_margins(4);
+ (void)TRY(find->try_set_layout<GUI::HorizontalBoxLayout>(4));
find->set_fixed_height(30);
auto find_textbox = TRY(find->try_add<GUI::TextBox>());
diff --git a/Userland/Applications/ThemeEditor/MainWidget.cpp b/Userland/Applications/ThemeEditor/MainWidget.cpp
index 41c386c64b..a6621ecc11 100644
--- a/Userland/Applications/ThemeEditor/MainWidget.cpp
+++ b/Userland/Applications/ThemeEditor/MainWidget.cpp
@@ -435,16 +435,12 @@ ErrorOr<void> MainWidget::add_property_tab(PropertyTab const& property_tab)
auto properties_list = TRY(GUI::Widget::try_create());
scrollable_container->set_widget(properties_list);
- (void)TRY(properties_list->try_set_layout<GUI::VerticalBoxLayout>());
- properties_list->layout()->set_spacing(12);
- properties_list->layout()->set_margins({ 8 });
+ (void)TRY(properties_list->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 8 }, 12));
for (auto const& group : property_tab.property_groups) {
NonnullRefPtr<GUI::GroupBox> group_box = TRY(properties_list->try_add<GUI::GroupBox>(group.title));
- (void)TRY(group_box->try_set_layout<GUI::VerticalBoxLayout>());
- group_box->layout()->set_spacing(12);
// 1px less on the left makes the text line up with the group title.
- group_box->layout()->set_margins({ 8, 8, 8, 7 });
+ (void)TRY(group_box->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 8, 8, 8, 7 }, 12));
group_box->set_preferred_height(GUI::SpecialDimension::Fit);
for (auto const& property : group.properties) {
diff --git a/Userland/Demos/CatDog/main.cpp b/Userland/Demos/CatDog/main.cpp
index 6075cac907..4bd9868c14 100644
--- a/Userland/Demos/CatDog/main.cpp
+++ b/Userland/Demos/CatDog/main.cpp
@@ -42,8 +42,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto catdog_widget = TRY(CatDog::create());
window->set_main_widget(catdog_widget);
- (void)TRY(catdog_widget->try_set_layout<GUI::VerticalBoxLayout>());
- catdog_widget->layout()->set_spacing(0);
+ (void)TRY(catdog_widget->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins {}, 0));
auto context_menu = TRY(GUI::Menu::try_create());
TRY(context_menu->try_add_action(GUI::CommonActions::make_about_action("CatDog Demo", app_icon, window)));
@@ -63,8 +62,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
advice_window->set_alpha_hit_threshold(1.0f);
auto advice_widget = TRY(advice_window->set_main_widget<SpeechBubble>(catdog_widget));
- (void)TRY(advice_widget->try_set_layout<GUI::VerticalBoxLayout>());
- advice_widget->layout()->set_spacing(0);
+ (void)TRY(advice_widget->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins {}, 0));
auto advice_timer = TRY(Core::Timer::create_single_shot(15'000, [&] {
window->move_to_front();
diff --git a/Userland/Demos/ModelGallery/GalleryWidget.cpp b/Userland/Demos/ModelGallery/GalleryWidget.cpp
index 5effbd5781..43e8c090e0 100644
--- a/Userland/Demos/ModelGallery/GalleryWidget.cpp
+++ b/Userland/Demos/ModelGallery/GalleryWidget.cpp
@@ -13,8 +13,7 @@ GalleryWidget::GalleryWidget()
set_layout<GUI::VerticalBoxLayout>();
auto& inner_widget = add<GUI::Widget>();
- auto inner_layout = inner_widget.try_set_layout<GUI::VerticalBoxLayout>().release_value_but_fixme_should_propagate_errors();
- inner_layout->set_margins({ 4 });
+ (void)inner_widget.try_set_layout<GUI::VerticalBoxLayout>(4).release_value_but_fixme_should_propagate_errors();
m_tab_widget = inner_widget.try_add<GUI::TabWidget>().release_value_but_fixme_should_propagate_errors();
m_statusbar = add<GUI::Statusbar>();
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
index deeda7935b..963fad3890 100644
--- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp
+++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
@@ -85,8 +85,7 @@ ErrorOr<NonnullRefPtr<HackStudioWidget>> HackStudioWidget::create(DeprecatedStri
widget->m_editor_font = widget->read_editor_font_from_config();
widget->set_fill_with_background_color(true);
- widget->set_layout<GUI::VerticalBoxLayout>();
- widget->layout()->set_spacing(2);
+ widget->set_layout<GUI::VerticalBoxLayout>(GUI::Margins {}, 2);
auto& toolbar_container = widget->add<GUI::ToolbarContainer>();
@@ -1363,15 +1362,13 @@ void HackStudioWidget::create_project_tab(GUI::Widget& parent)
m_project_tab->set_tab_position(GUI::TabWidget::TabPosition::Bottom);
auto& tree_view_container = m_project_tab->add_tab<GUI::Widget>("Files");
- tree_view_container.set_layout<GUI::VerticalBoxLayout>();
- tree_view_container.layout()->set_margins(2);
+ tree_view_container.set_layout<GUI::VerticalBoxLayout>(GUI::Margins {}, 2);
m_project_tree_view = tree_view_container.add<GUI::TreeView>();
configure_project_tree_view();
auto& class_view_container = m_project_tab->add_tab<GUI::Widget>("Classes");
- class_view_container.set_layout<GUI::VerticalBoxLayout>();
- class_view_container.layout()->set_margins(2);
+ class_view_container.set_layout<GUI::VerticalBoxLayout>(2);
m_class_view = class_view_container.add<ClassViewWidget>();
diff --git a/Userland/DevTools/Profiler/main.cpp b/Userland/DevTools/Profiler/main.cpp
index f7580001a6..7e49cc29cb 100644
--- a/Userland/DevTools/Profiler/main.cpp
+++ b/Userland/DevTools/Profiler/main.cpp
@@ -132,8 +132,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto tab_widget = TRY(main_splitter->try_add<GUI::TabWidget>());
auto tree_tab = TRY(tab_widget->try_add_tab<GUI::Widget>("Call Tree"));
- tree_tab->set_layout<GUI::VerticalBoxLayout>();
- tree_tab->layout()->set_margins(4);
+ (void)TRY(tree_tab->try_set_layout<GUI::VerticalBoxLayout>(4));
auto bottom_splitter = TRY(tree_tab->try_add<GUI::VerticalSplitter>());
auto tree_view = TRY(bottom_splitter->try_add<GUI::TreeView>());
@@ -182,8 +181,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
});
auto samples_tab = TRY(tab_widget->try_add_tab<GUI::Widget>("Samples"));
- samples_tab->set_layout<GUI::VerticalBoxLayout>();
- samples_tab->layout()->set_margins(4);
+ (void)TRY(samples_tab->try_set_layout<GUI::VerticalBoxLayout>(4));
auto samples_splitter = TRY(samples_tab->try_add<GUI::HorizontalSplitter>());
auto samples_table_view = TRY(samples_splitter->try_add<GUI::TableView>());
@@ -197,8 +195,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
};
auto signposts_tab = TRY(tab_widget->try_add_tab<GUI::Widget>("Signposts"));
- signposts_tab->set_layout<GUI::VerticalBoxLayout>();
- signposts_tab->layout()->set_margins(4);
+ (void)TRY(signposts_tab->try_set_layout<GUI::VerticalBoxLayout>(4));
auto signposts_splitter = TRY(signposts_tab->try_add<GUI::HorizontalSplitter>());
auto signposts_table_view = TRY(signposts_splitter->try_add<GUI::TableView>());
@@ -212,8 +209,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
};
auto flamegraph_tab = TRY(tab_widget->try_add_tab<GUI::Widget>("Flame Graph"));
- flamegraph_tab->set_layout<GUI::VerticalBoxLayout>();
- flamegraph_tab->layout()->set_margins({ 4, 4, 4, 4 });
+ (void)TRY(flamegraph_tab->try_set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 4, 4, 4, 4 }));
auto flamegraph_view = TRY(flamegraph_tab->try_add<FlameGraphView>(profile->model(), ProfileModel::Column::StackFrame, ProfileModel::Column::SampleCount));
@@ -261,8 +257,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
flamegraph_view->on_hover_change = [&] { statusbar_update(); };
auto filesystem_events_tab = TRY(tab_widget->try_add_tab<GUI::Widget>("Filesystem events"));
- filesystem_events_tab->set_layout<GUI::VerticalBoxLayout>();
- filesystem_events_tab->layout()->set_margins(4);
+ (void)TRY(filesystem_events_tab->try_set_layout<GUI::VerticalBoxLayout>(4));
auto filesystem_events_tree_view = TRY(filesystem_events_tab->try_add<GUI::TreeView>());
filesystem_events_tree_view->set_should_fill_selected_rows(true);
@@ -320,8 +315,7 @@ static bool prompt_to_stop_profiling(pid_t pid, DeprecatedString const& process_
auto widget = window->set_main_widget<GUI::Widget>().release_value_but_fixme_should_propagate_errors();
widget->set_fill_with_background_color(true);
- auto& layout = widget->set_layout<GUI::VerticalBoxLayout>();
- layout.set_margins({ 0, 0, 16 });
+ widget->set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 0, 0, 16 });
auto& timer_label = widget->add<GUI::Label>("...");
Core::ElapsedTimer clock;
diff --git a/Userland/DevTools/SQLStudio/MainWidget.cpp b/Userland/DevTools/SQLStudio/MainWidget.cpp
index 09700fb205..b142acbb6e 100644
--- a/Userland/DevTools/SQLStudio/MainWidget.cpp
+++ b/Userland/DevTools/SQLStudio/MainWidget.cpp
@@ -227,8 +227,7 @@ MainWidget::MainWidget()
m_action_tab_widget = find_descendant_of_type_named<GUI::TabWidget>("action_tab_widget"sv);
m_query_results_widget = m_action_tab_widget->add_tab<GUI::Widget>("Results");
- m_query_results_widget->set_layout<GUI::VerticalBoxLayout>();
- m_query_results_widget->layout()->set_margins(6);
+ m_query_results_widget->set_layout<GUI::VerticalBoxLayout>(6);
m_query_results_table_view = m_query_results_widget->add<GUI::TableView>();
m_action_tab_widget->on_tab_close_click = [this](auto&) {
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);
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)
diff --git a/Userland/Services/NotificationServer/NotificationWindow.cpp b/Userland/Services/NotificationServer/NotificationWindow.cpp
index ca85534ea6..0135d2ba20 100644
--- a/Userland/Services/NotificationServer/NotificationWindow.cpp
+++ b/Userland/Services/NotificationServer/NotificationWindow.cpp
@@ -70,9 +70,7 @@ NotificationWindow::NotificationWindow(i32 client_id, DeprecatedString const& te
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::HorizontalBoxLayout>();
- widget->layout()->set_margins(8);
- widget->layout()->set_spacing(6);
+ widget->set_layout<GUI::HorizontalBoxLayout>(8, 6);
m_image = &widget->add<GUI::ImageWidget>();
m_image->set_visible(icon.is_valid());
diff --git a/Userland/Services/Taskbar/ClockWidget.cpp b/Userland/Services/Taskbar/ClockWidget.cpp
index 931193bb80..1241c7f9b3 100644
--- a/Userland/Services/Taskbar/ClockWidget.cpp
+++ b/Userland/Services/Taskbar/ClockWidget.cpp
@@ -43,15 +43,12 @@ ClockWidget::ClockWidget()
auto root_container = m_calendar_window->set_main_widget<GUI::Frame>().release_value_but_fixme_should_propagate_errors();
root_container->set_fill_with_background_color(true);
- root_container->set_layout<GUI::VerticalBoxLayout>();
- root_container->layout()->set_margins({ 2, 0 });
- root_container->layout()->set_spacing(0);
+ root_container->set_layout<GUI::VerticalBoxLayout>(GUI::Margins { 2, 0 }, 0);
root_container->set_frame_shape(Gfx::FrameShape::Window);
auto& navigation_container = root_container->add<GUI::Widget>();
navigation_container.set_fixed_height(24);
- navigation_container.set_layout<GUI::HorizontalBoxLayout>();
- navigation_container.layout()->set_margins({ 2 });
+ navigation_container.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 2 });
m_prev_date = navigation_container.add<GUI::Button>();
m_prev_date->set_button_style(Gfx::ButtonStyle::Coolbar);
@@ -114,8 +111,7 @@ ClockWidget::ClockWidget()
separator1.set_fixed_height(2);
auto& calendar_container = root_container->add<GUI::Widget>();
- calendar_container.set_layout<GUI::HorizontalBoxLayout>();
- calendar_container.layout()->set_margins({ 2 });
+ calendar_container.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 2 });
m_calendar = calendar_container.add<GUI::Calendar>();
m_selected_calendar_button->set_text(m_calendar->formatted_date().release_value_but_fixme_should_propagate_errors());
@@ -133,8 +129,7 @@ ClockWidget::ClockWidget()
auto& settings_container = root_container->add<GUI::Widget>();
settings_container.set_fixed_height(24);
- settings_container.set_layout<GUI::HorizontalBoxLayout>();
- settings_container.layout()->set_margins({ 2 });
+ settings_container.set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 2 });
settings_container.add_spacer().release_value_but_fixme_should_propagate_errors();
m_jump_to_button = settings_container.add<GUI::Button>();
diff --git a/Userland/Services/Taskbar/QuickLaunchWidget.cpp b/Userland/Services/Taskbar/QuickLaunchWidget.cpp
index 67fcf07011..ae9235d312 100644
--- a/Userland/Services/Taskbar/QuickLaunchWidget.cpp
+++ b/Userland/Services/Taskbar/QuickLaunchWidget.cpp
@@ -105,8 +105,7 @@ ErrorOr<NonnullRefPtr<QuickLaunchWidget>> QuickLaunchWidget::create()
QuickLaunchWidget::QuickLaunchWidget()
{
set_shrink_to_fit(true);
- set_layout<GUI::HorizontalBoxLayout>();
- layout()->set_spacing(0);
+ set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 0);
set_frame_thickness(0);
set_fixed_height(24);
}
diff --git a/Userland/Services/Taskbar/ShutdownDialog.cpp b/Userland/Services/Taskbar/ShutdownDialog.cpp
index 5cc972af29..c936d16863 100644
--- a/Userland/Services/Taskbar/ShutdownDialog.cpp
+++ b/Userland/Services/Taskbar/ShutdownDialog.cpp
@@ -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);
diff --git a/Userland/Services/Taskbar/TaskbarWindow.cpp b/Userland/Services/Taskbar/TaskbarWindow.cpp
index bb4cb91773..8a973c8edd 100644
--- a/Userland/Services/Taskbar/TaskbarWindow.cpp
+++ b/Userland/Services/Taskbar/TaskbarWindow.cpp
@@ -73,15 +73,13 @@ TaskbarWindow::TaskbarWindow()
ErrorOr<void> TaskbarWindow::populate_taskbar()
{
auto main_widget = TRY(set_main_widget<TaskbarWidget>());
- (void)TRY(main_widget->try_set_layout<GUI::HorizontalBoxLayout>());
- main_widget->layout()->set_margins({ 2, 3, 0, 3 });
+ (void)TRY(main_widget->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins { 2, 3, 0, 3 }));
m_quick_launch = TRY(Taskbar::QuickLaunchWidget::create());
TRY(main_widget->try_add_child(*m_quick_launch));
m_task_button_container = TRY(main_widget->try_add<GUI::Widget>());
- (void)TRY(m_task_button_container->try_set_layout<GUI::HorizontalBoxLayout>());
- m_task_button_container->layout()->set_spacing(3);
+ (void)TRY(m_task_button_container->try_set_layout<GUI::HorizontalBoxLayout>(GUI::Margins {}, 3));
m_default_icon = TRY(Gfx::Bitmap::load_from_file("/res/icons/16x16/window.png"sv));