1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-28 21:22:08 +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

@ -154,21 +154,21 @@ void ColorPicker::build_ui()
{
auto& root_container = set_main_widget<Widget>();
root_container.set_layout<VerticalBoxLayout>();
root_container.layout()->set_margins({ 4, 4, 4, 4 });
root_container.layout()->set_margins(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, 4, 4, 4 });
tab_palette.layout()->set_margins(4);
tab_palette.layout()->set_spacing(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, 4, 4, 4 });
tab_custom_color.layout()->set_margins(4);
tab_custom_color.layout()->set_spacing(4);
build_ui_custom(tab_custom_color);
@ -245,7 +245,7 @@ void ColorPicker::build_ui_custom(Widget& root_container)
auto& preview_container = vertical_container.add<Frame>();
preview_container.set_layout<VerticalBoxLayout>();
preview_container.layout()->set_margins({ 2, 2, 2, 2 });
preview_container.layout()->set_margins(2);
preview_container.layout()->set_spacing(0);
preview_container.set_fixed_height(128);