1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 07:42:54 +08:00
osu-lazer/osu.Game/Graphics/UserInterface/TernaryStateMenuItem.cs

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

43 lines
1.6 KiB
C#
Raw Normal View History

2019-11-08 11:47:42 +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.
2022-06-17 15:37:17 +08:00
#nullable disable
2019-11-08 11:55:22 +08:00
using System;
2019-11-08 11:47:42 +08:00
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Graphics.UserInterface
{
2019-11-08 12:14:23 +08:00
/// <summary>
/// An <see cref="OsuMenuItem"/> with three possible states.
/// </summary>
public abstract class TernaryStateMenuItem : StatefulMenuItem<TernaryState>
2019-11-08 11:47:42 +08:00
{
2019-11-08 12:14:23 +08:00
/// <summary>
2019-11-12 09:18:25 +08:00
/// Creates a new <see cref="TernaryStateMenuItem"/>.
2019-11-08 12:14:23 +08:00
/// </summary>
/// <param name="text">The text to display.</param>
/// <param name="nextStateFunction">A function to inform what the next state should be when this item is clicked.</param>
2019-11-12 09:18:25 +08:00
/// <param name="type">The type of action which this <see cref="TernaryStateMenuItem"/> performs.</param>
/// <param name="action">A delegate to be invoked when this <see cref="TernaryStateMenuItem"/> is pressed.</param>
protected TernaryStateMenuItem(string text, Func<TernaryState, TernaryState> nextStateFunction, MenuItemType type = MenuItemType.Standard, Action<TernaryState> action = null)
: base(text, nextStateFunction, type, action)
2019-11-08 11:47:42 +08:00
{
}
public override IconUsage? GetIconForState(TernaryState state)
2019-11-08 11:47:42 +08:00
{
switch (state)
{
case TernaryState.Indeterminate:
return FontAwesome.Solid.DotCircle;
2019-11-08 11:47:42 +08:00
case TernaryState.True:
2019-11-08 11:47:42 +08:00
return FontAwesome.Solid.Check;
}
return null;
}
}
}