2019-01-24 16:43:03 +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.
2018-04-13 17:19:50 +08:00
2024-05-22 16:29:39 +08:00
using System.Numerics ;
2016-11-30 22:08:11 +08:00
using osu.Framework.Graphics ;
2020-01-29 11:55:07 +08:00
using osu.Framework.Graphics.UserInterface ;
2017-02-04 16:50:58 +08:00
using osu.Game.Graphics.UserInterface ;
2018-04-13 17:19:50 +08:00
2017-05-15 09:55:29 +08:00
namespace osu.Game.Overlays.Settings
2016-12-08 04:39:21 +08:00
{
2023-02-03 00:24:45 +08:00
public partial class SettingsSlider < T > : SettingsSlider < T , RoundedSliderBar < T > >
2024-05-22 16:29:39 +08:00
where T : struct , INumber < T > , IMinMaxValue < T >
2016-12-08 04:39:21 +08:00
{
2017-04-21 19:59:04 +08:00
}
2018-04-13 17:19:50 +08:00
2019-12-10 21:04:26 +08:00
public partial class SettingsSlider < TValue , TSlider > : SettingsItem < TValue >
2024-05-22 16:29:39 +08:00
where TValue : struct , INumber < TValue > , IMinMaxValue < TValue >
2023-02-03 00:24:45 +08:00
where TSlider : RoundedSliderBar < TValue > , new ( )
2017-04-21 19:59:04 +08:00
{
2019-12-10 21:04:26 +08:00
protected override Drawable CreateControl ( ) = > new TSlider
2016-12-08 04:39:21 +08:00
{
2017-05-04 22:07:24 +08:00
RelativeSizeAxes = Axes . X
} ;
2018-04-13 17:19:50 +08:00
2020-01-29 11:55:07 +08:00
/// <summary>
/// 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 <see cref="SliderBar{T}"/> on the screen.
/// </summary>
2019-01-08 13:56:42 +08:00
public bool TransferValueOnCommit
{
2019-12-10 21:04:26 +08:00
get = > ( ( TSlider ) Control ) . TransferValueOnCommit ;
set = > ( ( TSlider ) Control ) . TransferValueOnCommit = value ;
2019-01-08 13:56:42 +08:00
}
2018-04-13 17:19:50 +08:00
2020-01-29 11:55:07 +08:00
/// <summary>
/// A custom step value for each key press which actuates a change on this control.
/// </summary>
2019-01-08 13:56:42 +08:00
public float KeyboardStep
2017-10-23 13:36:08 +08:00
{
2019-12-10 21:04:26 +08:00
get = > ( ( TSlider ) Control ) . KeyboardStep ;
set = > ( ( TSlider ) Control ) . KeyboardStep = value ;
2017-10-23 13:36:08 +08:00
}
2020-01-28 12:32:30 +08:00
2020-01-29 11:55:07 +08:00
/// <summary>
/// Whether to format the tooltip as a percentage or the actual value.
/// </summary>
2020-01-28 12:32:30 +08:00
public bool DisplayAsPercentage
{
get = > ( ( TSlider ) Control ) . DisplayAsPercentage ;
set = > ( ( TSlider ) Control ) . DisplayAsPercentage = value ;
}
2016-12-08 04:39:21 +08:00
}
2016-12-09 21:18:58 +08:00
}