* init * init * PUSH!!! * // * Me when the when the me when the * review --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
57 lines
1.3 KiB
C#
57 lines
1.3 KiB
C#
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<int>? OnDeletePressed;
|
|
public Action<int>? OnMoveUpPressed;
|
|
public Action<int>? 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;
|
|
}
|
|
}
|