From 093cf98b931f5afb847dfc6b8132c52f68b4afcd Mon Sep 17 00:00:00 2001 From: Visne <39844191+Visne@users.noreply.github.com> Date: Sun, 19 Sep 2021 19:01:01 +0200 Subject: [PATCH] PaperWindow to XAML UI (#4639) * Rename/add files * PaperWindow to XAML --- Content.Client/Paper/UI/PaperWindow.cs | 39 --------------------- Content.Client/Paper/UI/PaperWindow.xaml | 9 +++++ Content.Client/Paper/UI/PaperWindow.xaml.cs | 31 ++++++++++++++++ 3 files changed, 40 insertions(+), 39 deletions(-) delete mode 100644 Content.Client/Paper/UI/PaperWindow.cs create mode 100644 Content.Client/Paper/UI/PaperWindow.xaml create mode 100644 Content.Client/Paper/UI/PaperWindow.xaml.cs diff --git a/Content.Client/Paper/UI/PaperWindow.cs b/Content.Client/Paper/UI/PaperWindow.cs deleted file mode 100644 index 946aae3354..0000000000 --- a/Content.Client/Paper/UI/PaperWindow.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Content.Shared.Paper; -using Robust.Client.UserInterface.Controls; -using Robust.Client.UserInterface.CustomControls; -using Robust.Shared.Utility; -using static Robust.Client.UserInterface.Controls.BoxContainer; - -namespace Content.Client.Paper.UI -{ - public class PaperWindow : SS14Window - { - private readonly RichTextLabel _label; - public readonly LineEdit Input; - - public PaperWindow() - { - MinSize = SetSize = (300, 300); - var container = new BoxContainer - { - Orientation = LayoutOrientation.Vertical - }; - _label = new RichTextLabel(); - Input = new LineEdit {Visible = false}; - container.AddChild(_label); - container.AddChild(Input); - Contents.AddChild(container); - } - - public void Populate(SharedPaperComponent.PaperBoundUserInterfaceState state) - { - if (state.Mode == SharedPaperComponent.PaperAction.Write) - { - Input.Visible = true; - } - var msg = new FormattedMessage(); - msg.AddMarkupPermissive(state.Text); - _label.SetMessage(msg); - } - } -} diff --git a/Content.Client/Paper/UI/PaperWindow.xaml b/Content.Client/Paper/UI/PaperWindow.xaml new file mode 100644 index 0000000000..dda0c339a8 --- /dev/null +++ b/Content.Client/Paper/UI/PaperWindow.xaml @@ -0,0 +1,9 @@ + + + + + + diff --git a/Content.Client/Paper/UI/PaperWindow.xaml.cs b/Content.Client/Paper/UI/PaperWindow.xaml.cs new file mode 100644 index 0000000000..f80a8518f8 --- /dev/null +++ b/Content.Client/Paper/UI/PaperWindow.xaml.cs @@ -0,0 +1,31 @@ +using Content.Shared.Paper; +using Robust.Client.AutoGenerated; +using Robust.Client.UserInterface.Controls; +using Robust.Client.UserInterface.CustomControls; +using Robust.Client.UserInterface.XAML; +using Robust.Shared.Utility; + +namespace Content.Client.Paper.UI +{ + [GenerateTypedNameReferences] + public partial class PaperWindow : SS14Window + { + public LineEdit Input => InputProtected; + + public PaperWindow() + { + RobustXamlLoader.Load(this); + } + + public void Populate(SharedPaperComponent.PaperBoundUserInterfaceState state) + { + if (state.Mode == SharedPaperComponent.PaperAction.Write) + { + Input.Visible = true; + } + var msg = new FormattedMessage(); + msg.AddMarkupPermissive(state.Text); + Label.SetMessage(msg); + } + } +}