1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-29 23:41:19 +08:00

Implement "form" text box control

This commit is contained in:
Bartłomiej Dach
2024-09-04 13:57:53 +02:00
Unverified
parent ef1add3ebb
commit b7a56c8a45
5 changed files with 391 additions and 1 deletions
@@ -0,0 +1,23 @@
// 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.
namespace osu.Game.Graphics.UserInterfaceV2
{
public partial class FormNumberBox : FormTextBox
{
public bool AllowDecimals { get; init; }
internal override InnerTextBox CreateTextBox() => new InnerNumberBox
{
AllowDecimals = AllowDecimals,
};
internal partial class InnerNumberBox : InnerTextBox
{
public bool AllowDecimals { get; init; }
protected override bool CanAddCharacter(char character)
=> char.IsAsciiDigit(character) || (AllowDecimals && character == '.');
}
}
}