1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 21:57:34 +00:00

Userland+LibGUI: Add shorthand versions of the Margins constructor

This allows for typing [8] instead of [8, 8, 8, 8] to specify the same
margin on all edges, for example. The constructors follow CSS' style of
specifying margins. The added constructors are:

- Margins(int all): Sets the same margin on all edges.
- Margins(int vertical, int horizontal): Sets the first argument to top
  and bottom margins, and the second argument to left and right margins.
- Margins(int top, int vertical, int bottom): Sets the first argument to
  the top margin, the second argument to the left and right margins,
  and the third argument to the bottom margin.
This commit is contained in:
sin-ack 2021-08-17 00:11:38 +00:00 committed by Andreas Kling
parent 9c9a5c55cb
commit e11d177618
101 changed files with 232 additions and 201 deletions

View file

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

View file

@ -12,7 +12,7 @@
@GUI::TabWidget {
name: "tab_widget"
container_margins: [0, 0, 0, 0]
container_margins: [0]
uniform_tabs: true
text_alignment: "CenterLeft"
}

View file

@ -61,7 +61,7 @@ DownloadWidget::DownloadWidget(const URL& url)
set_fill_with_background_color(true);
auto& layout = set_layout<GUI::VerticalBoxLayout>();
layout.set_margins({ 4, 4, 4, 4 });
layout.set_margins(4);
auto& animation_container = add<GUI::Widget>();
animation_container.set_fixed_height(32);

View file

@ -4,7 +4,7 @@
fill_with_background_color: true
layout: @GUI::VerticalBoxLayout {
margins: [4, 4, 4, 4]
margins: [4]
}

View file

