Replace most VBox/HBoxContainers with BoxContainers (#4274)

This commit is contained in:
Visne
2021-07-18 18:39:31 +02:00
committed by GitHub
parent 0d1af2c5ff
commit bf493c39b7
101 changed files with 1143 additions and 567 deletions

View File

@@ -4,11 +4,11 @@
Title="{Loc 'ui-escape-title'}"
Resizable="False">
<VBoxContainer SeparationOverride="4" CustomMinimumSize="150 160">
<BoxContainer Orientation="Vertical" SeparationOverride="4" CustomMinimumSize="150 160">
<changelog:ChangelogButton />
<ui:VoteCallMenuButton />
<Button Name="OptionsButton" Text="{Loc 'ui-escape-options'}" />
<Button Name="DisconnectButton" Text="{Loc 'ui-escape-disconnect'}" />
<Button Name="QuitButton" Text="{Loc 'ui-escape-quit'}" />
</VBoxContainer>
</BoxContainer>
</SS14Window>

View File

@@ -9,6 +9,7 @@ using Robust.Shared;
using Robust.Shared.Configuration;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using static Robust.Client.UserInterface.Controls.BoxContainer;
namespace Content.Client.EscapeMenu.UI
{
@@ -31,10 +32,14 @@ namespace Content.Client.EscapeMenu.UI
_cfg = cfg;
_clydeAudio = clydeAudio;
var vBox = new VBoxContainer();
var contents = new VBoxContainer
var vBox = new BoxContainer
{
Orientation = LayoutOrientation.Vertical
};
var contents = new BoxContainer
{
Orientation = LayoutOrientation.Vertical,
Margin = new Thickness(2, 2, 2, 0),
VerticalExpand = true,
};
@@ -54,8 +59,9 @@ namespace Content.Client.EscapeMenu.UI
Align = Label.AlignMode.Right
};
contents.AddChild(new HBoxContainer
contents.AddChild(new BoxContainer
{
Orientation = LayoutOrientation.Horizontal,
Children =
{
new Control {MinSize = (4, 0)},
@@ -106,9 +112,10 @@ namespace Content.Client.EscapeMenu.UI
HasMargins = false,
Children =
{
new HBoxContainer
new BoxContainer
{
Align = BoxContainer.AlignMode.End,
Orientation = LayoutOrientation.Horizontal,
Align = AlignMode.End,
HorizontalExpand = true,
VerticalExpand = true,
Children =

View File

@@ -10,6 +10,7 @@ using Robust.Shared.Configuration;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using static Robust.Client.UserInterface.Controls.BoxContainer;
namespace Content.Client.EscapeMenu.UI
{
@@ -47,10 +48,14 @@ namespace Content.Client.EscapeMenu.UI
{
_cfg = cfg;
_prototypeManager = proMan;
var vBox = new VBoxContainer();
var contents = new VBoxContainer
var vBox = new BoxContainer
{
Orientation = LayoutOrientation.Vertical
};
var contents = new BoxContainer
{
Orientation = LayoutOrientation.Vertical,
Margin = new Thickness(2, 2, 2, 0),
VerticalExpand = true,
};
@@ -70,8 +75,9 @@ namespace Content.Client.EscapeMenu.UI
LightingPresetOption.AddItem(Loc.GetString("ui-options-lighting-high"));
LightingPresetOption.OnItemSelected += OnLightingQualityChanged;
contents.AddChild(new HBoxContainer
contents.AddChild(new BoxContainer
{
Orientation = LayoutOrientation.Horizontal,
Children =
{
new Label {Text = Loc.GetString("ui-options-lighting-label")},
@@ -97,8 +103,9 @@ namespace Content.Client.EscapeMenu.UI
_uiScaleOption.AddItem(Loc.GetString("ui-options-scale-200"));
_uiScaleOption.OnItemSelected += OnUIScaleChanged;
contents.AddChild(new HBoxContainer
contents.AddChild(new BoxContainer
{
Orientation = LayoutOrientation.Horizontal,
Children =
{
new Label {Text = Loc.GetString("ui-options-scale-label")},
@@ -114,8 +121,9 @@ namespace Content.Client.EscapeMenu.UI
}
_hudThemeOption.OnItemSelected += OnHudThemeChanged;
contents.AddChild(new HBoxContainer
contents.AddChild(new BoxContainer
{
Orientation = LayoutOrientation.Horizontal,
Children =
{
new Label {Text = Loc.GetString("ui-options-hud-theme")},
@@ -152,13 +160,15 @@ namespace Content.Client.EscapeMenu.UI
_viewportLowResCheckBox = new CheckBox { Text = Loc.GetString("ui-options-vp-low-res")};
_viewportLowResCheckBox.OnToggled += OnCheckBoxToggled;
contents.AddChild(new HBoxContainer
contents.AddChild(new BoxContainer
{
Orientation = LayoutOrientation.Horizontal,
Children =
{
_viewportStretchCheckBox,
(_viewportScaleBox = new HBoxContainer
(_viewportScaleBox = new BoxContainer
{
Orientation = LayoutOrientation.Horizontal,
Children =
{
(_viewportScaleText = new Label

View File

@@ -12,6 +12,7 @@ using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using static Robust.Client.UserInterface.Controls.BoxContainer;
namespace Content.Client.EscapeMenu.UI
{
@@ -40,9 +41,14 @@ namespace Content.Client.EscapeMenu.UI
IoCManager.InjectDependencies(this);
Button resetAllButton;
var vBox = new VBoxContainer {Margin = new Thickness(2, 0, 0, 0)};
AddChild(new VBoxContainer
var vBox = new BoxContainer
{
Orientation = LayoutOrientation.Vertical,
Margin = new Thickness(2, 0, 0, 0)
};
AddChild(new BoxContainer
{
Orientation = LayoutOrientation.Vertical,
Children =
{
new ScrollContainer
@@ -57,8 +63,9 @@ namespace Content.Client.EscapeMenu.UI
HasMargins = false,
Children =
{
new HBoxContainer
new BoxContainer
{
Orientation = LayoutOrientation.Horizontal,
Children =
{
new Control {MinSize = (2, 0)},
@@ -413,8 +420,9 @@ namespace Content.Client.EscapeMenu.UI
BindButton2 = new BindButton(parent, this, StyleBase.ButtonOpenLeft);
ResetButton = new Button {Text = Loc.GetString("ui-options-bind-reset"), StyleClasses = {StyleBase.ButtonCaution}};
var hBox = new HBoxContainer
var hBox = new BoxContainer
{
Orientation = LayoutOrientation.Horizontal,
Children =
{
new Control {MinSize = (5, 0)},