diff --git a/Robust.Client/UserInterface/IUserInterfaceManager.cs b/Robust.Client/UserInterface/IUserInterfaceManager.cs index 6d83be28dc8..23bdcd443fd 100644 --- a/Robust.Client/UserInterface/IUserInterfaceManager.cs +++ b/Robust.Client/UserInterface/IUserInterfaceManager.cs @@ -64,7 +64,7 @@ public partial interface IUserInterfaceManager IDebugMonitors DebugMonitors { get; } - void Popup(string contents, string title = "Alert!"); + void Popup(string contents, string title = "Alert!", string clipboardButton = "Copy"); Control? MouseGetControl(ScreenCoordinates coordinates); diff --git a/Robust.Client/UserInterface/UserInterfaceManager.Layout.cs b/Robust.Client/UserInterface/UserInterfaceManager.Layout.cs index 1fb4acb6d55..749a89aa13b 100644 --- a/Robust.Client/UserInterface/UserInterfaceManager.Layout.cs +++ b/Robust.Client/UserInterface/UserInterfaceManager.Layout.cs @@ -53,14 +53,45 @@ private void RunArrange(Control control) } } - public void Popup(string contents, string title = "Alert!") + public void Popup(string contents, string title = "Alert!", string clipboardButton = "Copy") { var popup = new DefaultWindow { - Title = title + Title = title, }; - popup.Contents.AddChild(new Label {Text = contents}); + var label = new Label { Text = contents }; + var copyButton = new Button + { + Text = clipboardButton, + MinSize = new Vector2(100, 30), + }; + + copyButton.OnPressed += _ => + { + _clipboard.SetText(contents); + }; + + var grid = new GridContainer + { + Columns = 1, + VSeparationOverride = 10, + }; + + grid.AddChild(label); + + var buttonContainer = new GridContainer + { + Columns = 2, + HSeparationOverride = 10, + }; + + buttonContainer.AddChild(copyButton); + + grid.AddChild(buttonContainer); + + popup.Contents.AddChild(grid); + popup.OpenCentered(); } diff --git a/Robust.Client/UserInterface/UserInterfaceManager.cs b/Robust.Client/UserInterface/UserInterfaceManager.cs index bb988f0aca2..fd4bc38e640 100644 --- a/Robust.Client/UserInterface/UserInterfaceManager.cs +++ b/Robust.Client/UserInterface/UserInterfaceManager.cs @@ -54,6 +54,7 @@ internal sealed partial class UserInterfaceManager : IUserInterfaceManagerIntern [Dependency] private readonly IEntitySystemManager _systemManager = default!; [Dependency] private readonly ILogManager _logManager = default!; [Dependency] private readonly IRuntimeLog _runtime = default!; + [Dependency] private readonly IClipboardManager _clipboard = null!; private IAudioSource? _clickSource; private IAudioSource? _hoverSource;