1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-23 09:47:41 +00:00

Userland+LibGUI: Make Margins arguments match CSS ordering

Previously the argument order for Margins was (left, top, right,
bottom). To make it more familiar and closer to how CSS does it, the
argument order is now (top, right, bottom, left).
This commit is contained in:
sin-ack 2021-08-17 00:10:51 +00:00 committed by Andreas Kling
parent c17f9adb12
commit 9c9a5c55cb
43 changed files with 78 additions and 78 deletions

View file

@ -63,7 +63,7 @@ public:
m_root_container = m_slider_window->set_main_widget<GUI::Label>(); m_root_container = m_slider_window->set_main_widget<GUI::Label>();
m_root_container->set_fill_with_background_color(true); m_root_container->set_fill_with_background_color(true);
m_root_container->set_layout<GUI::VerticalBoxLayout>(); m_root_container->set_layout<GUI::VerticalBoxLayout>();
m_root_container->layout()->set_margins({ 0, 4, 0, 4 }); m_root_container->layout()->set_margins({ 4, 0, 4, 0 });
m_root_container->layout()->set_spacing(0); m_root_container->layout()->set_spacing(0);
m_root_container->set_frame_thickness(2); m_root_container->set_frame_thickness(2);
m_root_container->set_frame_shape(Gfx::FrameShape::Container); m_root_container->set_frame_shape(Gfx::FrameShape::Container);

View file

@ -221,12 +221,12 @@ int main(int argc, char** argv)
container.set_fill_with_background_color(true); container.set_fill_with_background_color(true);
container.set_frame_shadow(Gfx::FrameShadow::Raised); container.set_frame_shadow(Gfx::FrameShadow::Raised);
auto& layout = container.set_layout<GUI::VerticalBoxLayout>(); auto& layout = container.set_layout<GUI::VerticalBoxLayout>();
layout.set_margins({ 8, 8, 8, 0 }); layout.set_margins({ 8, 8, 0, 8 });
auto& text_box = container.add<GUI::TextBox>(); auto& text_box = container.add<GUI::TextBox>();
auto& results_container = container.add<GUI::Widget>(); auto& results_container = container.add<GUI::Widget>();
auto& results_layout = results_container.set_layout<GUI::VerticalBoxLayout>(); auto& results_layout = results_container.set_layout<GUI::VerticalBoxLayout>();
results_layout.set_margins({ 0, 10, 0, 10 }); results_layout.set_margins({ 10, 0, 10, 0 });
auto mark_selected_item = [&]() { auto mark_selected_item = [&]() {
for (size_t i = 0; i < app_state.visible_result_count; ++i) { for (size_t i = 0; i < app_state.visible_result_count; ++i) {

View file

@ -7,7 +7,7 @@
@GUI::GroupBox { @GUI::GroupBox {
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [16, 24, 16, 6] margins: [24, 16, 6, 16]
} }
title: "Workspaces" title: "Workspaces"

View file

@ -18,7 +18,7 @@
@GUI::Widget { @GUI::Widget {
shrink_to_fit: true shrink_to_fit: true
layout: @GUI::HorizontalBoxLayout { layout: @GUI::HorizontalBoxLayout {
margins: [16, 8, 8, 6] margins: [8, 8, 6, 16]
} }
@GUI::Label { @GUI::Label {
@ -34,7 +34,7 @@
@GUI::GroupBox { @GUI::GroupBox {
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [16, 24, 16, 6] margins: [24, 16, 6, 16]
} }
title: "Screen settings" title: "Screen settings"

View file

@ -1,6 +1,6 @@
@GUI::Widget { @GUI::Widget {
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [12, 8, 12, 8] margins: [8, 12, 8, 12]
spacing: 10 spacing: 10
} }

View file

@ -443,12 +443,12 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
auto& toolbar_container = *widget.find_descendant_of_type_named<GUI::ToolbarContainer>("toolbar_container"); auto& toolbar_container = *widget.find_descendant_of_type_named<GUI::ToolbarContainer>("toolbar_container");
auto& main_toolbar = *widget.find_descendant_of_type_named<GUI::Toolbar>("main_toolbar"); auto& main_toolbar = *widget.find_descendant_of_type_named<GUI::Toolbar>("main_toolbar");
auto& location_toolbar = *widget.find_descendant_of_type_named<GUI::Toolbar>("location_toolbar"); auto& location_toolbar = *widget.find_descendant_of_type_named<GUI::Toolbar>("location_toolbar");
location_toolbar.layout()->set_margins({ 6, 3, 6, 3 }); location_toolbar.layout()->set_margins({ 3, 6, 3, 6 });
auto& location_textbox = *widget.find_descendant_of_type_named<GUI::TextBox>("location_textbox"); auto& location_textbox = *widget.find_descendant_of_type_named<GUI::TextBox>("location_textbox");
auto& breadcrumb_toolbar = *widget.find_descendant_of_type_named<GUI::Toolbar>("breadcrumb_toolbar"); auto& breadcrumb_toolbar = *widget.find_descendant_of_type_named<GUI::Toolbar>("breadcrumb_toolbar");
breadcrumb_toolbar.layout()->set_margins({ 6, 0, 6, 0 }); breadcrumb_toolbar.layout()->set_margins({ 0, 6, 0, 6 });
auto& breadcrumbbar = *widget.find_descendant_of_type_named<GUI::Breadcrumbbar>("breadcrumbbar"); auto& breadcrumbbar = *widget.find_descendant_of_type_named<GUI::Breadcrumbbar>("breadcrumbbar");
auto& splitter = *widget.find_descendant_of_type_named<GUI::HorizontalSplitter>("splitter"); auto& splitter = *widget.find_descendant_of_type_named<GUI::HorizontalSplitter>("splitter");

View file

@ -11,7 +11,7 @@
title: "Metadata" title: "Metadata"
fixed_width: 200 fixed_width: 200
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [8, 16, 8, 8] margins: [16, 8, 8, 8]
} }
@GUI::Widget { @GUI::Widget {
@ -125,7 +125,7 @@
@GUI::Widget { @GUI::Widget {
name: "glyph_editor_container" name: "glyph_editor_container"
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [0, 5, 0, 0] margins: [5, 0, 0, 0]
} }
} }

View file

@ -298,7 +298,7 @@ void IRCAppWindow::setup_widgets()
auto& outer_container = widget.add<GUI::Widget>(); auto& outer_container = widget.add<GUI::Widget>();
outer_container.set_layout<GUI::VerticalBoxLayout>(); outer_container.set_layout<GUI::VerticalBoxLayout>();
outer_container.layout()->set_margins({ 2, 0, 2, 2 }); outer_container.layout()->set_margins({ 0, 2, 2, 2 });
auto& horizontal_container = outer_container.add<GUI::HorizontalSplitter>(); auto& horizontal_container = outer_container.add<GUI::HorizontalSplitter>();

View file

@ -154,7 +154,7 @@ int main(int argc, char** argv)
bottom_widget.set_layout<GUI::HorizontalBoxLayout>(); bottom_widget.set_layout<GUI::HorizontalBoxLayout>();
bottom_widget.layout()->add_spacer(); bottom_widget.layout()->add_spacer();
bottom_widget.set_fixed_height(30); bottom_widget.set_fixed_height(30);
bottom_widget.set_content_margins({ 0, 4, 0, 4 }); bottom_widget.set_content_margins({ 4, 0, 4, 0 });
auto& ok_button = bottom_widget.add<GUI::Button>(); auto& ok_button = bottom_widget.add<GUI::Button>();
ok_button.set_text("OK"); ok_button.set_text("OK");

View file

@ -11,7 +11,7 @@
fixed_height: 170 fixed_height: 170
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [8, 16, 8, 8] margins: [16, 8, 8, 8]
spacing: 2 spacing: 2
} }
@ -101,7 +101,7 @@
fixed_height: 110 fixed_height: 110
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [8, 16, 8, 8] margins: [16, 8, 8, 8]
spacing: 2 spacing: 2
} }

View file

@ -11,7 +11,7 @@
fixed_height: 110 fixed_height: 110
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [8, 16, 8, 8] margins: [16, 8, 8, 8]
spacing: 2 spacing: 2
} }
@ -60,7 +60,7 @@
fixed_height: 110 fixed_height: 110
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [8, 16, 8, 8] margins: [16, 8, 8, 8]
spacing: 2 spacing: 2
} }
@ -114,7 +114,7 @@
fixed_height: 110 fixed_height: 110
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [8, 16, 8, 8] margins: [16, 8, 8, 8]
spacing: 2 spacing: 2
} }

