mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-16 07:12:27 +02:00
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
29 lines
720 B
C#
29 lines
720 B
C#
using System;
|
|
using Robust.Client.UserInterface;
|
|
using Robust.Client.UserInterface.Controls;
|
|
|
|
namespace Robust.Client.ViewVariables.Editors
|
|
{
|
|
public sealed class VVPropEditorTimeSpan : VVPropEditor
|
|
{
|
|
protected override Control MakeUI(object? value)
|
|
{
|
|
var ts = (TimeSpan) value!;
|
|
var lineEdit = new LineEdit
|
|
{
|
|
Text = ts.ToString(),
|
|
Editable = !ReadOnly,
|
|
MinSize = (240, 0)
|
|
};
|
|
|
|
lineEdit.OnTextEntered += e =>
|
|
{
|
|
if (TimeSpan.TryParse(e.Text, out var span))
|
|
ValueChanged(span);
|
|
};
|
|
|
|
return lineEdit;
|
|
}
|
|
}
|
|
}
|