Applications+Games+LibGUI: Fix layout problems

This commit is contained in:
FrHun 2022-06-29 05:05:44 +02:00 committed by Andreas Kling
parent c2d344bd8c
commit f59c167bb0
10 changed files with 34 additions and 41 deletions

View file

@ -40,7 +40,7 @@
} }
@GUI::Widget { @GUI::Widget {
shrink_to_fit: true preferred_height: "fit"
layout: @GUI::HorizontalBoxLayout { layout: @GUI::HorizontalBoxLayout {
spacing: 4 spacing: 4
margins: [0, 2, 0, 2] margins: [0, 2, 0, 2]

View file

@ -19,7 +19,7 @@
} }
@GUI::Widget { @GUI::Widget {
shrink_to_fit: true preferred_height: "fit"
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
spacing: 4 spacing: 4
} }
@ -59,15 +59,15 @@
@GUI::Label { @GUI::Label {
text: "Preview:" text: "Preview:"
text_alignment: "CenterLeft" text_alignment: "CenterLeft"
preferred_width: 120
} }
@GUI::Frame { @GUI::Label {
layout: @GUI::VerticalBoxLayout {} shape: "Container"
thickness: 2
@GUI::Label { shadow: "Sunken"
name: "clock_preview" name: "clock_preview"
text: "12:34:56" text: "12:34:56"
}
} }
} }
} }

View file

@ -20,7 +20,7 @@ EditGuideDialog::EditGuideDialog(GUI::Window* parent_window, String const& offse
{ {
set_title("Create new Guide"); set_title("Create new Guide");
set_icon(parent_window->icon()); set_icon(parent_window->icon());
resize(200, 120); resize(200, 130);
set_resizable(false); set_resizable(false);
auto& main_widget = set_main_widget<GUI::Widget>(); auto& main_widget = set_main_widget<GUI::Widget>();

View file

@ -9,7 +9,7 @@
@GUI::GroupBox { @GUI::GroupBox {
title: "Orientation" title: "Orientation"
shrink_to_fit: true preferred_height: "fit"
layout: @GUI::HorizontalBoxLayout { layout: @GUI::HorizontalBoxLayout {
margins: [10, 8, 8] margins: [10, 8, 8]
} }
@ -30,7 +30,7 @@
layout: @GUI::HorizontalBoxLayout { layout: @GUI::HorizontalBoxLayout {
margins: [4] margins: [4]
} }
shrink_to_fit: true preferred_height: "fit"
@GUI::Label { @GUI::Label {
text: "Offset" text: "Offset"
@ -48,18 +48,16 @@
margins: [4] margins: [4]
} }
@GUI::Widget {} @GUI::Layout::Spacer {}
@GUI::Button { @GUI::DialogButton {
name: "ok_button" name: "ok_button"
text: "OK" text: "OK"
max_width: 75
} }
@GUI::Button { @GUI::DialogButton {
name: "cancel_button" name: "cancel_button"
text: "Cancel" text: "Cancel"
max_width: 75
} }
} }
} }

View file

@ -45,16 +45,14 @@
@GUI::Widget {} @GUI::Widget {}
@GUI::Button { @GUI::DialogButton {
name: "apply_button" name: "apply_button"
text: "Apply" text: "Apply"
max_width: 75
} }
@GUI::Button { @GUI::DialogButton {
name: "cancel_button" name: "cancel_button"
text: "Cancel" text: "Cancel"
max_width: 75
} }
} }
} }

View file

@ -65,6 +65,7 @@ private:
for (size_t column = 0; column < columns; ++column) { for (size_t column = 0; column < columns; ++column) {
if (index < columns * rows) { if (index < columns * rows) {
auto& textbox = horizontal_container.template add<GUI::TextBox>(); auto& textbox = horizontal_container.template add<GUI::TextBox>();
textbox.set_min_width(22);
textbox.on_change = [&, row = row, column = column] { textbox.on_change = [&, row = row, column = column] {
auto& element = m_matrix.elements()[row][column]; auto& element = m_matrix.elements()[row][column];
char* endptr = nullptr; char* endptr = nullptr;

View file

@ -8,7 +8,7 @@
@GUI::GroupBox { @GUI::GroupBox {
title: "Size (px)" title: "Size (px)"
shrink_to_fit: true preferred_height: "fit"
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [4] margins: [4]
} }
@ -69,7 +69,7 @@
@GUI::GroupBox { @GUI::GroupBox {
title: "Scaling Mode" title: "Scaling Mode"
shrink_to_fit: true preferred_height: "fit"
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [4] margins: [4]
} }
@ -97,18 +97,16 @@
@GUI::Widget { @GUI::Widget {
layout: @GUI::HorizontalBoxLayout {} layout: @GUI::HorizontalBoxLayout {}
@GUI::Widget {} @GUI::Layout::Spacer {}
@GUI::Button { @GUI::DialogButton {
name: "ok_button" name: "ok_button"
text: "OK" text: "OK"
max_width: 75
} }
@GUI::Button { @GUI::DialogButton {
name: "cancel_button" name: "cancel_button"
text: "Cancel" text: "Cancel"
max_width: 75
} }
} }
} }

View file

@ -41,15 +41,13 @@
spacing: 6 spacing: 6
} }
@GUI::Frame { @GUI::Label {
preferred_height: "fit"
background_role: "Base" background_role: "Base"
shape: "Container"
shadow: "Sunken"
thickness: 2
fill_with_background_color: true fill_with_background_color: true
layout: @GUI::VerticalBoxLayout {} name: "terminal_font_label"
@GUI::Label {
name: "terminal_font_label"
}
} }
@GUI::Button { @GUI::Button {
@ -62,7 +60,7 @@
@GUI::GroupBox { @GUI::GroupBox {
title: "Cursor settings" title: "Cursor settings"
shrink_to_fit: true preferred_height: "fit"
layout: @GUI::VerticalBoxLayout { layout: @GUI::VerticalBoxLayout {
margins: [16, 8, 8] margins: [16, 8, 8]
} }

View file

@ -56,18 +56,16 @@
max_height: 24 max_height: 24
layout: @GUI::HorizontalBoxLayout {} layout: @GUI::HorizontalBoxLayout {}
@GUI::Widget {} @GUI::Layout::Spacer {}
@GUI::Button { @GUI::DialogButton {
name: "ok_button" name: "ok_button"
text: "OK" text: "OK"
max_width: 75
} }
@GUI::Button { @GUI::DialogButton {
name: "cancel_button" name: "cancel_button"
text: "Cancel" text: "Cancel"
max_width: 75
} }
} }
} }

View file

@ -14,6 +14,8 @@
fixed_height: 32 fixed_height: 32
fixed_width: 32 fixed_width: 32
} }
@GUI::Layout::Spacer {}
} }
@GUI::Widget { @GUI::Widget {