mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:17:46 +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:
parent
9c9a5c55cb
commit
e11d177618
101 changed files with 232 additions and 201 deletions
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
@GUI::GroupBox {
|
||||
title: "Layers"
|
||||
layout: @GUI::VerticalBoxLayout {
|
||||
margins: [16, 6, 6, 6]
|
||||
margins: [16, 6, 6]
|
||||
}
|
||||
|
||||
@PixelPaint::LayerListWidget {
|
||||
|
|
|
@ -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>();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue