diff --git a/Terminal.Gui/View/CancelEventArgs.cs b/Terminal.Gui/View/CancelEventArgs.cs index 1d2761cf9..74e23ce2f 100644 --- a/Terminal.Gui/View/CancelEventArgs.cs +++ b/Terminal.Gui/View/CancelEventArgs.cs @@ -33,20 +33,3 @@ public class CancelEventArgs : CancelEventArgs where T : notnull /// The value the property will be set to if the event is not cancelled. public T NewValue { get; set; } } - -/// -/// for events that convey changes to a property of type . -/// -/// The type of the value that was part of the change being canceled. -public class EventArgs : EventArgs where T : notnull -{ - /// Initializes a new instance of the class. - /// The current value of the property. - /// The type of the value. - public EventArgs (ref readonly T currentValue) { CurrentValue = currentValue; } - - /// The current value of the property. - public T CurrentValue { get; } -} - -#pragma warning disable CS1711 diff --git a/Terminal.Gui/Views/CheckBox.cs b/Terminal.Gui/Views/CheckBox.cs index 26cda4f14..b6fef9763 100644 --- a/Terminal.Gui/Views/CheckBox.cs +++ b/Terminal.Gui/Views/CheckBox.cs @@ -25,8 +25,8 @@ public class CheckBox : View CanFocus = true; // Things this view knows how to do - AddCommand (Command.Accept, OnToggled); - AddCommand (Command.HotKey, OnToggled); + AddCommand (Command.Accept, OnToggle); + AddCommand (Command.HotKey, OnToggle); // Default keybindings for this view KeyBindings.Add (Key.Space, Command.Accept); @@ -39,7 +39,7 @@ public class CheckBox : View private void CheckBox_MouseClick (object? sender, MouseEventEventArgs e) { - e.Handled = OnToggled () == true; + e.Handled = OnToggle () == true; } private void Checkbox_TitleChanged (object? sender, EventArgs e) @@ -109,11 +109,11 @@ public class CheckBox : View } } - /// Called when the property changes. Invokes the event. + /// Called when the property changes. Invokes the cancelable event. /// /// - /// If the event was canceled. - public bool? OnToggled () + /// If the event was canceled. + public bool? OnToggle () { bool ? oldValue = Checked; CancelEventArgs e = new (ref _checked, ref oldValue); @@ -141,7 +141,7 @@ public class CheckBox : View e.NewValue = !Checked; } - Toggled?.Invoke (this, e); + Toggle?.Invoke (this, e); if (e.Cancel) { return e.Cancel; @@ -158,13 +158,13 @@ public class CheckBox : View return true; } - /// Toggled event, raised when the is toggled. + /// Toggle event, raised when the is toggled. /// /// /// This event can be cancelled. If cancelled, the will not change its state. /// /// - public event EventHandler>? Toggled; + public event EventHandler>? Toggle; /// protected override void UpdateTextFormatterText () diff --git a/UICatalog/Scenarios/AdornmentsEditor.cs b/UICatalog/Scenarios/AdornmentsEditor.cs index a1e40542b..1dab998e8 100644 --- a/UICatalog/Scenarios/AdornmentsEditor.cs +++ b/UICatalog/Scenarios/AdornmentsEditor.cs @@ -92,7 +92,7 @@ public class AdornmentsEditor : View _diagPaddingCheckBox = new () { Text = "_Diagnostic Padding" }; _diagPaddingCheckBox.Checked = Diagnostics.FastHasFlags (ViewDiagnosticFlags.Padding); - _diagPaddingCheckBox.Toggled += (s, e) => + _diagPaddingCheckBox.Toggle += (s, e) => { if (e.NewValue == true) { @@ -110,7 +110,7 @@ public class AdornmentsEditor : View _diagRulerCheckBox = new () { Text = "_Diagnostic Ruler" }; _diagRulerCheckBox.Checked = Diagnostics.FastHasFlags (ViewDiagnosticFlags.Ruler); - _diagRulerCheckBox.Toggled += (s, e) => + _diagRulerCheckBox.Toggle += (s, e) => { if (e.NewValue == true) { diff --git a/UICatalog/Scenarios/BorderEditor.cs b/UICatalog/Scenarios/BorderEditor.cs index 671924f94..c987210c8 100644 --- a/UICatalog/Scenarios/BorderEditor.cs +++ b/UICatalog/Scenarios/BorderEditor.cs @@ -58,7 +58,7 @@ public class BorderEditor : AdornmentEditor }; - _ckbTitle.Toggled += OnCkbTitleOnToggled; + _ckbTitle.Toggle += OnCkbTitleOnToggle; Add (_ckbTitle); return; @@ -81,6 +81,6 @@ public class BorderEditor : AdornmentEditor LayoutSubviews (); } - void OnCkbTitleOnToggled (object sender, CancelEventArgs args) { ((Border)AdornmentToEdit).ShowTitle = args.NewValue!.Value; } + void OnCkbTitleOnToggle (object sender, CancelEventArgs args) { ((Border)AdornmentToEdit).ShowTitle = args.NewValue!.Value; } } } \ No newline at end of file diff --git a/UICatalog/Scenarios/Buttons.cs b/UICatalog/Scenarios/Buttons.cs index e0be70cd2..a65b9bbaf 100644 --- a/UICatalog/Scenarios/Buttons.cs +++ b/UICatalog/Scenarios/Buttons.cs @@ -387,7 +387,7 @@ public class Buttons : Scenario Title = "Enabled", Checked = true }; - enableCB.Toggled += (s, e) => { repeatButton.Enabled = !repeatButton.Enabled; }; + enableCB.Toggle += (s, e) => { repeatButton.Enabled = !repeatButton.Enabled; }; main.Add (label, repeatButton, enableCB); main.Ready += (s, e) => radioGroup.Refresh (); diff --git a/UICatalog/Scenarios/ContentScrolling.cs b/UICatalog/Scenarios/ContentScrolling.cs index c3f711cca..e962f8f95 100644 --- a/UICatalog/Scenarios/ContentScrolling.cs +++ b/UICatalog/Scenarios/ContentScrolling.cs @@ -136,9 +136,9 @@ public class ContentScrolling : Scenario CanFocus = false }; cbAllowNegativeX.Checked = view.ViewportSettings.HasFlag (ViewportSettings.AllowNegativeX); - cbAllowNegativeX.Toggled += AllowNegativeX_Toggled; + cbAllowNegativeX.Toggle += AllowNegativeX_Toggle; - void AllowNegativeX_Toggled (object sender, CancelEventArgs e) + void AllowNegativeX_Toggle (object sender, CancelEventArgs e) { if (e.NewValue == true) { @@ -160,9 +160,9 @@ public class ContentScrolling : Scenario CanFocus = false }; cbAllowNegativeY.Checked = view.ViewportSettings.HasFlag (ViewportSettings.AllowNegativeY); - cbAllowNegativeY.Toggled += AllowNegativeY_Toggled; + cbAllowNegativeY.Toggle += AllowNegativeY_Toggle; - void AllowNegativeY_Toggled (object sender, CancelEventArgs e) + void AllowNegativeY_Toggle (object sender, CancelEventArgs e) { if (e.NewValue == true) { @@ -183,9 +183,9 @@ public class ContentScrolling : Scenario CanFocus = false }; cbAllowXGreaterThanContentWidth.Checked = view.ViewportSettings.HasFlag (ViewportSettings.AllowXGreaterThanContentWidth); - cbAllowXGreaterThanContentWidth.Toggled += AllowXGreaterThanContentWidth_Toggled; + cbAllowXGreaterThanContentWidth.Toggle += AllowXGreaterThanContentWidth_Toggle; - void AllowXGreaterThanContentWidth_Toggled (object sender, CancelEventArgs e) + void AllowXGreaterThanContentWidth_Toggle (object sender, CancelEventArgs e) { if (e.NewValue == true) { @@ -207,9 +207,9 @@ public class ContentScrolling : Scenario CanFocus = false }; cbAllowYGreaterThanContentHeight.Checked = view.ViewportSettings.HasFlag (ViewportSettings.AllowYGreaterThanContentHeight); - cbAllowYGreaterThanContentHeight.Toggled += AllowYGreaterThanContentHeight_Toggled; + cbAllowYGreaterThanContentHeight.Toggle += AllowYGreaterThanContentHeight_Toggle; - void AllowYGreaterThanContentHeight_Toggled (object sender, CancelEventArgs e) + void AllowYGreaterThanContentHeight_Toggle (object sender, CancelEventArgs e) { if (e.NewValue == true) { @@ -285,9 +285,9 @@ public class ContentScrolling : Scenario CanFocus = false }; cbClearOnlyVisible.Checked = view.ViewportSettings.HasFlag (ViewportSettings.ClearContentOnly); - cbClearOnlyVisible.Toggled += ClearVisibleContentOnly_Toggled; + cbClearOnlyVisible.Toggle += ClearVisibleContentOnly_Toggle; - void ClearVisibleContentOnly_Toggled (object sender, CancelEventArgs e) + void ClearVisibleContentOnly_Toggle (object sender, CancelEventArgs e) { if (e.NewValue == true) { @@ -307,9 +307,9 @@ public class ContentScrolling : Scenario CanFocus = false }; cbDoNotClipContent.Checked = view.ViewportSettings.HasFlag (ViewportSettings.ClipContentOnly); - cbDoNotClipContent.Toggled += ClipVisibleContentOnly_Toggled; + cbDoNotClipContent.Toggle += ClipVisibleContentOnly_Toggle; - void ClipVisibleContentOnly_Toggled (object sender, CancelEventArgs e) + void ClipVisibleContentOnly_Toggle (object sender, CancelEventArgs e) { if (e.NewValue == true) { diff --git a/UICatalog/Scenarios/DynamicMenuBar.cs b/UICatalog/Scenarios/DynamicMenuBar.cs index beb8b902d..8a7efb72d 100644 --- a/UICatalog/Scenarios/DynamicMenuBar.cs +++ b/UICatalog/Scenarios/DynamicMenuBar.cs @@ -249,7 +249,7 @@ public class DynamicMenuBar : Scenario _btnShortcut.Accept += (s, e) => { TextShortcut.Text = ""; }; Add (_btnShortcut); - CkbIsTopLevel.Toggled += (s, e) => + CkbIsTopLevel.Toggle += (s, e) => { if ((_menuItem != null && _menuItem.Parent != null && (bool)CkbIsTopLevel.Checked) || (_menuItem == null && _hasParent && (bool)CkbIsTopLevel.Checked)) @@ -290,7 +290,7 @@ public class DynamicMenuBar : Scenario } }; - CkbSubMenu.Toggled += (s, e) => + CkbSubMenu.Toggle += (s, e) => { if ((bool)CkbSubMenu.Checked) { @@ -320,7 +320,7 @@ public class DynamicMenuBar : Scenario } }; - CkbNullCheck.Toggled += (s, e) => + CkbNullCheck.Toggle += (s, e) => { if (_menuItem != null) { diff --git a/UICatalog/Scenarios/Editor.cs b/UICatalog/Scenarios/Editor.cs index 73b14ffd0..c74e23bbd 100644 --- a/UICatalog/Scenarios/Editor.cs +++ b/UICatalog/Scenarios/Editor.cs @@ -897,14 +897,14 @@ public class Editor : Scenario { X = 0, Y = Pos.Top (txtToFind) + 2, Checked = _matchCase, Text = "Match c_ase" }; - ckbMatchCase.Toggled += (s, e) => _matchCase = (bool)ckbMatchCase.Checked; + ckbMatchCase.Toggle += (s, e) => _matchCase = (bool)ckbMatchCase.Checked; d.Add (ckbMatchCase); var ckbMatchWholeWord = new CheckBox { X = 0, Y = Pos.Top (ckbMatchCase) + 1, Checked = _matchWholeWord, Text = "Match _whole word" }; - ckbMatchWholeWord.Toggled += (s, e) => _matchWholeWord = (bool)ckbMatchWholeWord.Checked; + ckbMatchWholeWord.Toggle += (s, e) => _matchWholeWord = (bool)ckbMatchWholeWord.Checked; d.Add (ckbMatchWholeWord); return d; } @@ -1155,14 +1155,14 @@ public class Editor : Scenario { X = 0, Y = Pos.Top (txtToFind) + 2, Checked = _matchCase, Text = "Match c_ase" }; - ckbMatchCase.Toggled += (s, e) => _matchCase = (bool)ckbMatchCase.Checked; + ckbMatchCase.Toggle += (s, e) => _matchCase = (bool)ckbMatchCase.Checked; d.Add (ckbMatchCase); var ckbMatchWholeWord = new CheckBox { X = 0, Y = Pos.Top (ckbMatchCase) + 1, Checked = _matchWholeWord, Text = "Match _whole word" }; - ckbMatchWholeWord.Toggled += (s, e) => _matchWholeWord = (bool)ckbMatchWholeWord.Checked; + ckbMatchWholeWord.Toggle += (s, e) => _matchWholeWord = (bool)ckbMatchWholeWord.Checked; d.Add (ckbMatchWholeWord); return d; diff --git a/UICatalog/Scenarios/Images.cs b/UICatalog/Scenarios/Images.cs index 038d92255..070fb3f56 100644 --- a/UICatalog/Scenarios/Images.cs +++ b/UICatalog/Scenarios/Images.cs @@ -42,7 +42,7 @@ public class Images : Scenario Enabled = canTrueColor, Text = "Use true color" }; - cbUseTrueColor.Toggled += (_, evt) => Application.Force16Colors = !evt.NewValue ?? false; + cbUseTrueColor.Toggle += (_, evt) => Application.Force16Colors = !evt.NewValue ?? false; Win.Add (cbUseTrueColor); var btnOpenImage = new Button { X = Pos.Right (cbUseTrueColor) + 2, Y = 0, Text = "Open Image" }; diff --git a/UICatalog/Scenarios/ListViewWithSelection.cs b/UICatalog/Scenarios/ListViewWithSelection.cs index edef954ce..b187fee42 100644 --- a/UICatalog/Scenarios/ListViewWithSelection.cs +++ b/UICatalog/Scenarios/ListViewWithSelection.cs @@ -34,14 +34,14 @@ public class ListViewWithSelection : Scenario _customRenderCB = new CheckBox { X = 0, Y = 0, Text = "Use custom rendering" }; _appWindow.Add (_customRenderCB); - _customRenderCB.Toggled += _customRenderCB_Toggled; + _customRenderCB.Toggle += _customRenderCB_Toggle; _allowMarkingCB = new CheckBox { X = Pos.Right (_customRenderCB) + 1, Y = 0, Text = "Allow Marking", AllowNullChecked = false }; _appWindow.Add (_allowMarkingCB); - _allowMarkingCB.Toggled += AllowMarkingCB_Toggled; + _allowMarkingCB.Toggle += AllowMarkingCB_Toggle; _allowMultipleCB = new CheckBox { @@ -51,7 +51,7 @@ public class ListViewWithSelection : Scenario Text = "Allow Multi-Select" }; _appWindow.Add (_allowMultipleCB); - _allowMultipleCB.Toggled += AllowMultipleCB_Toggled; + _allowMultipleCB.Toggle += AllowMultipleCB_Toggle; _listView = new ListView { @@ -110,7 +110,7 @@ public class ListViewWithSelection : Scenario { X = Pos.AnchorEnd (k.Length + 3), Y = 0, Text = k, Checked = scrollBar.AutoHideScrollBars }; - keepCheckBox.Toggled += (s, e) => scrollBar.KeepContentAlwaysInViewport = (bool)keepCheckBox.Checked; + keepCheckBox.Toggle += (s, e) => scrollBar.KeepContentAlwaysInViewport = (bool)keepCheckBox.Checked; _appWindow.Add (keepCheckBox); Application.Run (_appWindow); @@ -118,7 +118,7 @@ public class ListViewWithSelection : Scenario Application.Shutdown (); } - private void _customRenderCB_Toggled (object sender, CancelEventArgs stateEventArgs) + private void _customRenderCB_Toggle (object sender, CancelEventArgs stateEventArgs) { if (stateEventArgs.CurrentValue == true) { @@ -132,14 +132,14 @@ public class ListViewWithSelection : Scenario _appWindow.SetNeedsDisplay (); } - private void AllowMarkingCB_Toggled (object sender, [NotNull] CancelEventArgs stateEventArgs) + private void AllowMarkingCB_Toggle (object sender, [NotNull] CancelEventArgs stateEventArgs) { _listView.AllowsMarking = (bool)!stateEventArgs.CurrentValue; _allowMultipleCB.Visible = _listView.AllowsMarking; _appWindow.SetNeedsDisplay (); } - private void AllowMultipleCB_Toggled (object sender, [NotNull] CancelEventArgs stateEventArgs) + private void AllowMultipleCB_Toggle (object sender, [NotNull] CancelEventArgs stateEventArgs) { _listView.AllowsMultipleSelection = (bool)!stateEventArgs.CurrentValue; _appWindow.SetNeedsDisplay (); diff --git a/UICatalog/Scenarios/Mouse.cs b/UICatalog/Scenarios/Mouse.cs index 84c256247..85d48a75d 100644 --- a/UICatalog/Scenarios/Mouse.cs +++ b/UICatalog/Scenarios/Mouse.cs @@ -67,7 +67,7 @@ public class Mouse : Scenario Y = Pos.Bottom (ml), Title = "_Want Continuous Button Pressed" }; - cbWantContinuousPresses.Toggled += (s, e) => { win.WantContinuousButtonPressed = !win.WantContinuousButtonPressed; }; + cbWantContinuousPresses.Toggle += (s, e) => { win.WantContinuousButtonPressed = !win.WantContinuousButtonPressed; }; win.Add (cbWantContinuousPresses); @@ -79,7 +79,7 @@ public class Mouse : Scenario }; cbHighlightOnPress.Checked = win.HighlightStyle == (HighlightStyle.Pressed | HighlightStyle.PressedOutside); - cbHighlightOnPress.Toggled += (s, e) => + cbHighlightOnPress.Toggle += (s, e) => { if (e.NewValue == true) { diff --git a/UICatalog/Scenarios/PosAlignDemo.cs b/UICatalog/Scenarios/PosAlignDemo.cs index cd731b663..9927c3a06 100644 --- a/UICatalog/Scenarios/PosAlignDemo.cs +++ b/UICatalog/Scenarios/PosAlignDemo.cs @@ -98,7 +98,7 @@ public sealed class PosAlignDemo : Scenario endToStartCheckBox.Y = Pos.Align (_vertAligner.Alignment); } - endToStartCheckBox.Toggled += (s, e) => + endToStartCheckBox.Toggle += (s, e) => { if (dimension == Dimension.Width) { @@ -138,7 +138,7 @@ public sealed class PosAlignDemo : Scenario ignoreFirstOrLast.Y = Pos.Align (_vertAligner.Alignment); } - ignoreFirstOrLast.Toggled += (s, e) => + ignoreFirstOrLast.Toggle += (s, e) => { if (dimension == Dimension.Width) { @@ -178,7 +178,7 @@ public sealed class PosAlignDemo : Scenario addSpacesBetweenItems.Y = Pos.Align (_vertAligner.Alignment); } - addSpacesBetweenItems.Toggled += (s, e) => + addSpacesBetweenItems.Toggle += (s, e) => { if (dimension == Dimension.Width) { @@ -217,7 +217,7 @@ public sealed class PosAlignDemo : Scenario margin.Y = Pos.Align (_vertAligner.Alignment); } - margin.Toggled += (s, e) => + margin.Toggle += (s, e) => { if (dimension == Dimension.Width) { diff --git a/UICatalog/Scenarios/ProgressBarStyles.cs b/UICatalog/Scenarios/ProgressBarStyles.cs index db31ec3a5..cb3508d8b 100644 --- a/UICatalog/Scenarios/ProgressBarStyles.cs +++ b/UICatalog/Scenarios/ProgressBarStyles.cs @@ -286,7 +286,7 @@ public class ProgressBarStyles : Scenario marqueesContinuousPB.ProgressBarFormat = (ProgressBarFormat)e.SelectedItem; }; - ckbBidirectional.Toggled += (s, e) => + ckbBidirectional.Toggle += (s, e) => { ckbBidirectional.Checked = marqueesBlocksPB.BidirectionalMarquee = marqueesContinuousPB.BidirectionalMarquee = (bool)!e.CurrentValue; diff --git a/UICatalog/Scenarios/Scrolling.cs b/UICatalog/Scenarios/Scrolling.cs index 581b2693e..5a598af68 100644 --- a/UICatalog/Scenarios/Scrolling.cs +++ b/UICatalog/Scenarios/Scrolling.cs @@ -174,7 +174,7 @@ public class Scrolling : Scenario X = Pos.Left (scrollView), Y = Pos.Bottom (ahCheckBox), Text = k, Checked = scrollView.AutoHideScrollBars }; - hCheckBox.Toggled += (s, e) => + hCheckBox.Toggle += (s, e) => { if (ahCheckBox.Checked == false) { @@ -187,7 +187,7 @@ public class Scrolling : Scenario } }; - vCheckBox.Toggled += (s, e) => + vCheckBox.Toggle += (s, e) => { if (ahCheckBox.Checked == false) { @@ -200,7 +200,7 @@ public class Scrolling : Scenario } }; - ahCheckBox.Toggled += (s, e) => + ahCheckBox.Toggle += (s, e) => { scrollView.AutoHideScrollBars = (bool)ahCheckBox.Checked; hCheckBox.Checked = true; @@ -208,7 +208,7 @@ public class Scrolling : Scenario }; app.Add (ahCheckBox); - keepCheckBox.Toggled += (s, e) => scrollView.KeepContentAlwaysInViewport = (bool)keepCheckBox.Checked; + keepCheckBox.Toggle += (s, e) => scrollView.KeepContentAlwaysInViewport = (bool)keepCheckBox.Checked; app.Add (keepCheckBox); var count = 0; diff --git a/UICatalog/Scenarios/Shortcuts.cs b/UICatalog/Scenarios/Shortcuts.cs index ce8a6e30b..3d660ad66 100644 --- a/UICatalog/Scenarios/Shortcuts.cs +++ b/UICatalog/Scenarios/Shortcuts.cs @@ -107,11 +107,11 @@ public class Shortcuts : Scenario KeyBindingScope = KeyBindingScope.HotKey, }; - ((CheckBox)vShortcut3.CommandView).Toggled += (s, e) => + ((CheckBox)vShortcut3.CommandView).Toggle += (s, e) => { if (vShortcut3.CommandView is CheckBox cb) { - eventSource.Add ($"Toggled: {cb.Text}"); + eventSource.Add ($"Toggle: {cb.Text}"); eventLog.MoveDown (); var max = 0; @@ -166,11 +166,11 @@ public class Shortcuts : Scenario CommandView = new CheckBox { Text = "_CanFocus" }, }; - ((CheckBox)vShortcut5.CommandView).Toggled += (s, e) => + ((CheckBox)vShortcut5.CommandView).Toggle += (s, e) => { if (vShortcut5.CommandView is CheckBox cb) { - eventSource.Add ($"Toggled: {cb.Text}"); + eventSource.Add ($"Toggle: {cb.Text}"); eventLog.MoveDown (); foreach (Shortcut peer in Application.Top.Subviews.Where (v => v is Shortcut)!) @@ -372,7 +372,7 @@ public class Shortcuts : Scenario } } - //((CheckBox)vShortcut5.CommandView).OnToggled (); + //((CheckBox)vShortcut5.CommandView).OnToggle (); } private void Button_Clicked (object sender, HandledEventArgs e) diff --git a/UICatalog/Scenarios/Sliders.cs b/UICatalog/Scenarios/Sliders.cs index 1b0d21031..7a23967f6 100644 --- a/UICatalog/Scenarios/Sliders.cs +++ b/UICatalog/Scenarios/Sliders.cs @@ -236,7 +236,7 @@ public class Sliders : Scenario Y = Pos.Bottom (optionsSlider) }; - dimAutoUsesMin.Toggled += (sender, e) => + dimAutoUsesMin.Toggle += (sender, e) => { foreach (Slider s in app.Subviews.OfType ()) { diff --git a/UICatalog/Scenarios/SpinnerStyles.cs b/UICatalog/Scenarios/SpinnerStyles.cs index 9a2867a99..63eba3d94 100644 --- a/UICatalog/Scenarios/SpinnerStyles.cs +++ b/UICatalog/Scenarios/SpinnerStyles.cs @@ -164,9 +164,9 @@ public class SpinnerViewStyles : Scenario } }; - ckbReverse.Toggled += (s, e) => { spinner.SpinReverse = (bool)!e.CurrentValue; }; + ckbReverse.Toggle += (s, e) => { spinner.SpinReverse = (bool)!e.CurrentValue; }; - ckbBounce.Toggled += (s, e) => { spinner.SpinBounce = (bool)!e.CurrentValue; }; + ckbBounce.Toggle += (s, e) => { spinner.SpinBounce = (bool)!e.CurrentValue; }; app.Unloaded += App_Unloaded; diff --git a/UICatalog/Scenarios/Text.cs b/UICatalog/Scenarios/Text.cs index 6bef53457..fbe39f55d 100644 --- a/UICatalog/Scenarios/Text.cs +++ b/UICatalog/Scenarios/Text.cs @@ -116,7 +116,7 @@ public class Text : Scenario Checked = textView.WordWrap, Text = "_Word Wrap" }; - chxWordWrap.Toggled += (s, e) => textView.WordWrap = (bool)e.NewValue; + chxWordWrap.Toggle += (s, e) => textView.WordWrap = (bool)e.NewValue; Win.Add (chxWordWrap); // TextView captures Tabs (so users can enter /t into text) by default; @@ -130,7 +130,7 @@ public class Text : Scenario Text = "_Capture Tabs" }; - chxMultiline.Toggled += (s, e) => + chxMultiline.Toggle += (s, e) => { textView.Multiline = (bool)e.NewValue; @@ -148,7 +148,7 @@ public class Text : Scenario Key keyTab = textView.KeyBindings.GetKeyFromCommands (Command.Tab); Key keyBackTab = textView.KeyBindings.GetKeyFromCommands (Command.BackTab); - chxCaptureTabs.Toggled += (s, e) => + chxCaptureTabs.Toggle += (s, e) => { if (e.NewValue == true) { diff --git a/UICatalog/Scenarios/TextAlignmentAndDirection.cs b/UICatalog/Scenarios/TextAlignmentAndDirection.cs index 80723a081..c885d0603 100644 --- a/UICatalog/Scenarios/TextAlignmentAndDirection.cs +++ b/UICatalog/Scenarios/TextAlignmentAndDirection.cs @@ -484,7 +484,7 @@ public class TextAlignmentAndDirection : Scenario Enabled = false }; - justifyCheckbox.Toggled += (s, e) => ToggleJustify (e.CurrentValue is { } && (bool)e.CurrentValue); + justifyCheckbox.Toggle += (s, e) => ToggleJustify (e.CurrentValue is { } && (bool)e.CurrentValue); justifyOptions.SelectedItemChanged += (s, e) => { ToggleJustify (false, true); }; @@ -502,7 +502,7 @@ public class TextAlignmentAndDirection : Scenario }; wrapCheckbox.Checked = wrapCheckbox.TextFormatter.WordWrap; - wrapCheckbox.Toggled += (s, e) => + wrapCheckbox.Toggle += (s, e) => { if (e.CurrentValue == true) { @@ -534,7 +534,7 @@ public class TextAlignmentAndDirection : Scenario }; autoSizeCheckbox.Checked = autoSizeCheckbox.TextFormatter.AutoSize; - autoSizeCheckbox.Toggled += (s, e) => + autoSizeCheckbox.Toggle += (s, e) => { if (e.CurrentValue == true) { diff --git a/UICatalog/Scenarios/TextFormatterDemo.cs b/UICatalog/Scenarios/TextFormatterDemo.cs index ef2ce917c..ea9be18d8 100644 --- a/UICatalog/Scenarios/TextFormatterDemo.cs +++ b/UICatalog/Scenarios/TextFormatterDemo.cs @@ -133,7 +133,7 @@ public class TextFormatterDemo : Scenario label = multipleLines [i]; } - unicodeCheckBox.Toggled += (s, e) => + unicodeCheckBox.Toggle += (s, e) => { for (int i = 0; i < alignments.Count; i++) { diff --git a/UICatalog/Scenarios/TileViewNesting.cs b/UICatalog/Scenarios/TileViewNesting.cs index 6d2834088..a2719f835 100644 --- a/UICatalog/Scenarios/TileViewNesting.cs +++ b/UICatalog/Scenarios/TileViewNesting.cs @@ -31,16 +31,16 @@ public class TileViewNesting : Scenario _textField.TextChanged += (s, e) => SetupTileView (); _cbHorizontal = new() { X = Pos.Right (_textField) + 1, Text = "Horizontal" }; - _cbHorizontal.Toggled += (s, e) => SetupTileView (); + _cbHorizontal.Toggle += (s, e) => SetupTileView (); _cbBorder = new() { X = Pos.Right (_cbHorizontal) + 1, Text = "Border" }; - _cbBorder.Toggled += (s, e) => SetupTileView (); + _cbBorder.Toggle += (s, e) => SetupTileView (); _cbTitles = new() { X = Pos.Right (_cbBorder) + 1, Text = "Titles" }; - _cbTitles.Toggled += (s, e) => SetupTileView (); + _cbTitles.Toggle += (s, e) => SetupTileView (); _cbUseLabels = new() { X = Pos.Right (_cbTitles) + 1, Text = "Use Labels" }; - _cbUseLabels.Toggled += (s, e) => SetupTileView (); + _cbUseLabels.Toggle += (s, e) => SetupTileView (); _workArea = new() { X = 0, Y = 1, Width = Dim.Fill (), Height = Dim.Fill () }; diff --git a/UICatalog/Scenarios/TrueColors.cs b/UICatalog/Scenarios/TrueColors.cs index 992ace392..82798e038 100644 --- a/UICatalog/Scenarios/TrueColors.cs +++ b/UICatalog/Scenarios/TrueColors.cs @@ -46,7 +46,7 @@ public class TrueColors : Scenario Enabled = canTrueColor, Text = "Force 16 colors" }; - cbUseTrueColor.Toggled += (_, evt) => { Application.Force16Colors = evt.NewValue ?? false; }; + cbUseTrueColor.Toggle += (_, evt) => { Application.Force16Colors = evt.NewValue ?? false; }; app.Add (cbUseTrueColor); y += 2; diff --git a/UICatalog/Scenarios/Wizards.cs b/UICatalog/Scenarios/Wizards.cs index 95713018d..a57ee963c 100644 --- a/UICatalog/Scenarios/Wizards.cs +++ b/UICatalog/Scenarios/Wizards.cs @@ -243,7 +243,7 @@ public class Wizards : Scenario }; thirdStep.Add (progLbl, progressBar); thirdStep.Enabled = (bool)thirdStepEnabledCeckBox.Checked; - thirdStepEnabledCeckBox.Toggled += (s, e) => { thirdStep.Enabled = (bool)thirdStepEnabledCeckBox.Checked; }; + thirdStepEnabledCeckBox.Toggle += (s, e) => { thirdStep.Enabled = (bool)thirdStepEnabledCeckBox.Checked; }; // Add 4th step var fourthStep = new WizardStep { Title = "Step Four" }; @@ -331,7 +331,7 @@ public class Wizards : Scenario "This step only shows if it was enabled on the other last step."; finalFinalStep.Enabled = (bool)thirdStepEnabledCeckBox.Checked; - finalFinalStepEnabledCeckBox.Toggled += (s, e) => + finalFinalStepEnabledCeckBox.Toggle += (s, e) => { finalFinalStep.Enabled = (bool)finalFinalStepEnabledCeckBox.Checked; }; diff --git a/UnitTests/Views/CheckBoxTests.cs b/UnitTests/Views/CheckBoxTests.cs index d87b30972..4b24768ab 100644 --- a/UnitTests/Views/CheckBoxTests.cs +++ b/UnitTests/Views/CheckBoxTests.cs @@ -174,7 +174,7 @@ public class CheckBoxTests (ITestOutputHelper output) { var toggled = false; var ckb = new CheckBox (); - ckb.Toggled += (s, e) => toggled = true; + ckb.Toggle += (s, e) => toggled = true; Assert.False (ckb.Checked); Assert.False (toggled); @@ -481,18 +481,18 @@ public class CheckBoxTests (ITestOutputHelper output) var ckb = new CheckBox { AllowNullChecked = true }; var checkedInvoked = false; - ckb.Toggled += CheckBoxToggled; + ckb.Toggle += CheckBoxToggle; ckb.Checked = initialState; Assert.Equal (initialState, ckb.Checked); - bool? ret = ckb.OnToggled (); + bool? ret = ckb.OnToggle (); Assert.True (ret); Assert.True (checkedInvoked); Assert.Equal (initialState, ckb.Checked); return; - void CheckBoxToggled (object sender, CancelEventArgs e) + void CheckBoxToggle (object sender, CancelEventArgs e) { checkedInvoked = true; e.Cancel = true;