@ -13,7 +13,7 @@
@GUI::Widget {
layout: @GUI::VerticalBoxLayout {
margins: [8, 8, 8, 8]
margins: [8]
}
@GUI::TextBox {

View file

@ -39,7 +39,7 @@ AddEventDialog::AddEventDialog(Core::DateTime date_time, Window* parent_window)
auto& top_container = widget.add<GUI::Widget>();
top_container.set_layout<GUI::VerticalBoxLayout>();
top_container.set_fixed_height(45);
top_container.layout()->set_margins({ 4, 4, 4, 4 });
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);
@ -52,7 +52,7 @@ AddEventDialog::AddEventDialog(Core::DateTime date_time, Window* parent_window)
auto& middle_container = widget.add<GUI::Widget>();
middle_container.set_layout<GUI::HorizontalBoxLayout>();
middle_container.set_fixed_height(25);
middle_container.layout()->set_margins({ 4, 4, 4, 4 });
middle_container.layout()->set_margins(4);
auto& starting_month_combo = middle_container.add<GUI::ComboBox>();
starting_month_combo.set_only_allow_values_from_model(true);

View file

@ -2,7 +2,7 @@
fill_with_background_color: true
layout: @GUI::VerticalBoxLayout {
margins: [5, 5, 5, 5]
margins: [5]
}
@GUI::Widget {

View file

@ -225,7 +225,7 @@ int main(int argc, char** argv)
auto& backtrace_tab = tab_widget.add_tab<GUI::Widget>("Backtrace");
backtrace_tab.set_layout<GUI::VerticalBoxLayout>();
backtrace_tab.layout()->set_margins({ 4, 4, 4, 4 });
backtrace_tab.layout()->set_margins(4);
auto& backtrace_label = backtrace_tab.add<GUI::Label>("A backtrace for each thread alive during the crash is listed below:");
backtrace_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
@ -236,7 +236,7 @@ int main(int argc, char** argv)
for (auto& backtrace : thread_backtraces) {
auto& backtrace_text_editor = backtrace_tab_widget.add_tab<GUI::TextEditor>(backtrace.title);
backtrace_text_editor.set_layout<GUI::VerticalBoxLayout>();
backtrace_text_editor.layout()->set_margins({ 4, 4, 4, 4 });
backtrace_text_editor.layout()->set_margins(4);
backtrace_text_editor.set_text(backtrace.text);
backtrace_text_editor.set_mode(GUI::TextEditor::Mode::ReadOnly);
backtrace_text_editor.set_should_hide_unnecessary_scrollbars(true);
@ -244,7 +244,7 @@ int main(int argc, char** argv)
auto& cpu_registers_tab = tab_widget.add_tab<GUI::Widget>("CPU Registers");
cpu_registers_tab.set_layout<GUI::VerticalBoxLayout>();
cpu_registers_tab.layout()->set_margins({ 4, 4, 4, 4 });
cpu_registers_tab.layout()->set_margins(4);
auto& cpu_registers_label = cpu_registers_tab.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);
@ -255,7 +255,7 @@ int main(int argc, char** argv)
for (auto& cpu_registers : thread_cpu_registers) {
auto& cpu_registers_text_editor = cpu_registers_tab_widget.add_tab<GUI::TextEditor>(cpu_registers.title);
cpu_registers_text_editor.set_layout<GUI::VerticalBoxLayout>();
cpu_registers_text_editor.layout()->set_margins({ 4, 4, 4, 4 });
cpu_registers_text_editor.layout()->set_margins(4);
cpu_registers_text_editor.set_text(cpu_registers.text);
cpu_registers_text_editor.set_mode(GUI::TextEditor::Mode::ReadOnly);
cpu_registers_text_editor.set_should_hide_unnecessary_scrollbars(true);
@ -263,7 +263,7 @@ int main(int argc, char** argv)
auto& environment_tab = tab_widget.add_tab<GUI::Widget>("Environment");
environment_tab.set_layout<GUI::VerticalBoxLayout>();
environment_tab.layout()->set_margins({ 4, 4, 4, 4 });
environment_tab.layout()->set_margins(4);
auto& environment_text_editor = environment_tab.add<GUI::TextEditor>();
environment_text_editor.set_text(String::join("\n", environment));

View file

@ -2,7 +2,7 @@
fill_with_background_color: true
layout: @GUI::VerticalBoxLayout {
margins: [8, 8, 8, 8]
margins: [8]
}
@DisplaySettings::MonitorWidget {

View file

@ -2,12 +2,12 @@
fill_with_background_color: true
layout: @GUI::VerticalBoxLayout {
margins: [8, 8, 8, 8]
margins: [8]
}
@GUI::GroupBox {
layout: @GUI::VerticalBoxLayout {
margins: [24, 16, 6, 16]
margins: [24, 16, 6]
}
title: "Workspaces"
@ -17,7 +17,7 @@
fixed_height: 32
layout: @GUI::HorizontalBoxLayout {
margins: [6, 6, 6, 6]
margins: [6]
}
@GUI::Label {
@ -57,7 +57,7 @@
}
@GUI::Widget {
layout: @GUI::VerticalBoxLayout {
margins: [6, 6, 6, 6]
margins: [6]
}
@GUI::Label {
text: "Use the Ctrl+Alt+Arrow hotkeys to move between workspaces."

View file

@ -2,7 +2,7 @@
fill_with_background_color: true
layout: @GUI::VerticalBoxLayout {
margins: [8, 8, 8, 8]
margins: [8]
spacing: 8
}

View file

@ -2,7 +2,7 @@
fill_with_background_color: true
layout: @GUI::VerticalBoxLayout {
margins: [8, 8, 8, 8]
margins: [8]
}
@DisplaySettings::MonitorWidget {
@ -34,7 +34,7 @@
@GUI::GroupBox {
layout: @GUI::VerticalBoxLayout {
margins: [24, 16, 6, 16]
margins: [24, 16, 6]
}
title: "Screen settings"

View file

@ -45,7 +45,7 @@ int main(int argc, char** argv)
auto& main_widget = window->set_main_widget<GUI::Widget>();
main_widget.set_fill_with_background_color(true);
main_widget.set_layout<GUI::VerticalBoxLayout>();
main_widget.layout()->set_margins({ 4, 4, 4, 4 });
main_widget.layout()->set_margins(4);
main_widget.layout()->set_spacing(6);
auto& tab_widget = main_widget.add<GUI::TabWidget>();

View file

@ -134,7 +134,7 @@ DirectoryView::DirectoryView(Mode mode)
, m_sorting_model(GUI::SortingProxyModel::create(m_model))
{
set_active_widget(nullptr);
set_content_margins({ 2, 2, 2, 2 });
set_content_margins(2);
setup_actions();

View file

@ -2,7 +2,7 @@
fill_with_background_color: true
layout: @GUI::VerticalBoxLayout {
margins: [4, 4, 4, 4]
margins: [4]
}
@GUI::Widget {

View file

@ -32,7 +32,7 @@ PropertiesWindow::PropertiesWindow(String const& path, bool disable_rename, Wind
auto& main_widget = set_main_widget<GUI::Widget>();
main_widget.set_layout<GUI::VerticalBoxLayout>();
main_widget.layout()->set_margins({ 4, 4, 4, 4 });
main_widget.layout()->set_margins(4);
main_widget.set_fill_with_background_color(true);
set_rect({ 0, 0, 360, 420 });

View file

@ -1,6 +1,6 @@
@GUI::Widget {
layout: @GUI::VerticalBoxLayout {
margins: [8, 12, 8, 12]
margins: [8, 12]
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& 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");
location_toolbar.layout()->set_margins({ 3, 6, 3, 6 });
location_toolbar.layout()->set_margins({ 3, 6 });
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");
breadcrumb_toolbar.layout()->set_margins({ 0, 6, 0, 6 });
breadcrumb_toolbar.layout()->set_margins({ 0, 6 });
auto& breadcrumbbar = *widget.find_descendant_of_type_named<GUI::Breadcrumbbar>("breadcrumbbar");
auto& splitter = *widget.find_descendant_of_type_named<GUI::HorizontalSplitter>("splitter");

View file

@ -60,12 +60,12 @@ static RefPtr<GUI::Window> create_font_preview_window(FontEditorWidget& editor)
auto& main_widget = window->set_main_widget<GUI::Widget>();
main_widget.set_fill_with_background_color(true);
main_widget.set_layout<GUI::VerticalBoxLayout>();
main_widget.layout()->set_margins({ 2, 2, 2, 2 });
main_widget.layout()->set_margins(2);
main_widget.layout()->set_spacing(4);
auto& preview_box = main_widget.add<GUI::GroupBox>();
preview_box.set_layout<GUI::VerticalBoxLayout>();
preview_box.layout()->set_margins({ 8, 8, 8, 8 });
preview_box.layout()->set_margins(8);
auto& preview_label = preview_box.add<GUI::Label>();
preview_label.set_font(editor.edited_font());

View file

@ -1,6 +1,6 @@
@GUI::Widget {
layout: @GUI::VerticalBoxLayout {
margins: [20, 20, 20, 20]
margins: [20]
}
@GUI::Widget {

View file

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

View file

@ -96,11 +96,11 @@ int main(int argc, char* argv[])
auto& left_tab_bar = splitter.add<GUI::TabWidget>();
auto& tree_view_container = left_tab_bar.add_tab<GUI::Widget>("Browse");
tree_view_container.set_layout<GUI::VerticalBoxLayout>();
tree_view_container.layout()->set_margins({ 4, 4, 4, 4 });
tree_view_container.layout()->set_margins(4);
auto& tree_view = tree_view_container.add<GUI::TreeView>();
auto& search_view = left_tab_bar.add_tab<GUI::Widget>("Search");
search_view.set_layout<GUI::VerticalBoxLayout>();
search_view.layout()->set_margins({ 4, 4, 4, 4 });
search_view.layout()->set_margins(4);
auto& search_box = search_view.add<GUI::TextBox>();
auto& search_list_view = search_view.add<GUI::ListView>();
search_box.set_fixed_height(20);

View file

@ -6,7 +6,7 @@
layout: @GUI::VerticalBoxLayout {
spacing: 2
margins: [4, 4, 4, 4]
margins: [4]
}
@GUI::Widget {

View file

@ -6,13 +6,13 @@
layout: @GUI::VerticalBoxLayout {
spacing: 2
margins: [0, 0, 0, 0]
margins: [0]
}
@GUI::Widget {
layout: @GUI::HorizontalBoxLayout {
spacing: 2
margins: [2, 2, 2, 2]
margins: [2]
}
@GUI::Label {
@ -41,7 +41,7 @@
@GUI::Widget {
layout: @GUI::HorizontalBoxLayout {
spacing: 2
margins: [2, 2, 2, 2]
margins: [2]
}
@GUI::Label {

View file

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

View file

@ -28,7 +28,7 @@ void KeyboardMapperWidget::create_frame()
{
set_fill_with_background_color(true);
set_layout<GUI::VerticalBoxLayout>();
layout()->set_margins({ 4, 4, 4, 4 });
layout()->set_margins(4);
auto& main_widget = add<GUI::Widget>();
main_widget.set_relative_rect(0, 0, 200, 200);

View file

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

View file

@ -66,7 +66,7 @@ MailSettingsWindow::MailSettingsWindow()
auto& main_widget = set_main_widget<GUI::Widget>();
main_widget.set_fill_with_background_color(true);
main_widget.set_layout<GUI::VerticalBoxLayout>();
main_widget.layout()->set_margins({ 4, 4, 4, 4 });
main_widget.layout()->set_margins(4);
main_widget.layout()->set_spacing(6);
auto& tab_widget = main_widget.add<GUI::TabWidget>();

View file

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

View file

@ -44,7 +44,7 @@ MouseSettingsWindow::MouseSettingsWindow()
auto& main_widget = set_main_widget<GUI::Widget>();
main_widget.set_fill_with_background_color(true);
main_widget.set_layout<GUI::VerticalBoxLayout>();
main_widget.layout()->set_margins({ 4, 4, 4, 4 });
main_widget.layout()->set_margins(4);
main_widget.layout()->set_spacing(6);
auto& tab_widget = main_widget.add<GUI::TabWidget>();

View file

@ -2,7 +2,7 @@
fill_with_background_color: true
layout: @GUI::VerticalBoxLayout {
margins: [10, 10, 10, 10]
margins: [10]
spacing: 5
}
@ -11,7 +11,7 @@
fixed_height: 110
layout: @GUI::VerticalBoxLayout {
margins: [16, 8, 8, 8]
margins: [16, 8, 8]
spacing: 2
}
@ -60,7 +60,7 @@
fixed_height: 110
layout: @GUI::VerticalBoxLayout {
margins: [16, 8, 8, 8]
margins: [16, 8, 8]
spacing: 2
}
@ -83,7 +83,7 @@
@GUI::Widget {
layout: @GUI::HorizontalBoxLayout {
margins: [8, 8, 8, 8]
margins: [8]
spacing: 8
}
@ -114,7 +114,7 @@
fixed_height: 110
layout: @GUI::VerticalBoxLayout {
margins: [16, 8, 8, 8]
margins: [16, 8, 8]
spacing: 2
}
@ -137,7 +137,7 @@
@GUI::Widget {
layout: @GUI::HorizontalBoxLayout {
margins: [8, 8, 8, 8]
margins: [8]
spacing: 8
}

View file

@ -18,14 +18,14 @@ SidebarWidget::SidebarWidget()
auto& outline_container = tab_bar.add_tab<GUI::Widget>("Outline");
outline_container.set_layout<GUI::VerticalBoxLayout>();
outline_container.layout()->set_margins({ 4, 4, 4, 4 });
outline_container.layout()->set_margins(4);
m_outline_tree_view = outline_container.add<GUI::TreeView>();
m_outline_tree_view->set_activates_on_selection(true);
auto& thumbnails_container = tab_bar.add_tab<GUI::Widget>("Thumbnails");
thumbnails_container.set_layout<GUI::VerticalBoxLayout>();
thumbnails_container.layout()->set_margins({ 4, 4, 4, 4 });
thumbnails_container.layout()->set_margins(4);
// FIXME: Add thumbnail previews
}

View file

@ -24,7 +24,7 @@ MainWidget::MainWidget(TrackManager& track_manager, AudioPlayerLoop& loop)
{
set_layout<GUI::VerticalBoxLayout>();
layout()->set_spacing(2);
layout()->set_margins({ 2, 2, 2, 2 });
layout()->set_margins(2);
set_fill_with_background_color(true);
m_wave_widget = add<WaveWidget>(track_manager);

View file

@ -72,7 +72,7 @@ SamplerWidget::SamplerWidget(TrackManager& track_manager)
: m_track_manager(track_manager)
{
set_layout<GUI::VerticalBoxLayout>();
layout()->set_margins({ 10, 10, 10, 10 });
layout()->set_margins(10);
layout()->set_spacing(10);
set_fill_with_background_color(true);

View file

@ -6,7 +6,7 @@
@GUI::Widget {
layout: @GUI::VerticalBoxLayout {
margins: [4,4,4,4]
margins: [4]
}
@GUI::GroupBox {
@ -14,7 +14,7 @@
shrink_to_fit: true
layout: @GUI::HorizontalBoxLayout {
margins: [20,10,10,10]
margins: [20, 10, 10]
}
@GUI::RadioButton {
@ -31,7 +31,7 @@
@GUI::Widget {
layout: @GUI::HorizontalBoxLayout {
margins: [4,4,4,4]
margins: [4]
}
shrink_to_fit: true
@ -50,7 +50,7 @@
max_height: 24
layout: @GUI::HorizontalBoxLayout {
margins: [4,4,4,4]
margins: [4]
}
@GUI::Widget {

View file

@ -23,7 +23,7 @@ CreateNewImageDialog::CreateNewImageDialog(GUI::Window* parent_window)
main_widget.set_fill_with_background_color(true);
auto& layout = main_widget.set_layout<GUI::VerticalBoxLayout>();
layout.set_margins({ 4, 4, 4, 4 });
layout.set_margins(4);
auto& name_label = main_widget.add<GUI::Label>("Name:");
name_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);

View file

@ -24,7 +24,7 @@ CreateNewLayerDialog::CreateNewLayerDialog(Gfx::IntSize const& suggested_size, G
main_widget.set_fill_with_background_color(true);
auto& layout = main_widget.set_layout<GUI::VerticalBoxLayout>();
layout.set_margins({ 4, 4, 4, 4 });
layout.set_margins(4);
auto& name_label = main_widget.add<GUI::Label>("Name:");
name_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);

View file

@ -50,7 +50,7 @@ private:
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, 4, 4, 4 });
layout.set_margins(4);
size_t index = 0;
size_t columns = N;

View file

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

View file

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

View file

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

View file

@ -35,7 +35,7 @@ ToolboxWidget::ToolboxWidget()
set_layout<GUI::VerticalBoxLayout>();
layout()->set_spacing(0);
layout()->set_margins({ 2, 2, 2, 2 });
layout()->set_margins(2);
m_action_group.set_exclusive(true);
m_action_group.set_unchecking_allowed(false);

View file

@ -2,7 +2,7 @@
fill_with_background_color: true
layout: @GUI::VerticalBoxLayout {
margins: [4, 4, 4, 4]
margins: [4]
}
@GUI::Widget {
@ -24,7 +24,7 @@
@GUI::Widget {
layout: @GUI::HorizontalBoxLayout {
margins: [4, 4, 4, 4]
margins: [4]
}
@GUI::Label {

View file

@ -46,7 +46,7 @@ CellTypeDialog::CellTypeDialog(const Vector<Position>& positions, Sheet& sheet,
resize(285, 360);
auto& main_widget = set_main_widget<GUI::Widget>();
main_widget.set_layout<GUI::VerticalBoxLayout>().set_margins({ 4, 4, 4, 4 });
main_widget.set_layout<GUI::VerticalBoxLayout>().set_margins(4);
main_widget.set_fill_with_background_color(true);
auto& tab_widget = main_widget.add<GUI::TabWidget>();
@ -130,7 +130,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, const Vector<Position>& po
}
auto& type_tab = tabs.add_tab<GUI::Widget>("Type");
type_tab.set_layout<GUI::HorizontalBoxLayout>().set_margins({ 4, 4, 4, 4 });
type_tab.set_layout<GUI::HorizontalBoxLayout>().set_margins(4);
{
auto& left_side = type_tab.add<GUI::Widget>();
left_side.set_layout<GUI::VerticalBoxLayout>();
@ -192,14 +192,14 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, const Vector<Position>& po
}
auto& alignment_tab = tabs.add_tab<GUI::Widget>("Alignment");
alignment_tab.set_layout<GUI::VerticalBoxLayout>().set_margins({ 4, 4, 4, 4 });
alignment_tab.set_layout<GUI::VerticalBoxLayout>().set_margins(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, 0 });
horizontal_alignment_selection_container.layout()->set_margins({ 4, 0, 0 });
horizontal_alignment_selection_container.set_fixed_height(22);
auto& horizontal_alignment_label = horizontal_alignment_selection_container.add<GUI::Label>();
@ -231,7 +231,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, const Vector<Position>& po
{
auto& vertical_alignment_container = alignment_tab.add<GUI::Widget>();
vertical_alignment_container.set_layout<GUI::HorizontalBoxLayout>();
vertical_alignment_container.layout()->set_margins({ 0, 4, 0, 0 });
vertical_alignment_container.layout()->set_margins({ 4, 0, 0 });
vertical_alignment_container.set_fixed_height(22);
auto& vertical_alignment_label = vertical_alignment_container.add<GUI::Label>();
@ -261,7 +261,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, const Vector<Position>& po
}
auto& colors_tab = tabs.add_tab<GUI::Widget>("Color");
colors_tab.set_layout<GUI::VerticalBoxLayout>().set_margins({ 4, 4, 4, 4 });
colors_tab.set_layout<GUI::VerticalBoxLayout>().set_margins(4);
{
// Static formatting
{
@ -273,7 +273,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, const Vector<Position>& 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, 0 });
foreground_container.layout()->set_margins({ 4, 0, 0 });
foreground_container.set_shrink_to_fit(true);
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.
auto& background_container = static_formatting_container.add<GUI::Widget>();
background_container.set_layout<GUI::HorizontalBoxLayout>();
background_container.layout()->set_margins({ 4, 0, 0, 0 });
background_container.layout()->set_margins({ 4, 0, 0 });
background_container.set_shrink_to_fit(true);
auto& background_label = background_container.add<GUI::Label>();

View file

@ -3,7 +3,7 @@
fill_with_background_color: true
layout: @GUI::VerticalBoxLayout {
margins: [4, 4, 4, 4]
margins: [4]
spacing: 4
}

View file

@ -151,7 +151,7 @@ SpreadsheetView::SpreadsheetView(Sheet& sheet)
: m_sheet(sheet)
, m_sheet_model(SheetModel::create(*m_sheet))
{
set_layout<GUI::VerticalBoxLayout>().set_margins({ 2, 2, 2, 2 });
set_layout<GUI::VerticalBoxLayout>().set_margins(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);

View file

@ -26,7 +26,7 @@ SpreadsheetWidget::SpreadsheetWidget(NonnullRefPtrVector<Sheet>&& sheets, bool s
: m_workbook(make<Workbook>(move(sheets)))
{
set_fill_with_background_color(true);
set_layout<GUI::VerticalBoxLayout>().set_margins({ 2, 2, 2, 2 });
set_layout<GUI::VerticalBoxLayout>().set_margins(2);
auto& container = add<GUI::VerticalSplitter>();
auto& top_bar = container.add<GUI::Frame>();
@ -71,7 +71,7 @@ SpreadsheetWidget::SpreadsheetWidget(NonnullRefPtrVector<Sheet>&& sheets, bool s
m_inline_documentation_window->set_resizable(false);
auto& inline_widget = m_inline_documentation_window->set_main_widget<GUI::Frame>();
inline_widget.set_fill_with_background_color(true);
inline_widget.set_layout<GUI::VerticalBoxLayout>().set_margins({ 4, 4, 4, 4 });
inline_widget.set_layout<GUI::VerticalBoxLayout>().set_margins(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);

View file

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

View file

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

View file

@ -2,7 +2,7 @@
name: "select_format"
layout: @GUI::VerticalBoxLayout {
margins: [20, 20, 20, 20]
margins: [20]
}
@GUI::Label {

View file

@ -15,7 +15,7 @@ InterruptsWidget::InterruptsWidget()
{
on_first_show = [this](auto&) {
set_layout<GUI::VerticalBoxLayout>();
layout()->set_margins({ 4, 4, 4, 4 });
layout()->set_margins(4);
Vector<GUI::JsonArrayModel::FieldSpec> interrupts_field;
interrupts_field.empend("interrupt_line", "Line", Gfx::TextAlignment::CenterRight);

View file

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

View file

@ -16,7 +16,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
{
on_first_show = [this](auto&) {
set_layout<GUI::VerticalBoxLayout>();
layout()->set_margins({ 4, 4, 4, 4 });
layout()->set_margins(4);
set_fill_with_background_color(true);
m_network_connected_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/network-connected.png");
@ -32,7 +32,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
auto& adapters_group_box = add<GUI::GroupBox>("Adapters");
adapters_group_box.set_layout<GUI::VerticalBoxLayout>();
adapters_group_box.layout()->set_margins({ 16, 6, 6, 6 });
adapters_group_box.layout()->set_margins({ 16, 6, 6 });
adapters_group_box.set_fixed_height(120);
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");
tcp_sockets_group_box.set_layout<GUI::VerticalBoxLayout>();
tcp_sockets_group_box.layout()->set_margins({ 16, 6, 6, 6 });
tcp_sockets_group_box.layout()->set_margins({ 16, 6, 6 });
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");
udp_sockets_group_box.set_layout<GUI::VerticalBoxLayout>();
udp_sockets_group_box.layout()->set_margins({ 16, 6, 6, 6 });
udp_sockets_group_box.layout()->set_margins({ 16, 6, 6 });
m_udp_socket_table_view = udp_sockets_group_box.add<GUI::TableView>();

View file

@ -13,7 +13,7 @@
ProcessFileDescriptorMapWidget::ProcessFileDescriptorMapWidget()
{
set_layout<GUI::VerticalBoxLayout>();
layout()->set_margins({ 4, 4, 4, 4 });
layout()->set_margins(4);
m_table_view = add<GUI::TableView>();
Vector<GUI::JsonArrayModel::FieldSpec> pid_fds_fields;

View file

@ -47,7 +47,7 @@ public:
ProcessMemoryMapWidget::ProcessMemoryMapWidget()
{
set_layout<GUI::VerticalBoxLayout>();
layout()->set_margins({ 4, 4, 4, 4 });
layout()->set_margins(4);
m_table_view = add<GUI::TableView>();
Vector<GUI::JsonArrayModel::FieldSpec> pid_vm_fields;
pid_vm_fields.empend(

View file

@ -84,7 +84,7 @@ private:
ProcessStateWidget::ProcessStateWidget(pid_t pid)
{
set_layout<GUI::VerticalBoxLayout>();
layout()->set_margins({ 4, 4, 4, 4 });
layout()->set_margins(4);
m_table_view = add<GUI::TableView>();
m_table_view->set_model(adopt_ref(*new ProcessStateModel(ProcessModel::the(), pid)));
m_table_view->column_header().set_visible(false);

View file

@ -13,7 +13,7 @@
ProcessUnveiledPathsWidget::ProcessUnveiledPathsWidget()
{
set_layout<GUI::VerticalBoxLayout>();
layout()->set_margins({ 4, 4, 4, 4 });
layout()->set_margins(4);
m_table_view = add<GUI::TableView>();
Vector<GUI::JsonArrayModel::FieldSpec> pid_unveil_fields;

View file

@ -14,7 +14,7 @@
ThreadStackWidget::ThreadStackWidget()
{
set_layout<GUI::VerticalBoxLayout>();
layout()->set_margins({ 4, 4, 4, 4 });
layout()->set_margins(4);
m_stack_editor = add<GUI::TextEditor>();
m_stack_editor->set_mode(GUI::TextEditor::ReadOnly);
m_stack_editor->set_text("Symbolicating...");

View file

@ -179,7 +179,7 @@ int main(int argc, char** argv)
auto& tabwidget_container = main_widget.add<GUI::Widget>();
tabwidget_container.set_layout<GUI::VerticalBoxLayout>();
tabwidget_container.layout()->set_margins({ 0, 4, 4, 4 });
tabwidget_container.layout()->set_margins({ 0, 4, 4 });
auto& tabwidget = tabwidget_container.add<GUI::TabWidget>();
statusbar = main_widget.add<GUI::Statusbar>(3);
@ -214,7 +214,7 @@ int main(int argc, char** argv)
tabwidget.add_widget("Interrupts", interrupts_widget);
process_table_container.set_layout<GUI::VerticalBoxLayout>();
process_table_container.layout()->set_margins({ 4, 4, 4, 4 });
process_table_container.layout()->set_margins(4);
process_table_container.layout()->set_spacing(0);
auto& process_table_view = process_table_container.add<GUI::TableView>();
@ -434,7 +434,7 @@ NonnullRefPtr<GUI::Window> build_process_window(pid_t pid)
auto& hero_container = main_widget.add<GUI::Widget>();
hero_container.set_shrink_to_fit(true);
hero_container.set_layout<GUI::HorizontalBoxLayout>();
hero_container.layout()->set_margins({ 4, 4, 4, 4 });
hero_container.layout()->set_margins(4);
hero_container.layout()->set_spacing(8);
auto& icon_label = hero_container.add<GUI::Label>();
@ -493,7 +493,7 @@ NonnullRefPtr<GUI::Widget> build_file_systems_tab()
fs_widget->on_first_show = [](GUI::LazyWidget& self) {
self.set_layout<GUI::VerticalBoxLayout>();
self.layout()->set_margins({ 4, 4, 4, 4 });
self.layout()->set_margins(4);
auto& fs_table_view = self.add<GUI::TableView>();
Vector<GUI::JsonArrayModel::FieldSpec> df_fields;
@ -589,7 +589,7 @@ NonnullRefPtr<GUI::Widget> build_pci_devices_tab()
pci_widget->on_first_show = [](GUI::LazyWidget& self) {
self.set_layout<GUI::VerticalBoxLayout>();
self.layout()->set_margins({ 4, 4, 4, 4 });
self.layout()->set_margins(4);
auto& pci_table_view = self.add<GUI::TableView>();
auto db = PCIDB::Database::open();
@ -648,7 +648,7 @@ NonnullRefPtr<GUI::Widget> build_devices_tab()
devices_widget->on_first_show = [](GUI::LazyWidget& self) {
self.set_layout<GUI::VerticalBoxLayout>();
self.layout()->set_margins({ 4, 4, 4, 4 });
self.layout()->set_margins(4);
auto& devices_table_view = self.add<GUI::TableView>();
devices_table_view.set_model(GUI::SortingProxyModel::create(DevicesModel::create()));
@ -665,11 +665,11 @@ NonnullRefPtr<GUI::Widget> build_graphs_tab()
graphs_container->set_fill_with_background_color(true);
graphs_container->set_background_role(ColorRole::Button);
graphs_container->set_layout<GUI::VerticalBoxLayout>();
graphs_container->layout()->set_margins({ 4, 4, 4, 4 });
graphs_container->layout()->set_margins(4);
auto& cpu_graph_group_box = graphs_container->add<GUI::GroupBox>("CPU usage");
cpu_graph_group_box.set_layout<GUI::HorizontalBoxLayout>();
cpu_graph_group_box.layout()->set_margins({ 16, 6, 6, 6 });
cpu_graph_group_box.layout()->set_margins({ 16, 6, 6 });
cpu_graph_group_box.set_fixed_height(120);
Vector<GraphWidget&> cpu_graphs;
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");
memory_graph_group_box.set_layout<GUI::VerticalBoxLayout>();
memory_graph_group_box.layout()->set_margins({ 16, 6, 6, 6 });
memory_graph_group_box.layout()->set_margins({ 16, 6, 6 });
memory_graph_group_box.set_fixed_height(120);
auto& memory_graph = memory_graph_group_box.add<GraphWidget>();
memory_graph.set_stack_values(true);
@ -734,7 +734,7 @@ NonnullRefPtr<GUI::Widget> build_processors_tab()
processors_widget->on_first_show = [](GUI::LazyWidget& self) {
self.set_layout<GUI::VerticalBoxLayout>();
self.layout()->set_margins({ 4, 4, 4, 4 });
self.layout()->set_margins(4);
Vector<GUI::JsonArrayModel::FieldSpec> processors_field;
processors_field.empend("processor", "Processor", Gfx::TextAlignment::CenterRight);

View file

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

View file

@ -190,11 +190,11 @@ static RefPtr<GUI::Window> create_find_window(VT::TerminalWidget& terminal)
search.set_fill_with_background_color(true);
search.set_background_role(ColorRole::Button);
search.set_layout<GUI::VerticalBoxLayout>();
search.layout()->set_margins({ 4, 4, 4, 4 });
search.layout()->set_margins(4);
auto& find = search.add<GUI::Widget>();
find.set_layout<GUI::HorizontalBoxLayout>();
find.layout()->set_margins({ 4, 4, 4, 4 });
find.layout()->set_margins(4);
find.set_fixed_height(30);
auto& find_textbox = find.add<GUI::TextBox>();

View file

@ -36,7 +36,7 @@
layout: @GUI::VerticalBoxLayout {
spacing: 2
margins: [5, 5, 5, 5]
margins: [5]
}
@GUI::Widget {