1
0
mirror of https://github.com/ppy/osu.git synced 2024-10-01 00:57:25 +08:00
osu-lazer/osu.Game/Overlays/Settings/SettingsSlider.cs

47 lines
1.3 KiB
C#
Raw Normal View History

2018-01-05 19:21:19 +08:00
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2016-12-15 03:59:23 +08:00
using System;
using System.Globalization;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Settings
2016-12-08 04:39:21 +08:00
{
public class SettingsSlider<T> : SettingsSlider<T, OsuSliderBar<T>>
where T : struct, IEquatable<T>
2016-12-08 04:39:21 +08:00
{
2017-04-21 19:59:04 +08:00
}
public class SettingsSlider<T, U> : SettingsItem<T>
where T : struct, IEquatable<T>
where U : OsuSliderBar<T>, new()
2017-04-21 19:59:04 +08:00
{
protected override Drawable CreateControl() => new U
2016-12-08 04:39:21 +08:00
{
Margin = new MarginPadding { Top = 5, Bottom = 5 },
RelativeSizeAxes = Axes.X
};
/// <summary>
/// The format that will be used for the tooltip when the sliderbar is hovered.
/// </summary>
public NumberFormatInfo Format
{
get => ((U)Control).Format;
set => ((U)Control).Format = value;
}
public float KeyboardStep;
[BackgroundDependencyLoader]
private void load()
{
var slider = Control as U;
if (slider != null)
slider.KeyboardStep = KeyboardStep;
}
2016-12-08 04:39:21 +08:00
}
2016-12-09 21:18:58 +08:00
}