WPF layout (#3346)

This commit is contained in:
Pieter-Jan Briers
2021-02-21 12:38:56 +01:00
committed by GitHub
parent 33d6975c25
commit b898443f28
121 changed files with 1420 additions and 2069 deletions

View File

@@ -9,6 +9,7 @@ using Robust.Client.UserInterface.Controls;
using Robust.Shared.Input;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
@@ -39,25 +40,15 @@ namespace Content.Client.UserInterface
IoCManager.InjectDependencies(this);
Button resetAllButton;
var vBox = new VBoxContainer();
var vBox = new VBoxContainer {Margin = new Thickness(2, 0, 0, 0)};
AddChild(new VBoxContainer
{
Children =
{
new ScrollContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
Children =
{
new MarginContainer
{
MarginLeftOverride = 2,
Children =
{
vBox
}
}
}
VerticalExpand = true,
Children = {vBox}
},
new StripeBack
@@ -70,7 +61,7 @@ namespace Content.Client.UserInterface
{
Children =
{
new Control {CustomMinimumSize = (2, 0)},
new Control {MinSize = (2, 0)},
new Label
{
StyleClasses = {StyleBase.StyleClassLabelSubText},
@@ -80,7 +71,7 @@ namespace Content.Client.UserInterface
{
Text = "Reset ALL keybinds",
StyleClasses = {StyleBase.ButtonCaution},
SizeFlagsHorizontal = SizeFlags.ShrinkEnd | SizeFlags.Expand
HorizontalAlignment = HAlignment.Right
})
}
}
@@ -89,7 +80,7 @@ namespace Content.Client.UserInterface
}
});
resetAllButton.OnPressed += args =>
resetAllButton.OnPressed += _ =>
{
_deferCommands.Add(() =>
{
@@ -104,7 +95,7 @@ namespace Content.Client.UserInterface
{
if (!first)
{
vBox.AddChild(new Control {CustomMinimumSize = (0, 8)});
vBox.AddChild(new Control {MinSize = (0, 8)});
}
first = false;
@@ -409,22 +400,23 @@ namespace Content.Client.UserInterface
var name = new Label
{
Text = Loc.GetString(niceName),
SizeFlagsHorizontal = SizeFlags.Expand
HorizontalExpand = true,
HorizontalAlignment = HAlignment.Left
};
BindButton1 = new BindButton(parent, this, StyleBase.ButtonOpenRight);
BindButton2 = new BindButton(parent, this, StyleBase.ButtonOpenLeft);
ResetButton = new Button {Text = "Reset", StyleClasses = {StyleBase.ButtonCaution}};
ResetButton = new Button {Text = Loc.GetString("Reset"), StyleClasses = {StyleBase.ButtonCaution}};
var hBox = new HBoxContainer
{
Children =
{
new Control {CustomMinimumSize = (5, 0)},
new Control {MinSize = (5, 0)},
name,
BindButton1,
BindButton2,
new Control {CustomMinimumSize = (10, 0)},
new Control {MinSize = (10, 0)},
ResetButton
}
};
@@ -464,7 +456,7 @@ namespace Content.Client.UserInterface
Button.OnKeyBindDown += ButtonOnOnKeyBindDown;
CustomMinimumSize = (200, 0);
MinSize = (200, 0);
}
private void ButtonOnOnKeyBindDown(GUIBoundKeyEventArgs args)