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

@@ -23,7 +23,6 @@ namespace Content.Client.Research
public Button QueueButton;
public Button ServerConnectButton;
public Button ServerSyncButton;
protected override Vector2? CustomSize => (300, 450);
public LatheBoundUserInterface Owner { get; set; }
@@ -31,28 +30,23 @@ namespace Content.Client.Research
public LatheMenu(LatheBoundUserInterface owner = null)
{
SetSize = MinSize = (300, 450);
IoCManager.InjectDependencies(this);
Owner = owner;
Title = "Lathe Menu";
var margin = new MarginContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
};
var vBox = new VBoxContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SeparationOverride = 5,
};
var hBoxButtons = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
SizeFlagsStretchRatio = 1,
};
@@ -60,7 +54,6 @@ namespace Content.Client.Research
{
Text = "Queue",
TextAlign = Label.AlignMode.Center,
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsStretchRatio = 1,
};
@@ -68,7 +61,6 @@ namespace Content.Client.Research
{
Text = "Server list",
TextAlign = Label.AlignMode.Center,
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsStretchRatio = 1,
};
@@ -76,27 +68,26 @@ namespace Content.Client.Research
{
Text = "Sync",
TextAlign = Label.AlignMode.Center,
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsStretchRatio = 1,
};
var spacer = new Control()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
SizeFlagsStretchRatio = 3,
};
var hBoxFilter = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
SizeFlagsStretchRatio = 1
};
_searchBar = new LineEdit()
{
PlaceHolder = "Search Designs",
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
SizeFlagsStretchRatio = 3
};
@@ -106,7 +97,6 @@ namespace Content.Client.Research
{
Text = "Filter",
TextAlign = Label.AlignMode.Center,
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsStretchRatio = 1,
Disabled = true,
};
@@ -114,7 +104,7 @@ namespace Content.Client.Research
_items = new ItemList()
{
SizeFlagsStretchRatio = 8,
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SelectMode = ItemList.ItemListSelectMode.Button,
};
@@ -124,14 +114,14 @@ namespace Content.Client.Research
{
PlaceHolder = "Amount",
Text = "1",
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
};
_amountLineEdit.OnTextChanged += PopulateDisabled;
_materials = new ItemList()
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SizeFlagsStretchRatio = 3
};
@@ -153,9 +143,7 @@ namespace Content.Client.Research
vBox.AddChild(_amountLineEdit);
vBox.AddChild(_materials);
margin.AddChild(vBox);
Contents.AddChild(margin);
Contents.AddChild(vBox);
}
public void ItemSelected(ItemList.ItemListSelectedEventArgs args)

View File

@@ -4,15 +4,13 @@ using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.Utility;
using Robust.Shared.Maths;
using Robust.Shared.Localization;
using Robust.Shared.ViewVariables;
namespace Content.Client.Research
{
public class LatheQueueMenu : SS14Window
{
protected override Vector2? CustomSize => (300, 450);
public LatheBoundUserInterface Owner { get; set; }
[ViewVariables]
@@ -23,67 +21,45 @@ namespace Content.Client.Research
public LatheQueueMenu()
{
Title = "Lathe Queue";
var margin = new MarginContainer()
{
/*MarginTop = 5f,
MarginLeft = 5f,
MarginRight = -5f,
MarginBottom = -5f,*/
};
// margin.SetAnchorAndMarginPreset(LayoutPreset.Wide);
SetSize = MinSize = (300, 450);
Title = Loc.GetString("Lathe Queue");
var vBox = new VBoxContainer();
// vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide);
var descMargin = new MarginContainer()
{
/*MarginTop = 5f,
MarginLeft = 5f,
MarginRight = -5f,
MarginBottom = -5f,*/
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsStretchRatio = 2,
};
var hBox = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
SizeFlagsStretchRatio = 2,
};
_icon = new TextureRect()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
HorizontalExpand = true,
SizeFlagsStretchRatio = 2,
};
var vBoxInfo = new VBoxContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SizeFlagsStretchRatio = 3,
};
_nameLabel = new Label()
{
RectClipContent = true,
SizeFlagsHorizontal = SizeFlags.Fill,
};
_description = new Label()
{
RectClipContent = true,
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.Fill,
VerticalAlignment = VAlignment.Stretch,
VerticalExpand = true
};
_queueList = new ItemList()
{
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.FillExpand,
VerticalExpand = true,
SizeFlagsStretchRatio = 3,
SelectMode = ItemList.ItemListSelectMode.None
};
@@ -94,14 +70,10 @@ namespace Content.Client.Research
hBox.AddChild(_icon);
hBox.AddChild(vBoxInfo);
descMargin.AddChild(hBox);
vBox.AddChild(descMargin);
vBox.AddChild(hBox);
vBox.AddChild(_queueList);
margin.AddChild(vBox);
Contents.AddChild(margin);
Contents.AddChild(vBox);
ClearInfo();
}

View File

@@ -16,8 +16,6 @@ namespace Content.Client.Research
{
public ResearchConsoleBoundUserInterface Owner { get; set; }
protected override Vector2? CustomSize => (800, 400);
private readonly List<TechnologyPrototype> _unlockedTechnologyPrototypes = new();
private readonly List<TechnologyPrototype> _unlockableTechnologyPrototypes = new();
private readonly List<TechnologyPrototype> _futureTechnologyPrototypes = new();
@@ -40,6 +38,8 @@ namespace Content.Client.Research
public ResearchConsoleMenu(ResearchConsoleBoundUserInterface owner = null)
{
SetSize = MinSize = (800, 400);
IoCManager.InjectDependencies(this);
Title = Loc.GetString("R&D Console");
@@ -49,8 +49,8 @@ namespace Content.Client.Research
_unlockedTechnologies = new ItemList()
{
SelectMode = ItemList.ItemListSelectMode.Button,
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
};
_unlockedTechnologies.OnItemSelected += UnlockedTechnologySelected;
@@ -58,8 +58,8 @@ namespace Content.Client.Research
_unlockableTechnologies = new ItemList()
{
SelectMode = ItemList.ItemListSelectMode.Button,
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
};
_unlockableTechnologies.OnItemSelected += UnlockableTechnologySelected;
@@ -67,44 +67,44 @@ namespace Content.Client.Research
_futureTechnologies = new ItemList()
{
SelectMode = ItemList.ItemListSelectMode.Button,
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
};
_futureTechnologies.OnItemSelected += FutureTechnologySelected;
var vbox = new VBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
};
var hboxTechnologies = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
SizeFlagsStretchRatio = 2,
SeparationOverride = 10,
};
var hboxSelected = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
SizeFlagsStretchRatio = 1
};
var vboxPoints = new VBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
SizeFlagsStretchRatio = 1,
};
var vboxTechInfo = new VBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
SizeFlagsStretchRatio = 3,
};
@@ -114,8 +114,8 @@ namespace Content.Client.Research
var vboxPointsButtons = new VBoxContainer()
{
Align = BoxContainer.AlignMode.End,
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
};
ServerSelectionButton = new Button() { Text = Loc.GetString("Server list") };
@@ -133,8 +133,8 @@ namespace Content.Client.Research
_technologyIcon = new TextureRect()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
HorizontalExpand = true,
VerticalExpand = true,
SizeFlagsStretchRatio = 1,
Stretch = TextureRect.StretchMode.KeepAspectCentered,
};