summaryrefslogtreecommitdiff
path: root/Userland/Applications/Spreadsheet
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2023-02-16 21:07:06 +0000
committerSam Atkins <atkinssj@gmail.com>2023-02-18 16:56:56 +0000
commit77ad0fdb0726aba2ecaf7ea9764a642671d1fd6f (patch)
tree956e10f4c4713e20c03f4aed06f08133f5fcc2e7 /Userland/Applications/Spreadsheet
parent9561ec15f47fdba66a4e8872fd03aae8d0f2df22 (diff)
downloadserenity-77ad0fdb0726aba2ecaf7ea9764a642671d1fd6f.zip
Userland: Specify margins and spacing in the GUI::Layout constructor
Diffstat (limited to 'Userland/Applications/Spreadsheet')
-rw-r--r--Userland/Applications/Spreadsheet/CellTypeDialog.cpp27
-rw-r--r--Userland/Applications/Spreadsheet/SpreadsheetView.cpp2
-rw-r--r--Userland/Applications/Spreadsheet/SpreadsheetWidget.cpp6
3 files changed, 14 insertions, 21 deletions
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);