using System; namespace MonoGame.Extended.NuclexGui.Controls.Desktop { /// Control displaying an option the user can toggle on and off public class GuiOptionControl : GuiPressableControl { /// Whether the option is currently selected public bool Selected; /// Text that will be shown on the button public string Text; /// Determines where text or image will be shown relative to control public GuiPressableDescriptionPosition DescriptionPosition; /// Will be triggered when the choice is changed public event EventHandler Changed; /// Called when the button is pressed protected override void OnPressed() { Selected = !Selected; OnChanged(); } /// Triggers the changed event protected virtual void OnChanged() { if (Changed != null) Changed(this, EventArgs.Empty); } } }