View file

@ -14,7 +14,7 @@
shrink_to_fit: true shrink_to_fit: true
layout: @GUI::HorizontalBoxLayout { layout: @GUI::HorizontalBoxLayout {
margins: [10,20,10,10] margins: [20,10,10,10]
} }
@GUI::RadioButton { @GUI::RadioButton {

View file

@ -25,7 +25,7 @@ LayerPropertiesWidget::LayerPropertiesWidget()
auto& group_box = add<GUI::GroupBox>("Layer properties"); auto& group_box = add<GUI::GroupBox>("Layer properties");
auto& layout = group_box.set_layout<GUI::VerticalBoxLayout>(); auto& layout = group_box.set_layout<GUI::VerticalBoxLayout>();
layout.set_margins({ 10, 20, 10, 10 }); layout.set_margins({ 20, 10, 10, 10 });
auto& name_container = group_box.add<GUI::Widget>(); auto& name_container = group_box.add<GUI::Widget>();
name_container.set_fixed_height(20); name_container.set_fixed_height(20);

View file

@ -51,7 +51,7 @@
@GUI::GroupBox { @GUI::GroupBox {
title: "Layers" title: "Layers"
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [6, 16, 6, 6] margins: [16, 6, 6, 6]
} }
@PixelPaint::LayerListWidget { @PixelPaint::LayerListWidget {

View file

@ -19,7 +19,7 @@ ToolPropertiesWidget::ToolPropertiesWidget()
m_group_box = add<GUI::GroupBox>("Tool properties"); m_group_box = add<GUI::GroupBox>("Tool properties");
auto& layout = m_group_box->set_layout<GUI::VerticalBoxLayout>(); auto& layout = m_group_box->set_layout<GUI::VerticalBoxLayout>();
layout.set_margins({ 10, 20, 10, 10 }); layout.set_margins({ 20, 10, 10, 10 });
m_tool_widget_stack = m_group_box->add<GUI::StackWidget>(); m_tool_widget_stack = m_group_box->add<GUI::StackWidget>();
m_blank_widget = m_tool_widget_stack->add<GUI::Widget>(); m_blank_widget = m_tool_widget_stack->add<GUI::Widget>();
} }

View file

@ -101,7 +101,7 @@ int main(int argc, char** argv)
auto& toolbox = *main_widget.find_descendant_of_type_named<PixelPaint::ToolboxWidget>("toolbox"); auto& toolbox = *main_widget.find_descendant_of_type_named<PixelPaint::ToolboxWidget>("toolbox");
auto& tab_widget = *main_widget.find_descendant_of_type_named<GUI::TabWidget>("tab_widget"); auto& tab_widget = *main_widget.find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
tab_widget.set_container_margins({ 4, 4, 5, 5 }); tab_widget.set_container_margins({ 4, 5, 5, 4 });
tab_widget.set_close_button_enabled(true); tab_widget.set_close_button_enabled(true);
auto& palette_widget = *main_widget.find_descendant_of_type_named<PixelPaint::PaletteWidget>("palette_widget"); auto& palette_widget = *main_widget.find_descendant_of_type_named<PixelPaint::PaletteWidget>("palette_widget");

View file

@ -199,7 +199,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, const Vector<Position>& po
{ {
auto& horizontal_alignment_selection_container = alignment_tab.add<GUI::Widget>(); auto& horizontal_alignment_selection_container = alignment_tab.add<GUI::Widget>();
horizontal_alignment_selection_container.set_layout<GUI::HorizontalBoxLayout>(); horizontal_alignment_selection_container.set_layout<GUI::HorizontalBoxLayout>();
horizontal_alignment_selection_container.layout()->set_margins({ 0, 4, 0, 0 }); horizontal_alignment_selection_container.layout()->set_margins({ 4, 0, 0, 0 });
horizontal_alignment_selection_container.set_fixed_height(22); horizontal_alignment_selection_container.set_fixed_height(22);
auto& horizontal_alignment_label = horizontal_alignment_selection_container.add<GUI::Label>(); auto& horizontal_alignment_label = horizontal_alignment_selection_container.add<GUI::Label>();
@ -273,7 +273,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, const Vector<Position>& po
// FIXME: Somehow allow unsetting these. // FIXME: Somehow allow unsetting these.
auto& foreground_container = static_formatting_container.add<GUI::Widget>(); auto& foreground_container = static_formatting_container.add<GUI::Widget>();
foreground_container.set_layout<GUI::HorizontalBoxLayout>(); foreground_container.set_layout<GUI::HorizontalBoxLayout>();
foreground_container.layout()->set_margins({ 0, 4, 0, 0 }); foreground_container.layout()->set_margins({ 4, 0, 0, 0 });
foreground_container.set_shrink_to_fit(true); foreground_container.set_shrink_to_fit(true);
auto& foreground_label = foreground_container.add<GUI::Label>(); auto& foreground_label = foreground_container.add<GUI::Label>();
@ -293,7 +293,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, const Vector<Position>& po
// FIXME: Somehow allow unsetting these. // FIXME: Somehow allow unsetting these.
auto& background_container = static_formatting_container.add<GUI::Widget>(); auto& background_container = static_formatting_container.add<GUI::Widget>();
background_container.set_layout<GUI::HorizontalBoxLayout>(); background_container.set_layout<GUI::HorizontalBoxLayout>();
background_container.layout()->set_margins({ 0, 4, 0, 0 }); background_container.layout()->set_margins({ 4, 0, 0, 0 });
background_container.set_shrink_to_fit(true); background_container.set_shrink_to_fit(true);
auto& background_label = background_container.add<GUI::Label>(); auto& background_label = background_container.add<GUI::Label>();

View file

@ -19,7 +19,7 @@
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
// FIXME: This is working around the fact that group boxes don't allocate space for their title and border! // FIXME: This is working around the fact that group boxes don't allocate space for their title and border!
margins: [10, 20, 10, 10] margins: [20, 10, 10, 10]
} }
@GUI::RadioButton { @GUI::RadioButton {
@ -70,7 +70,7 @@
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
// FIXME: This is working around the fact that group boxes don't allocate space for their title and border! // FIXME: This is working around the fact that group boxes don't allocate space for their title and border!
margins: [10, 20, 10, 10] margins: [20, 10, 10, 10]
} }
@GUI::RadioButton { @GUI::RadioButton {
@ -152,7 +152,7 @@
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
// FIXME: This is working around the fact that group boxes don't allocate space for their title and border! // FIXME: This is working around the fact that group boxes don't allocate space for their title and border!
margins: [10, 20, 10, 10] margins: [20, 10, 10, 10]
} }
@GUI::TextEditor { @GUI::TextEditor {

View file

@ -19,7 +19,7 @@
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
// FIXME: This is working around the fact that group boxes don't allocate space for their title and border! // FIXME: This is working around the fact that group boxes don't allocate space for their title and border!
margins: [10, 20, 10, 10] margins: [20, 10, 10, 10]
} }
@GUI::RadioButton { @GUI::RadioButton {
@ -70,7 +70,7 @@
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
// FIXME: This is working around the fact that group boxes don't allocate space for their title and border! // FIXME: This is working around the fact that group boxes don't allocate space for their title and border!
margins: [10, 20, 10, 10] margins: [20, 10, 10, 10]
} }
@GUI::RadioButton { @GUI::RadioButton {
@ -133,7 +133,7 @@
fixed_height: 40 fixed_height: 40
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [6, 6, 6, 0] margins: [6, 6, 0, 6]
} }
@GUI::Widget { @GUI::Widget {
@ -165,7 +165,7 @@
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
// FIXME: This is working around the fact that group boxes don't allocate space for their title and border! // FIXME: This is working around the fact that group boxes don't allocate space for their title and border!
margins: [10, 20, 10, 10] margins: [20, 10, 10, 10]
} }
@GUI::StackWidget { @GUI::StackWidget {

View file

@ -31,7 +31,7 @@ MemoryStatsWidget::MemoryStatsWidget(GraphWidget& graph)
set_fixed_height(110); set_fixed_height(110);
set_layout<GUI::VerticalBoxLayout>(); set_layout<GUI::VerticalBoxLayout>();
layout()->set_margins({ 0, 8, 0, 0 }); layout()->set_margins({ 8, 0, 0, 0 });
layout()->set_spacing(3); layout()->set_spacing(3);
auto build_widgets_for_label = [this](const String& description) -> RefPtr<GUI::Label> { auto build_widgets_for_label = [this](const String& description) -> RefPtr<GUI::Label> {

View file

@ -32,7 +32,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
auto& adapters_group_box = add<GUI::GroupBox>("Adapters"); auto& adapters_group_box = add<GUI::GroupBox>("Adapters");
adapters_group_box.set_layout<GUI::VerticalBoxLayout>(); adapters_group_box.set_layout<GUI::VerticalBoxLayout>();
adapters_group_box.layout()->set_margins({ 6, 16, 6, 6 }); adapters_group_box.layout()->set_margins({ 16, 6, 6, 6 });
adapters_group_box.set_fixed_height(120); adapters_group_box.set_fixed_height(120);
m_adapter_table_view = adapters_group_box.add<GUI::TableView>(); m_adapter_table_view = adapters_group_box.add<GUI::TableView>();
@ -69,7 +69,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
auto& tcp_sockets_group_box = add<GUI::GroupBox>("TCP Sockets"); auto& tcp_sockets_group_box = add<GUI::GroupBox>("TCP Sockets");
tcp_sockets_group_box.set_layout<GUI::VerticalBoxLayout>(); tcp_sockets_group_box.set_layout<GUI::VerticalBoxLayout>();
tcp_sockets_group_box.layout()->set_margins({ 6, 16, 6, 6 }); tcp_sockets_group_box.layout()->set_margins({ 16, 6, 6, 6 });
m_tcp_socket_table_view = tcp_sockets_group_box.add<GUI::TableView>(); m_tcp_socket_table_view = tcp_sockets_group_box.add<GUI::TableView>();
@ -90,7 +90,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
auto& udp_sockets_group_box = add<GUI::GroupBox>("UDP Sockets"); auto& udp_sockets_group_box = add<GUI::GroupBox>("UDP Sockets");
udp_sockets_group_box.set_layout<GUI::VerticalBoxLayout>(); udp_sockets_group_box.set_layout<GUI::VerticalBoxLayout>();
udp_sockets_group_box.layout()->set_margins({ 6, 16, 6, 6 }); udp_sockets_group_box.layout()->set_margins({ 16, 6, 6, 6 });
m_udp_socket_table_view = udp_sockets_group_box.add<GUI::TableView>(); m_udp_socket_table_view = udp_sockets_group_box.add<GUI::TableView>();

View file

@ -179,7 +179,7 @@ int main(int argc, char** argv)
auto& tabwidget_container = main_widget.add<GUI::Widget>(); auto& tabwidget_container = main_widget.add<GUI::Widget>();
tabwidget_container.set_layout<GUI::VerticalBoxLayout>(); tabwidget_container.set_layout<GUI::VerticalBoxLayout>();
tabwidget_container.layout()->set_margins({ 4, 0, 4, 4 }); tabwidget_container.layout()->set_margins({ 0, 4, 4, 4 });
auto& tabwidget = tabwidget_container.add<GUI::TabWidget>(); auto& tabwidget = tabwidget_container.add<GUI::TabWidget>();
statusbar = main_widget.add<GUI::Statusbar>(3); statusbar = main_widget.add<GUI::Statusbar>(3);
@ -669,7 +669,7 @@ NonnullRefPtr<GUI::Widget> build_graphs_tab()
auto& cpu_graph_group_box = graphs_container->add<GUI::GroupBox>("CPU usage"); auto& cpu_graph_group_box = graphs_container->add<GUI::GroupBox>("CPU usage");
cpu_graph_group_box.set_layout<GUI::HorizontalBoxLayout>(); cpu_graph_group_box.set_layout<GUI::HorizontalBoxLayout>();
cpu_graph_group_box.layout()->set_margins({ 6, 16, 6, 6 }); cpu_graph_group_box.layout()->set_margins({ 16, 6, 6, 6 });
cpu_graph_group_box.set_fixed_height(120); cpu_graph_group_box.set_fixed_height(120);
Vector<GraphWidget&> cpu_graphs; Vector<GraphWidget&> cpu_graphs;
for (size_t i = 0; i < ProcessModel::the().cpus().size(); i++) { for (size_t i = 0; i < ProcessModel::the().cpus().size(); i++) {
@ -701,7 +701,7 @@ NonnullRefPtr<GUI::Widget> build_graphs_tab()
auto& memory_graph_group_box = graphs_container->add<GUI::GroupBox>("Memory usage"); auto& memory_graph_group_box = graphs_container->add<GUI::GroupBox>("Memory usage");
memory_graph_group_box.set_layout<GUI::VerticalBoxLayout>(); memory_graph_group_box.set_layout<GUI::VerticalBoxLayout>();
memory_graph_group_box.layout()->set_margins({ 6, 16, 6, 6 }); memory_graph_group_box.layout()->set_margins({ 16, 6, 6, 6 });
memory_graph_group_box.set_fixed_height(120); memory_graph_group_box.set_fixed_height(120);
auto& memory_graph = memory_graph_group_box.add<GraphWidget>(); auto& memory_graph = memory_graph_group_box.add<GraphWidget>();
memory_graph.set_stack_values(true); memory_graph.set_stack_values(true);

View file

@ -10,7 +10,7 @@
shrink_to_fit: true shrink_to_fit: true
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [6, 16, 6, 6] margins: [16, 6, 6, 6]
} }
@GUI::RadioButton { @GUI::RadioButton {
@ -34,7 +34,7 @@
shrink_to_fit: true shrink_to_fit: true
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [6, 16, 6, 6] margins: [16, 6, 6, 6]
} }
@GUI::OpacitySlider { @GUI::OpacitySlider {
@ -50,7 +50,7 @@
shrink_to_fit: true shrink_to_fit: true
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [6, 16, 6, 6] margins: [16, 6, 6, 6]
} }
@GUI::SpinBox { @GUI::SpinBox {
@ -66,7 +66,7 @@
shrink_to_fit: true shrink_to_fit: true
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [6, 16, 6, 6] margins: [16, 6, 6, 6]
} }
@GUI::ComboBox { @GUI::ComboBox {

View file

@ -17,7 +17,7 @@
min_width: 340 min_width: 340
min_height: 160 min_height: 160
layout: @GUI::HorizontalBoxLayout { layout: @GUI::HorizontalBoxLayout {
margins: [0, 0, 16, 0] margins: [0, 16, 0, 0]
} }
@GUI::Widget { @GUI::Widget {

View file

@ -20,7 +20,7 @@
shadow: "Sunken" shadow: "Sunken"
thickness: 1 thickness: 1
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [4, 3, 4, 3] margins: [3, 4, 3, 4]
} }
@GUI::Label { @GUI::Label {
@ -37,7 +37,7 @@
@GUI::Widget { @GUI::Widget {
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [4, 0, 4, 0] margins: [0, 4, 0, 4]
} }
@GUI::Label { @GUI::Label {
@ -85,7 +85,7 @@
@GUI::Widget { @GUI::Widget {
fixed_height: 125 fixed_height: 125
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [8, 3, 8, 3] margins: [3, 8, 3, 8]
} }
@GUI::Widget { @GUI::Widget {

View file

@ -36,7 +36,7 @@
@GUI::Widget { @GUI::Widget {
fixed_height: 88 fixed_height: 88
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [8, 0, 8, 0] margins: [0, 8, 0, 8]
} }
@GUI::Widget { @GUI::Widget {

View file

@ -77,7 +77,7 @@ void EvaluateExpressionDialog::build(Window* parent_window)
auto& button_container_inner = button_container_outer.add<GUI::Widget>(); auto& button_container_inner = button_container_outer.add<GUI::Widget>();
button_container_inner.set_layout<GUI::HorizontalBoxLayout>(); button_container_inner.set_layout<GUI::HorizontalBoxLayout>();
button_container_inner.layout()->set_spacing(6); button_container_inner.layout()->set_spacing(6);
button_container_inner.layout()->set_margins({ 4, 4, 0, 4 }); button_container_inner.layout()->set_margins({ 4, 0, 4, 4 });
button_container_inner.layout()->add_spacer(); button_container_inner.layout()->add_spacer();
m_evaluate_button = button_container_inner.add<GUI::Button>(); m_evaluate_button = button_container_inner.add<GUI::Button>();

View file

@ -24,7 +24,7 @@ EditorWrapper::EditorWrapper()
label_wrapper.set_fixed_height(14); label_wrapper.set_fixed_height(14);
label_wrapper.set_fill_with_background_color(true); label_wrapper.set_fill_with_background_color(true);
label_wrapper.set_layout<GUI::HorizontalBoxLayout>(); label_wrapper.set_layout<GUI::HorizontalBoxLayout>();
label_wrapper.layout()->set_margins({ 2, 0, 2, 0 }); label_wrapper.layout()->set_margins({ 0, 2, 0, 2 });
m_filename_label = label_wrapper.add<GUI::Label>("(Untitled)"); m_filename_label = label_wrapper.add<GUI::Label>("(Untitled)");
m_filename_label->set_text_alignment(Gfx::TextAlignment::CenterLeft); m_filename_label->set_text_alignment(Gfx::TextAlignment::CenterLeft);

View file

@ -107,7 +107,7 @@ HackStudioWidget::HackStudioWidget(const String& path_to_project)
m_editors_splitter = m_right_hand_stack->add<GUI::VerticalSplitter>(); m_editors_splitter = m_right_hand_stack->add<GUI::VerticalSplitter>();
m_editors_splitter->layout()->set_spacing(5); m_editors_splitter->layout()->set_spacing(5);
m_editors_splitter->layout()->set_margins({ 0, 3, 0, 0 }); m_editors_splitter->layout()->set_margins({ 3, 0, 0, 0 });
add_new_editor(*m_editors_splitter); add_new_editor(*m_editors_splitter);
m_switch_to_next_editor = create_switch_to_next_editor_action(); m_switch_to_next_editor = create_switch_to_next_editor_action();

View file

@ -262,7 +262,7 @@ static bool prompt_to_stop_profiling(pid_t pid, const String& process_name)
auto& widget = window->set_main_widget<GUI::Widget>(); auto& widget = window->set_main_widget<GUI::Widget>();
widget.set_fill_with_background_color(true); widget.set_fill_with_background_color(true);
auto& layout = widget.set_layout<GUI::VerticalBoxLayout>(); auto& layout = widget.set_layout<GUI::VerticalBoxLayout>();
layout.set_margins(GUI::Margins(0, 0, 0, 16)); layout.set_margins({ 0, 0, 16, 0 });
auto& timer_label = widget.add<GUI::Label>("..."); auto& timer_label = widget.add<GUI::Label>("...");
Core::ElapsedTimer clock; Core::ElapsedTimer clock;

View file

@ -40,7 +40,7 @@ int main(int argc, char** argv)
main_widget.set_fill_with_background_color(true); main_widget.set_fill_with_background_color(true);
auto& main_toolbar = *main_widget.find_descendant_of_type_named<GUI::Toolbar>("toolbar"); auto& main_toolbar = *main_widget.find_descendant_of_type_named<GUI::Toolbar>("toolbar");
main_toolbar.layout()->set_margins({ 6, 0, 6, 0 }); main_toolbar.layout()->set_margins({ 0, 6, 0, 6 });
auto& board_widget_container = *main_widget.find_descendant_of_type_named<GUI::Widget>("board_widget_container"); auto& board_widget_container = *main_widget.find_descendant_of_type_named<GUI::Widget>("board_widget_container");
auto& board_layout = board_widget_container.set_layout<GUI::VerticalBoxLayout>(); auto& board_layout = board_widget_container.set_layout<GUI::VerticalBoxLayout>();

View file

@ -43,7 +43,7 @@ AboutDialog::AboutDialog(const StringView& name, const Gfx::Bitmap* icon, Window
auto& left_container = content_container.add<Widget>(); auto& left_container = content_container.add<Widget>();
left_container.set_fixed_width(60); left_container.set_fixed_width(60);
left_container.set_layout<VerticalBoxLayout>(); left_container.set_layout<VerticalBoxLayout>();
left_container.layout()->set_margins({ 0, 12, 0, 0 }); left_container.layout()->set_margins({ 12, 0, 0, 0 });
if (icon) { if (icon) {
auto& icon_wrapper = left_container.add<Widget>(); auto& icon_wrapper = left_container.add<Widget>();
@ -56,13 +56,13 @@ AboutDialog::AboutDialog(const StringView& name, const Gfx::Bitmap* icon, Window
auto& right_container = content_container.add<Widget>(); auto& right_container = content_container.add<Widget>();
right_container.set_layout<VerticalBoxLayout>(); right_container.set_layout<VerticalBoxLayout>();
right_container.layout()->set_margins({ 0, 12, 4, 4 }); right_container.layout()->set_margins({ 12, 4, 4, 0 });
auto make_label = [&](const StringView& text, bool bold = false) { auto make_label = [&](const StringView& text, bool bold = false) {
auto& label = right_container.add<Label>(text); auto& label = right_container.add<Label>(text);
label.set_text_alignment(Gfx::TextAlignment::CenterLeft); label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
label.set_fixed_height(14); label.set_fixed_height(14);
label.set_content_margins({ 0, 0, 8, 0 }); label.set_content_margins({ 0, 8, 0, 0 });
if (bold) if (bold)
label.set_font(Gfx::FontDatabase::default_font().bold_variant()); label.set_font(Gfx::FontDatabase::default_font().bold_variant());
}; };

View file

@ -240,7 +240,7 @@ void ColorPicker::build_ui_custom(Widget& root_container)
// Right Side // Right Side
auto& vertical_container = horizontal_container.add<Widget>(); auto& vertical_container = horizontal_container.add<Widget>();
vertical_container.set_layout<VerticalBoxLayout>(); vertical_container.set_layout<VerticalBoxLayout>();
vertical_container.layout()->set_margins({ 8, 0, 0, 0 }); vertical_container.layout()->set_margins({ 0, 0, 0, 8 });
vertical_container.set_fixed_width(128); vertical_container.set_fixed_width(128);
auto& preview_container = vertical_container.add<Frame>(); auto& preview_container = vertical_container.add<Frame>();

View file

@ -9,7 +9,7 @@
@GUI::Widget { @GUI::Widget {
shrink_to_fit: true shrink_to_fit: true
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [4, 0, 4, 0] margins: [0, 4, 0, 4]
} }
@GUI::Label { @GUI::Label {

View file

@ -83,7 +83,7 @@ void InputBox::build(InputType input_type)
auto& button_container_inner = button_container_outer.add<Widget>(); auto& button_container_inner = button_container_outer.add<Widget>();
button_container_inner.set_layout<HorizontalBoxLayout>(); button_container_inner.set_layout<HorizontalBoxLayout>();
button_container_inner.layout()->set_spacing(6); button_container_inner.layout()->set_spacing(6);
button_container_inner.layout()->set_margins({ 4, 4, 0, 4 }); button_container_inner.layout()->set_margins({ 4, 0, 4, 4 });
button_container_inner.layout()->add_spacer(); button_container_inner.layout()->add_spacer();
m_ok_button = button_container_inner.add<Button>(); m_ok_button = button_container_inner.add<Button>();

View file

@ -11,26 +11,26 @@ namespace GUI {
class Margins { class Margins {
public: public:
Margins() { } Margins() { }
Margins(int left, int top, int right, int bottom) Margins(int top, int right, int bottom, int left)
: m_left(left) : m_top(top)
, m_top(top)
, m_right(right) , m_right(right)
, m_bottom(bottom) , m_bottom(bottom)
, m_left(left)
{ {
} }
~Margins() { } ~Margins() { }
bool is_null() const { return !m_left && !m_top && !m_right && !m_bottom; } bool is_null() const { return !m_left && !m_top && !m_right && !m_bottom; }
int left() const { return m_left; }
int top() const { return m_top; } int top() const { return m_top; }
int right() const { return m_right; } int right() const { return m_right; }
int bottom() const { return m_bottom; } int bottom() const { return m_bottom; }
int left() const { return m_left; }
void set_left(int value) { m_left = value; }
void set_top(int value) { m_top = value; } void set_top(int value) { m_top = value; }
void set_right(int value) { m_right = value; } void set_right(int value) { m_right = value; }
void set_bottom(int value) { m_bottom = value; } void set_bottom(int value) { m_bottom = value; }
void set_left(int value) { m_left = value; }
bool operator==(const Margins& other) const bool operator==(const Margins& other) const
{ {
@ -41,10 +41,10 @@ public:
} }
private: private:
int m_left { 0 };
int m_top { 0 }; int m_top { 0 };
int m_right { 0 }; int m_right { 0 };
int m_bottom { 0 }; int m_bottom { 0 };
int m_left { 0 };
}; };
} }

View file

@ -102,7 +102,7 @@ void MessageBox::build()
if (icon()) { if (icon()) {
icon_width = icon()->width(); icon_width = icon()->width();
if (icon_width > 0) if (icon_width > 0)
message_container.layout()->set_margins({ 8, 0, 0, 0 }); message_container.layout()->set_margins({ 0, 0, 0, 8 });
} }
} }

View file

@ -48,8 +48,8 @@ ProcessChooser::ProcessChooser(const StringView& window_title, const StringView&
auto& button_container = widget.add<GUI::Widget>(); auto& button_container = widget.add<GUI::Widget>();
button_container.set_fixed_height(30); button_container.set_fixed_height(30);
button_container.set_layout<GUI::HorizontalBoxLayout>(); button_container.set_layout<GUI::HorizontalBoxLayout>();
button_container.set_content_margins({ 0, 4, 0, 4 }); button_container.set_content_margins({ 4, 0, 4, 0 });
button_container.layout()->set_margins({ 0, 0, 4, 0 }); button_container.layout()->set_margins({ 0, 4, 0, 0 });
button_container.layout()->add_spacer(); button_container.layout()->add_spacer();
auto& select_button = button_container.add<GUI::Button>(m_button_label); auto& select_button = button_container.add<GUI::Button>(m_button_label);

View file

@ -41,7 +41,7 @@ WizardDialog::WizardDialog(Window* parent_window)
auto& nav_container_widget = main_widget.add<Widget>(); auto& nav_container_widget = main_widget.add<Widget>();
nav_container_widget.set_layout<HorizontalBoxLayout>(); nav_container_widget.set_layout<HorizontalBoxLayout>();
nav_container_widget.set_fixed_height(42); nav_container_widget.set_fixed_height(42);
nav_container_widget.layout()->set_margins({ 10, 0, 10, 0 }); nav_container_widget.layout()->set_margins({ 0, 10, 0, 10 });
nav_container_widget.layout()->set_spacing(0); nav_container_widget.layout()->set_spacing(0);
nav_container_widget.layout()->add_spacer(); nav_container_widget.layout()->add_spacer();

View file

@ -26,7 +26,7 @@ WizardPage::WizardPage(const String& title_text, const String& subtitle_text)
header_widget.set_fixed_height(58); header_widget.set_fixed_height(58);
header_widget.set_layout<VerticalBoxLayout>(); header_widget.set_layout<VerticalBoxLayout>();
header_widget.layout()->set_margins({ 30, 15, 30, 0 }); header_widget.layout()->set_margins({ 15, 30, 0, 30 });
m_title_label = header_widget.add<Label>(title_text); m_title_label = header_widget.add<Label>(title_text);
m_title_label->set_font(Gfx::FontDatabase::default_font().bold_variant()); m_title_label->set_font(Gfx::FontDatabase::default_font().bold_variant());
m_title_label->set_fixed_height(m_title_label->font().glyph_height() + 2); m_title_label->set_fixed_height(m_title_label->font().glyph_height() + 2);

View file

@ -47,7 +47,7 @@ ClockWidget::ClockWidget()
auto& root_container = m_calendar_window->set_main_widget<GUI::Label>(); auto& root_container = m_calendar_window->set_main_widget<GUI::Label>();
root_container.set_fill_with_background_color(true); root_container.set_fill_with_background_color(true);
root_container.set_layout<GUI::VerticalBoxLayout>(); root_container.set_layout<GUI::VerticalBoxLayout>();
root_container.layout()->set_margins({ 0, 2, 0, 2 }); root_container.layout()->set_margins({ 2, 0, 2, 0 });
root_container.layout()->set_spacing(0); root_container.layout()->set_spacing(0);
root_container.set_frame_thickness(2); root_container.set_frame_thickness(2);
root_container.set_frame_shape(Gfx::FrameShape::Container); root_container.set_frame_shape(Gfx::FrameShape::Container);
@ -56,7 +56,7 @@ ClockWidget::ClockWidget()
auto& navigation_container = root_container.add<GUI::Widget>(); auto& navigation_container = root_container.add<GUI::Widget>();
navigation_container.set_fixed_height(24); navigation_container.set_fixed_height(24);
navigation_container.set_layout<GUI::HorizontalBoxLayout>(); navigation_container.set_layout<GUI::HorizontalBoxLayout>();
navigation_container.layout()->set_margins({ 2, 2, 3, 2 }); navigation_container.layout()->set_margins({ 2, 3, 2, 2 });
m_prev_date = navigation_container.add<GUI::Button>(); m_prev_date = navigation_container.add<GUI::Button>();
m_prev_date->set_button_style(Gfx::ButtonStyle::Coolbar); m_prev_date->set_button_style(Gfx::ButtonStyle::Coolbar);
@ -120,7 +120,7 @@ ClockWidget::ClockWidget()
auto& calendar_container = root_container.add<GUI::Widget>(); auto& calendar_container = root_container.add<GUI::Widget>();
calendar_container.set_layout<GUI::HorizontalBoxLayout>(); calendar_container.set_layout<GUI::HorizontalBoxLayout>();
calendar_container.layout()->set_margins({ 4, 4, 5, 4 }); calendar_container.layout()->set_margins({ 4, 5, 4, 4 });
m_calendar = calendar_container.add<GUI::Calendar>(); m_calendar = calendar_container.add<GUI::Calendar>();
m_selected_calendar_button->set_text(m_calendar->formatted_date()); m_selected_calendar_button->set_text(m_calendar->formatted_date());
@ -139,7 +139,7 @@ ClockWidget::ClockWidget()
auto& settings_container = root_container.add<GUI::Widget>(); auto& settings_container = root_container.add<GUI::Widget>();
settings_container.set_fixed_height(24); settings_container.set_fixed_height(24);
settings_container.set_layout<GUI::HorizontalBoxLayout>(); settings_container.set_layout<GUI::HorizontalBoxLayout>();
settings_container.layout()->set_margins({ 2, 2, 3, 2 }); settings_container.layout()->set_margins({ 2, 3, 2, 2 });
settings_container.layout()->add_spacer(); settings_container.layout()->add_spacer();
m_jump_to_button = settings_container.add<GUI::Button>(); m_jump_to_button = settings_container.add<GUI::Button>();

View file

@ -56,7 +56,7 @@ ShutdownDialog::ShutdownDialog()
auto& left_container = content_container.add<GUI::Widget>(); auto& left_container = content_container.add<GUI::Widget>();
left_container.set_fixed_width(60); left_container.set_fixed_width(60);
left_container.set_layout<GUI::VerticalBoxLayout>(); left_container.set_layout<GUI::VerticalBoxLayout>();
left_container.layout()->set_margins({ 0, 12, 0, 0 }); left_container.layout()->set_margins({ 12, 0, 0, 0 });
auto& icon_wrapper = left_container.add<GUI::Widget>(); auto& icon_wrapper = left_container.add<GUI::Widget>();
icon_wrapper.set_fixed_size(32, 48); icon_wrapper.set_fixed_size(32, 48);
@ -67,7 +67,7 @@ ShutdownDialog::ShutdownDialog()
auto& right_container = content_container.add<GUI::Widget>(); auto& right_container = content_container.add<GUI::Widget>();
right_container.set_layout<GUI::VerticalBoxLayout>(); right_container.set_layout<GUI::VerticalBoxLayout>();
right_container.layout()->set_margins({ 0, 12, 12, 8 }); right_container.layout()->set_margins({ 12, 12, 8, 0 });
auto& label = right_container.add<GUI::Label>("What would you like to do?"); auto& label = right_container.add<GUI::Label>("What would you like to do?");
label.set_text_alignment(Gfx::TextAlignment::CenterLeft); label.set_text_alignment(Gfx::TextAlignment::CenterLeft);

View file

@ -62,7 +62,7 @@ TaskbarWindow::TaskbarWindow(NonnullRefPtr<GUI::Menu> start_menu)
auto& main_widget = set_main_widget<TaskbarWidget>(); auto& main_widget = set_main_widget<TaskbarWidget>();
main_widget.set_layout<GUI::HorizontalBoxLayout>(); main_widget.set_layout<GUI::HorizontalBoxLayout>();
main_widget.layout()->set_margins({ 3, 3, 1, 1 }); main_widget.layout()->set_margins({ 3, 1, 1, 3 });
m_start_button = GUI::Button::construct("Serenity"); m_start_button = GUI::Button::construct("Serenity");
set_start_button_font(Gfx::FontDatabase::default_font().bold_variant()); set_start_button_font(Gfx::FontDatabase::default_font().bold_variant());