using Robust.Client.AutoGenerated; using Robust.Client.UserInterface; using Robust.Client.UserInterface.XAML; namespace Content.Client.Lathe.UI; [GenerateTypedNameReferences] public sealed partial class QueuedRecipeControl : Control { public Action? OnDeletePressed; public Action? OnMoveUpPressed; public Action? OnMoveDownPressed; private int _index; public QueuedRecipeControl(string displayText, int index, Control displayControl) { RobustXamlLoader.Load(this); SetDisplayText(displayText); SetDisplayControl(displayControl); SetIndex(index); _index = index; MoveUp.OnPressed += (_) => { OnMoveUpPressed?.Invoke(_index); }; MoveDown.OnPressed += (_) => { OnMoveDownPressed?.Invoke(_index); }; Delete.OnPressed += (_) => { OnDeletePressed?.Invoke(_index); }; } public void SetDisplayText(string displayText) { RecipeName.Text = displayText; } public void SetDisplayControl(Control displayControl) { RecipeDisplayContainer.Children.Clear(); RecipeDisplayContainer.AddChild(displayControl); } public void SetIndex(int index) { _index = index; } }