2024-09-04 19:57:53 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
2024-11-04 17:28:16 +08:00
|
|
|
using osu.Framework.Input;
|
2024-10-04 19:12:25 +08:00
|
|
|
|
2024-09-04 19:57:53 +08:00
|
|
|
namespace osu.Game.Graphics.UserInterfaceV2
|
|
|
|
{
|
|
|
|
public partial class FormNumberBox : FormTextBox
|
|
|
|
{
|
2025-01-20 16:17:01 +08:00
|
|
|
private readonly bool allowDecimals;
|
2024-09-04 19:57:53 +08:00
|
|
|
|
2025-01-20 16:17:01 +08:00
|
|
|
public FormNumberBox(bool allowDecimals = false)
|
|
|
|
{
|
|
|
|
this.allowDecimals = allowDecimals;
|
|
|
|
}
|
|
|
|
|
|
|
|
internal override InnerTextBox CreateTextBox() => new InnerNumberBox(allowDecimals)
|
2024-09-04 19:57:53 +08:00
|
|
|
{
|
2024-10-03 17:11:02 +08:00
|
|
|
SelectAllOnFocus = true,
|
2024-09-04 19:57:53 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
internal partial class InnerNumberBox : InnerTextBox
|
|
|
|
{
|
2025-01-20 16:17:01 +08:00
|
|
|
public InnerNumberBox(bool allowDecimals)
|
2024-11-04 17:28:16 +08:00
|
|
|
{
|
2025-01-20 16:17:01 +08:00
|
|
|
InputProperties = new TextInputProperties(allowDecimals ? TextInputType.Decimal : TextInputType.Number, false);
|
2024-11-04 17:28:16 +08:00
|
|
|
}
|
2024-09-04 19:57:53 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|