// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Settings { public class SettingsSlider : SettingsSlider> where T : struct, IEquatable, IComparable, IConvertible { } public class SettingsSlider : SettingsItem where TValue : struct, IEquatable, IComparable, IConvertible where TSlider : OsuSliderBar, new() { protected override Drawable CreateControl() => new TSlider { Margin = new MarginPadding { Top = 5, Bottom = 5 }, RelativeSizeAxes = Axes.X }; /// /// When set, value changes based on user input are only transferred to any bound control's Current on commit. /// This is useful if the UI interaction could be adversely affected by the value changing, such as the position of the on the screen. /// public bool TransferValueOnCommit { get => ((TSlider)Control).TransferValueOnCommit; set => ((TSlider)Control).TransferValueOnCommit = value; } /// /// A custom step value for each key press which actuates a change on this control. /// public float KeyboardStep { get => ((TSlider)Control).KeyboardStep; set => ((TSlider)Control).KeyboardStep = value; } /// /// Whether to format the tooltip as a percentage or the actual value. /// public bool DisplayAsPercentage { get => ((TSlider)Control).DisplayAsPercentage; set => ((TSlider)Control).DisplayAsPercentage = value; } } }