WPF layout (#3346)
This commit is contained in:
committed by
GitHub
parent
33d6975c25
commit
b898443f28
@@ -19,80 +19,52 @@ namespace Content.Client.GameObjects.Components.Wires
|
||||
|
||||
private readonly List<(string name, LineEdit input)> _inputs;
|
||||
|
||||
protected override Vector2? CustomSize => (300, 250);
|
||||
|
||||
public ConfigurationMenu(ConfigurationBoundUserInterface owner)
|
||||
{
|
||||
MinSize = SetSize = (300, 250);
|
||||
Owner = owner;
|
||||
|
||||
_inputs = new List<(string name, LineEdit input)>();
|
||||
|
||||
Title = Loc.GetString("Device Configuration");
|
||||
|
||||
var margin = new MarginContainer
|
||||
{
|
||||
MarginBottomOverride = 8,
|
||||
MarginLeftOverride = 8,
|
||||
MarginRightOverride = 8,
|
||||
MarginTopOverride = 8
|
||||
};
|
||||
|
||||
_baseContainer = new VBoxContainer
|
||||
{
|
||||
SizeFlagsVertical = SizeFlags.FillExpand,
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand
|
||||
VerticalExpand = true,
|
||||
HorizontalExpand = true
|
||||
};
|
||||
|
||||
_column = new VBoxContainer
|
||||
{
|
||||
Margin = new Thickness(8),
|
||||
SeparationOverride = 16,
|
||||
SizeFlagsVertical = SizeFlags.Fill
|
||||
};
|
||||
|
||||
_row = new HBoxContainer
|
||||
{
|
||||
SeparationOverride = 16,
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand
|
||||
};
|
||||
|
||||
var buttonRow = new HBoxContainer
|
||||
{
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand
|
||||
};
|
||||
|
||||
var spacer1 = new HBoxContainer
|
||||
{
|
||||
SizeFlagsHorizontal = SizeFlags.Expand
|
||||
};
|
||||
|
||||
var spacer2 = new HBoxContainer()
|
||||
{
|
||||
SizeFlagsHorizontal = SizeFlags.Expand
|
||||
HorizontalExpand = true
|
||||
};
|
||||
|
||||
var confirmButton = new Button
|
||||
{
|
||||
Text = Loc.GetString("Confirm"),
|
||||
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
|
||||
SizeFlagsVertical = SizeFlags.ShrinkCenter
|
||||
HorizontalAlignment = HAlignment.Center,
|
||||
VerticalAlignment = VAlignment.Center
|
||||
};
|
||||
|
||||
confirmButton.OnButtonUp += OnConfirm;
|
||||
buttonRow.AddChild(spacer1);
|
||||
buttonRow.AddChild(confirmButton);
|
||||
buttonRow.AddChild(spacer2);
|
||||
|
||||
var outerColumn = new ScrollContainer
|
||||
{
|
||||
SizeFlagsVertical = SizeFlags.FillExpand,
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand,
|
||||
VerticalExpand = true,
|
||||
HorizontalExpand = true,
|
||||
ModulateSelfOverride = Color.FromHex("#202025")
|
||||
};
|
||||
|
||||
margin.AddChild(_column);
|
||||
outerColumn.AddChild(margin);
|
||||
outerColumn.AddChild(_column);
|
||||
_baseContainer.AddChild(outerColumn);
|
||||
_baseContainer.AddChild(buttonRow);
|
||||
_baseContainer.AddChild(confirmButton);
|
||||
Contents.AddChild(_baseContainer);
|
||||
}
|
||||
|
||||
@@ -103,19 +75,15 @@ namespace Content.Client.GameObjects.Components.Wires
|
||||
|
||||
foreach (var field in state.Config)
|
||||
{
|
||||
var margin = new MarginContainer
|
||||
{
|
||||
MarginRightOverride = 8
|
||||
};
|
||||
|
||||
var label = new Label
|
||||
{
|
||||
Margin = new Thickness(0, 0, 8, 0),
|
||||
Name = field.Key,
|
||||
Text = field.Key + ":",
|
||||
SizeFlagsVertical = SizeFlags.ShrinkCenter,
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand,
|
||||
VerticalAlignment = VAlignment.Center,
|
||||
HorizontalExpand = true,
|
||||
SizeFlagsStretchRatio = .2f,
|
||||
CustomMinimumSize = new Vector2(60, 0)
|
||||
MinSize = new Vector2(60, 0)
|
||||
};
|
||||
|
||||
var input = new LineEdit
|
||||
@@ -123,7 +91,7 @@ namespace Content.Client.GameObjects.Components.Wires
|
||||
Name = field.Key + "-input",
|
||||
Text = field.Value,
|
||||
IsValid = Validate,
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand,
|
||||
HorizontalExpand = true,
|
||||
SizeFlagsStretchRatio = .8f
|
||||
};
|
||||
|
||||
@@ -132,8 +100,7 @@ namespace Content.Client.GameObjects.Components.Wires
|
||||
var row = new HBoxContainer();
|
||||
CopyProperties(_row, row);
|
||||
|
||||
margin.AddChild(label);
|
||||
row.AddChild(margin);
|
||||
row.AddChild(label);
|
||||
row.AddChild(input);
|
||||
_column.AddChild(row);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user