// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; namespace osu.Game.Graphics.UserInterface { /// /// A ternary state menu item which toggles the state of this item false if clicked when true. /// public class TernaryStateToggleMenuItem : TernaryStateMenuItem { /// /// Creates a new . /// /// The text to display. /// The type of action which this performs. /// A delegate to be invoked when this is pressed. public TernaryStateToggleMenuItem(string text, MenuItemType type = MenuItemType.Standard, Action action = null) : base(text, getNextState, type, action) { } private static TernaryState getNextState(TernaryState state) { switch (state) { case TernaryState.False: return TernaryState.True; case TernaryState.Indeterminate: return TernaryState.True; case TernaryState.True: return TernaryState.False; default: throw new ArgumentOutOfRangeException(nameof(state), state, null); } } } }