1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 11:12:54 +08:00
osu-lazer/osu.Game/Graphics/UserInterfaceV2/FormNumberBox.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
905 B
C#
Raw Normal View History

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.
using osu.Framework.Input;
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
{
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)
{
2025-01-20 16:17:01 +08:00
InputProperties = new TextInputProperties(allowDecimals ? TextInputType.Decimal : TextInputType.Number, false);
}
2024-09-04 19:57:53 +08:00
}
}
}