// 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.Bindables; namespace osu.Game.Screens.Edit.Components.RadioButtons { public class RadioButton { /// /// Whether this is selected. /// /// public readonly BindableBool Selected; /// /// The item related to this button. /// public object Item; private readonly Action action; public RadioButton(object item, Action action) { Item = item; this.action = action; Selected = new BindableBool(); } public RadioButton(string item) : this(item, null) { Item = item; action = null; } /// /// Selects this . /// public void Select() { if (!Selected.Value) { Selected.Value = true; action?.Invoke(); } } /// /// Deselects this . /// public void Deselect() => Selected.Value = false; } }