From e3a43310567f1a8ef2d033706b9a350a67237389 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 8 Dec 2025 23:17:06 +0000 Subject: [PATCH] Rename Command.Select to Command.Activate and Selecting to Activating Co-authored-by: tig <585482+tig@users.noreply.github.com> --- .../Scenarios/CharacterMap/CharacterMap.cs | 2 +- Examples/UICatalog/Scenarios/ContextMenus.cs | 6 ++-- .../Scenarios/EditorsAndHelpers/EventLog.cs | 2 +- .../Scenarios/ListViewWithSelection.cs | 2 +- Examples/UICatalog/Scenarios/Shortcuts.cs | 10 +++--- Examples/UICatalog/Scenarios/TableEditor.cs | 2 +- .../UICatalog/Scenarios/TreeViewFileSystem.cs | 2 +- .../UICatalog/Scenarios/ViewExperiments.cs | 2 +- Examples/UICatalog/UICatalogRunnable.cs | 4 +-- Terminal.Gui/Input/Command.cs | 7 ++-- Terminal.Gui/ViewBase/View.Command.cs | 36 +++++++++---------- Terminal.Gui/ViewBase/View.Keyboard.cs | 2 +- Terminal.Gui/ViewBase/View.Mouse.cs | 12 +++---- Terminal.Gui/Views/Button.cs | 2 +- Terminal.Gui/Views/CharMap/CharMap.cs | 6 ++-- Terminal.Gui/Views/CheckBox.cs | 6 ++-- Terminal.Gui/Views/Color/ColorPicker.16.cs | 10 +++--- Terminal.Gui/Views/FileDialogs/FileDialog.cs | 4 +-- Terminal.Gui/Views/HexView.cs | 8 ++--- Terminal.Gui/Views/Label.cs | 4 +-- Terminal.Gui/Views/ListView.cs | 16 ++++----- Terminal.Gui/Views/NumericUpDown.cs | 4 +-- Terminal.Gui/Views/ScrollBar/ScrollBar.cs | 6 ++-- Terminal.Gui/Views/ScrollBar/ScrollSlider.cs | 2 +- Terminal.Gui/Views/Selectors/FlagSelector.cs | 6 ++-- .../Views/Selectors/OptionSelector.cs | 14 ++++---- Terminal.Gui/Views/Selectors/SelectorBase.cs | 6 ++-- Terminal.Gui/Views/Shortcut.cs | 18 +++++----- Terminal.Gui/Views/Slider/Slider.cs | 4 +-- Terminal.Gui/Views/TabView/TabRow.cs | 4 +-- Terminal.Gui/Views/TabView/TabView.cs | 16 ++++----- .../TableView/CheckBoxTableSourceWrapper.cs | 4 +-- .../Views/TableView/TableSelection.cs | 2 +- Terminal.Gui/Views/TableView/TableView.cs | 8 ++--- .../Views/TableView/TreeTableSource.cs | 4 +-- Terminal.Gui/Views/TreeView/TreeView.cs | 4 +-- Tests/UnitTests/View/Mouse/MouseTests.cs | 2 +- Tests/UnitTests/Views/ButtonTests.cs | 4 +-- Tests/UnitTests/Views/CheckBoxTests.cs | 4 +-- Tests/UnitTests/Views/ShortcutTests.cs | 10 +++--- Tests/UnitTests/Views/TableViewTests.cs | 8 ++--- .../ViewBase/Keyboard/KeyBindingsTests.cs | 2 +- .../ViewBase/Mouse/MouseEventRoutingTests.cs | 6 ++-- .../ViewBase/Mouse/MouseTests.cs | 2 +- .../ViewBase/ViewCommandTests.cs | 24 ++++++------- .../Views/AllViewsTests.cs | 6 ++-- .../Views/CheckBoxTests.cs | 6 ++-- .../Views/ShortcutTests.cs | 2 +- .../Views/TextFieldTests.cs | 4 +-- 49 files changed, 164 insertions(+), 163 deletions(-) diff --git a/Examples/UICatalog/Scenarios/CharacterMap/CharacterMap.cs b/Examples/UICatalog/Scenarios/CharacterMap/CharacterMap.cs index daddc307e..1c57c4bec 100644 --- a/Examples/UICatalog/Scenarios/CharacterMap/CharacterMap.cs +++ b/Examples/UICatalog/Scenarios/CharacterMap/CharacterMap.cs @@ -134,7 +134,7 @@ public class CharacterMap : Scenario _categoryList.Table = CreateCategoryTable (0, isDescending); // if user clicks the mouse in TableView - _categoryList.Selecting += (_, e) => + _categoryList.Activating += (_, e) => { // Only handle mouse clicks if (e.Context is not CommandContext { Binding.MouseEventArgs: { } mouseArgs }) diff --git a/Examples/UICatalog/Scenarios/ContextMenus.cs b/Examples/UICatalog/Scenarios/ContextMenus.cs index 1c6170c5b..ddb52f484 100644 --- a/Examples/UICatalog/Scenarios/ContextMenus.cs +++ b/Examples/UICatalog/Scenarios/ContextMenus.cs @@ -35,7 +35,7 @@ public class ContextMenus : Scenario Application.Run (_appWindow); _appWindow.Dispose (); _appWindow.KeyDown -= OnAppWindowOnKeyDown; - _appWindow.Selecting -= OnAppWindowOnSelecting; + _appWindow.Activating -= OnAppWindowOnActivating; _winContextMenu?.Dispose (); // Shutdown - Calling Application.Shutdown is required. @@ -81,7 +81,7 @@ public class ContextMenus : Scenario _appWindow.Add (_tfBottomRight); _appWindow.KeyDown += OnAppWindowOnKeyDown; - _appWindow.Selecting += OnAppWindowOnSelecting; + _appWindow.Activating += OnAppWindowOnActivating; CultureInfo originalCulture = Thread.CurrentThread.CurrentUICulture; _appWindow.IsRunningChanged += (_, e) => { @@ -91,7 +91,7 @@ public class ContextMenus : Scenario } }; } - void OnAppWindowOnSelecting (object? s, CommandEventArgs e) + void OnAppWindowOnActivating (object? s, CommandEventArgs e) { if (e.Context is CommandContext { Binding.MouseEventArgs: { } mouseArgs }) { diff --git a/Examples/UICatalog/Scenarios/EditorsAndHelpers/EventLog.cs b/Examples/UICatalog/Scenarios/EditorsAndHelpers/EventLog.cs index af4cb3e88..064ad4c86 100644 --- a/Examples/UICatalog/Scenarios/EditorsAndHelpers/EventLog.cs +++ b/Examples/UICatalog/Scenarios/EditorsAndHelpers/EventLog.cs @@ -81,7 +81,7 @@ public class EventLog : ListView _viewToLog.MouseWheel += (_, args) => { Log ($"MouseWheel: {args}"); }; _viewToLog.HandlingHotKey += (_, args) => { Log ($"HandlingHotKey: {args.Context}"); }; - _viewToLog.Selecting += (_, args) => { Log ($"Selecting: {args.Context}"); }; + _viewToLog.Activating += (_, args) => { Log ($"Selecting: {args.Context}"); }; _viewToLog.Accepting += (_, args) => { Log ($"Accepting: {args.Context}"); }; } } diff --git a/Examples/UICatalog/Scenarios/ListViewWithSelection.cs b/Examples/UICatalog/Scenarios/ListViewWithSelection.cs index dd6ac2bf4..b1912a374 100644 --- a/Examples/UICatalog/Scenarios/ListViewWithSelection.cs +++ b/Examples/UICatalog/Scenarios/ListViewWithSelection.cs @@ -105,7 +105,7 @@ public class ListViewWithSelection : Scenario _listView.OpenSelectedItem += (s, a) => LogEvent (s as View, a, "OpenSelectedItem"); _listView.CollectionChanged += (s, a) => LogEvent (s as View, a, "CollectionChanged"); _listView.Accepting += (s, a) => LogEvent (s as View, a, "Accept"); - _listView.Selecting += (s, a) => LogEvent (s as View, a, "Select"); + _listView.Activating += (s, a) => LogEvent (s as View, a, "Select"); _listView.VerticalScrollBar.AutoShow = true; _listView.HorizontalScrollBar.AutoShow = true; diff --git a/Examples/UICatalog/Scenarios/Shortcuts.cs b/Examples/UICatalog/Scenarios/Shortcuts.cs index a2e241c6c..e76dcfc05 100644 --- a/Examples/UICatalog/Scenarios/Shortcuts.cs +++ b/Examples/UICatalog/Scenarios/Shortcuts.cs @@ -425,7 +425,7 @@ public class Shortcuts : Scenario BoxWidth = 1 }; - bgColorShortcut.Selecting += (o, args) => + bgColorShortcut.Activating += (o, args) => { //args.Cancel = true; }; @@ -480,18 +480,18 @@ public class Shortcuts : Scenario foreach (Shortcut shortcut in Application.TopRunnableView.SubViews.OfType ()) { - shortcut.Selecting += (o, args) => + shortcut.Activating += (o, args) => { if (args.Handled) { return; } - eventSource.Add ($"{shortcut!.Id}.Selecting: {shortcut!.CommandView.Text} {shortcut!.CommandView.GetType ().Name}"); + eventSource.Add ($"{shortcut!.Id}.Activating: {shortcut!.CommandView.Text} {shortcut!.CommandView.GetType ().Name}"); eventLog.MoveDown (); }; - shortcut.CommandView.Selecting += (o, args) => + shortcut.CommandView.Activating += (o, args) => { if (args.Handled) { @@ -499,7 +499,7 @@ public class Shortcuts : Scenario } eventSource.Add ( - $"{shortcut!.Id}.CommandView.Selecting: {shortcut!.CommandView.Text} {shortcut!.CommandView.GetType ().Name}"); + $"{shortcut!.Id}.CommandView.Activating: {shortcut!.CommandView.Text} {shortcut!.CommandView.GetType ().Name}"); eventLog.MoveDown (); //args.Handled = true; }; diff --git a/Examples/UICatalog/Scenarios/TableEditor.cs b/Examples/UICatalog/Scenarios/TableEditor.cs index 0ca8092d0..04d2bba24 100644 --- a/Examples/UICatalog/Scenarios/TableEditor.cs +++ b/Examples/UICatalog/Scenarios/TableEditor.cs @@ -610,7 +610,7 @@ public class TableEditor : Scenario }; // if user clicks the mouse in TableView - _tableView!.Selecting += (s, e) => + _tableView!.Activating += (s, e) => { if (_currentTable == null) { diff --git a/Examples/UICatalog/Scenarios/TreeViewFileSystem.cs b/Examples/UICatalog/Scenarios/TreeViewFileSystem.cs index 3753ac35d..75f0d822d 100644 --- a/Examples/UICatalog/Scenarios/TreeViewFileSystem.cs +++ b/Examples/UICatalog/Scenarios/TreeViewFileSystem.cs @@ -60,7 +60,7 @@ public class TreeViewFileSystem : Scenario }; win.Add (_detailsFrame); - _treeViewFiles.Selecting += TreeViewFiles_Selecting; + _treeViewFiles.Activating += TreeViewFiles_Selecting; _treeViewFiles.KeyDown += TreeViewFiles_KeyPress; _treeViewFiles.SelectionChanged += TreeViewFiles_SelectionChanged; diff --git a/Examples/UICatalog/Scenarios/ViewExperiments.cs b/Examples/UICatalog/Scenarios/ViewExperiments.cs index aeeaa14c9..786541334 100644 --- a/Examples/UICatalog/Scenarios/ViewExperiments.cs +++ b/Examples/UICatalog/Scenarios/ViewExperiments.cs @@ -86,7 +86,7 @@ public class ViewExperiments : Scenario //App?.Popover!.Visible = true; } - testFrame.Selecting += (sender, e) => + testFrame.Activating += (sender, e) => { if (e.Context is CommandContext { Binding.MouseEventArgs: { } mouseArgs }) { diff --git a/Examples/UICatalog/UICatalogRunnable.cs b/Examples/UICatalog/UICatalogRunnable.cs index 748c2a5dc..3df05b8ae 100644 --- a/Examples/UICatalog/UICatalogRunnable.cs +++ b/Examples/UICatalog/UICatalogRunnable.cs @@ -298,7 +298,7 @@ public class UICatalogRunnable : Runnable _diagnosticFlagsSelector.UsedHotKeys.Add (Key.D); _diagnosticFlagsSelector.AssignHotKeys = true; _diagnosticFlagsSelector.Value = Diagnostics; - _diagnosticFlagsSelector.Selecting += (sender, args) => + _diagnosticFlagsSelector.Activating += (sender, args) => { _diagnosticFlags = (ViewDiagnosticFlags)((int)args.Context!.Source!.Data!);// (ViewDiagnosticFlags)_diagnosticFlagsSelector.Value; Diagnostics = _diagnosticFlags; @@ -330,7 +330,7 @@ public class UICatalogRunnable : Runnable }; //_disableMouseCb.CheckedStateChanged += (_, args) => { Application.IsMouseDisabled = args.Value == CheckState.Checked; }; - _disableMouseCb.Selecting += (sender, args) => + _disableMouseCb.Activating += (sender, args) => { Application.IsMouseDisabled = !Application.IsMouseDisabled; _disableMouseCb.CheckedState = Application.IsMouseDisabled ? CheckState.Checked : CheckState.None; diff --git a/Terminal.Gui/Input/Command.cs b/Terminal.Gui/Input/Command.cs index 4d1b6d008..88e7f4a43 100644 --- a/Terminal.Gui/Input/Command.cs +++ b/Terminal.Gui/Input/Command.cs @@ -48,12 +48,13 @@ public enum Command HotKey, /// - /// Selects the View or an item in the View (e.g. a list item or menu item) without necessarily accepting it. + /// Activates the View or an item in the View, changing its state or preparing it for interaction + /// (e.g. toggling a checkbox, selecting a list item, focusing a button, navigating a menu item) without necessarily accepting it. /// - /// The default implementation in calls . + /// The default implementation in calls . /// /// - Select, + Activate, #endregion diff --git a/Terminal.Gui/ViewBase/View.Command.cs b/Terminal.Gui/ViewBase/View.Command.cs index 0c7a87948..0ab3578a4 100644 --- a/Terminal.Gui/ViewBase/View.Command.cs +++ b/Terminal.Gui/ViewBase/View.Command.cs @@ -35,19 +35,19 @@ public partial class View // Command APIs return true; }); - // Space or single-click - Raise Selecting + // Space or single-click - Raise Activating AddCommand ( - Command.Select, + Command.Activate, ctx => { - if (RaiseSelecting (ctx) is true) + if (RaiseActivating (ctx) is true) { return true; } if (CanFocus) { - // For Select, if the view is focusable and SetFocus succeeds, by defition, + // For Activate, if the view is focusable and SetFocus succeeds, by defition, // the event is handled. So return what SetFocus returns. return SetFocus (); } @@ -106,7 +106,7 @@ public partial class View // Command APIs /// /// /// The event should be raised after the state of the View has changed (after - /// is raised). + /// is raised). /// /// /// If the Accepting event is not handled, will be invoked on the SuperView, enabling @@ -251,12 +251,12 @@ public partial class View // Command APIs public event EventHandler? Accepted; /// - /// Called when the user has performed an action (e.g. ) causing the View to change state. - /// Calls which can be cancelled; if not cancelled raises . - /// event. The default handler calls this method. + /// Called when the user has performed an action (e.g. ) causing the View to change state or preparing it for interaction. + /// Calls which can be cancelled; if not cancelled raises . + /// event. The default handler calls this method. /// /// - /// The event should be raised after the state of the View has been changed and before see + /// The event should be raised after the state of the View has been changed and before see /// . /// /// @@ -265,40 +265,40 @@ public partial class View // Command APIs /// continue. /// if the event was raised and handled (or cancelled); input processing should stop. /// - protected bool? RaiseSelecting (ICommandContext? ctx) + protected virtual bool? RaiseActivating (ICommandContext? ctx) { //Logging.Debug ($"{Title} ({ctx?.Source?.Title})"); CommandEventArgs args = new () { Context = ctx }; // Best practice is to invoke the virtual method first. // This allows derived classes to handle the event and potentially cancel it. - if (OnSelecting (args) || args.Handled) + if (OnActivating (args) || args.Handled) { return true; } // If the event is not canceled by the virtual method, raise the event to notify any external subscribers. - Selecting?.Invoke (this, args); + Activating?.Invoke (this, args); - return Selecting is null ? null : args.Handled; + return Activating is null ? null : args.Handled; } /// - /// Called when the user has performed an action (e.g. ) causing the View to change state. + /// Called when the user has performed an action (e.g. ) causing the View to change state or preparing it for interaction. /// Set CommandEventArgs.Handled to and return to indicate the event was /// handled and processing should stop. /// /// The event arguments. /// to stop processing. - protected virtual bool OnSelecting (CommandEventArgs args) { return false; } + protected virtual bool OnActivating (CommandEventArgs args) { return false; } /// - /// Cancelable event raised when the user has performed an action (e.g. ) causing the View - /// to change state. + /// Cancelable event raised when the user has performed an action (e.g. ) causing the View + /// to change state or preparing it for interaction. /// Set CommandEventArgs.Handled to to indicate the event was handled and processing should /// stop. /// - public event EventHandler? Selecting; + public event EventHandler? Activating; /// /// Called when the View is handling the user pressing the View's s. Calls diff --git a/Terminal.Gui/ViewBase/View.Keyboard.cs b/Terminal.Gui/ViewBase/View.Keyboard.cs index 8f9a5127a..867b324b6 100644 --- a/Terminal.Gui/ViewBase/View.Keyboard.cs +++ b/Terminal.Gui/ViewBase/View.Keyboard.cs @@ -9,7 +9,7 @@ public partial class View // Keyboard APIs private void SetupKeyboard () { KeyBindings = new (this); - KeyBindings.Add (Key.Space, Command.Select); + KeyBindings.Add (Key.Space, Command.Activate); KeyBindings.Add (Key.Enter, Command.Accept); HotKeyBindings = new (this); diff --git a/Terminal.Gui/ViewBase/View.Mouse.cs b/Terminal.Gui/ViewBase/View.Mouse.cs index 146057f63..342a8bd86 100644 --- a/Terminal.Gui/ViewBase/View.Mouse.cs +++ b/Terminal.Gui/ViewBase/View.Mouse.cs @@ -19,11 +19,11 @@ public partial class View // Mouse APIs MouseBindings = new (); // TODO: Should the default really work with any button or just button1? - MouseBindings.Add (MouseFlags.Button1Clicked, Command.Select); - MouseBindings.Add (MouseFlags.Button2Clicked, Command.Select); - MouseBindings.Add (MouseFlags.Button3Clicked, Command.Select); - MouseBindings.Add (MouseFlags.Button4Clicked, Command.Select); - MouseBindings.Add (MouseFlags.Button1Clicked | MouseFlags.ButtonCtrl, Command.Select); + MouseBindings.Add (MouseFlags.Button1Clicked, Command.Activate); + MouseBindings.Add (MouseFlags.Button2Clicked, Command.Activate); + MouseBindings.Add (MouseFlags.Button3Clicked, Command.Activate); + MouseBindings.Add (MouseFlags.Button4Clicked, Command.Activate); + MouseBindings.Add (MouseFlags.Button1Clicked | MouseFlags.ButtonCtrl, Command.Activate); } /// @@ -472,7 +472,7 @@ public partial class View // Mouse APIs // If mouse is still in bounds, generate a click if (!WantMousePositionReports && Viewport.Contains (mouseEvent.Position)) { - // By default, this will raise Selecting/OnSelecting - Subclasses can override this via AddCommand (Command.Select ...). + // By default, this will raise Activating/OnActivating - Subclasses can override this via AddCommand (Command.Activate ...). mouseEvent.Handled = InvokeCommandsBoundToMouse (mouseEvent) == true; } diff --git a/Terminal.Gui/Views/Button.cs b/Terminal.Gui/Views/Button.cs index 7b0bc4779..47ca9962c 100644 --- a/Terminal.Gui/Views/Button.cs +++ b/Terminal.Gui/Views/Button.cs @@ -98,7 +98,7 @@ public class Button : View, IDesignable { bool cachedIsDefault = IsDefault; // Supports "Swap Default" in Buttons scenario where IsDefault changes - if (RaiseSelecting (commandContext) is true) + if (RaiseActivating (commandContext) is true) { return true; } diff --git a/Terminal.Gui/Views/CharMap/CharMap.cs b/Terminal.Gui/Views/CharMap/CharMap.cs index c9adeedb3..3fcf395da 100644 --- a/Terminal.Gui/Views/CharMap/CharMap.cs +++ b/Terminal.Gui/Views/CharMap/CharMap.cs @@ -45,7 +45,7 @@ public class CharMap : View, IDesignable AddCommand (Command.ScrollLeft, () => ScrollHorizontal (-1)); AddCommand (Command.Accept, HandleAcceptCommand); - AddCommand (Command.Select, HandleSelectCommand); + AddCommand (Command.Activate, HandleSelectCommand); AddCommand (Command.Context, HandleContextCommand); KeyBindings.Add (Key.CursorUp, Command.Up); @@ -286,7 +286,7 @@ public class CharMap : View, IDesignable private bool? Move (ICommandContext? commandContext, int cpOffset) { - if (RaiseSelecting (commandContext) is true) + if (RaiseActivating (commandContext) is true) { return true; } @@ -865,7 +865,7 @@ public class CharMap : View, IDesignable } } - if (RaiseSelecting (commandContext) is true) + if (RaiseActivating (commandContext) is true) { return true; } diff --git a/Terminal.Gui/Views/CheckBox.cs b/Terminal.Gui/Views/CheckBox.cs index 0dfb47e51..48950faec 100644 --- a/Terminal.Gui/Views/CheckBox.cs +++ b/Terminal.Gui/Views/CheckBox.cs @@ -33,7 +33,7 @@ public class CheckBox : View // Activate (Space key and single-click) - Raise Activate event and Advance // - DO NOT raise Accept // - DO NOT SetFocus - AddCommand (Command.Select, ActivateAndAdvance); + AddCommand (Command.Activate, ActivateAndAdvance); // Accept (Enter key and double-click) - Raise Accept event // - DO NOT advance state @@ -49,7 +49,7 @@ public class CheckBox : View protected override bool OnHandlingHotKey (CommandEventArgs args) { // Invoke Activate on ourselves - if (InvokeCommand (Command.Select, args.Context) is true) + if (InvokeCommand (Command.Activate, args.Context) is true) { // Default behavior for View is to set Focus on hotkey. We need to return // true here to indicate Activate was handled. That will prevent the default @@ -62,7 +62,7 @@ public class CheckBox : View private bool? ActivateAndAdvance (ICommandContext? commandContext) { - if (RaiseSelecting (commandContext) is true) + if (RaiseActivating (commandContext) is true) { return true; } diff --git a/Terminal.Gui/Views/Color/ColorPicker.16.cs b/Terminal.Gui/Views/Color/ColorPicker.16.cs index 23620cfe0..43b27dca8 100644 --- a/Terminal.Gui/Views/Color/ColorPicker.16.cs +++ b/Terminal.Gui/Views/Color/ColorPicker.16.cs @@ -70,7 +70,7 @@ public class ColorPicker16 : View /// private bool MoveDown (ICommandContext? commandContext) { - if (RaiseSelecting (commandContext) == true) + if (RaiseActivating (commandContext) == true) { return true; } @@ -86,7 +86,7 @@ public class ColorPicker16 : View /// private bool MoveLeft (ICommandContext? commandContext) { - if (RaiseSelecting (commandContext) == true) + if (RaiseActivating (commandContext) == true) { return true; } @@ -103,7 +103,7 @@ public class ColorPicker16 : View /// private bool MoveRight (ICommandContext? commandContext) { - if (RaiseSelecting (commandContext) == true) + if (RaiseActivating (commandContext) == true) { return true; } @@ -119,7 +119,7 @@ public class ColorPicker16 : View /// private bool MoveUp (ICommandContext? commandContext) { - if (RaiseSelecting (commandContext) == true) + if (RaiseActivating (commandContext) == true) { return true; } @@ -195,7 +195,7 @@ public class ColorPicker16 : View AddCommand (Command.Up, (ctx) => MoveUp (ctx)); AddCommand (Command.Down, (ctx) => MoveDown (ctx)); - AddCommand (Command.Select, (ctx) => + AddCommand (Command.Activate, (ctx) => { var set = false; diff --git a/Terminal.Gui/Views/FileDialogs/FileDialog.cs b/Terminal.Gui/Views/FileDialogs/FileDialog.cs index 9ecfe23c4..75248a943 100644 --- a/Terminal.Gui/Views/FileDialogs/FileDialog.cs +++ b/Terminal.Gui/Views/FileDialogs/FileDialog.cs @@ -194,8 +194,8 @@ public class FileDialog : Dialog, IDesignable Id = "_tableView" }; _tableView.CollectionNavigator = new FileDialogCollectionNavigator (this, _tableView); - _tableView.KeyBindings.ReplaceCommands (Key.Space, Command.Select); - _tableView.Selecting += OnTableViewSelecting; + _tableView.KeyBindings.ReplaceCommands (Key.Space, Command.Activate); + _tableView.Activating += OnTableViewSelecting; Style.TableStyle = _tableView.Style; ColumnStyle nameStyle = Style.TableStyle.GetOrCreateColumnStyle (0); diff --git a/Terminal.Gui/Views/HexView.cs b/Terminal.Gui/Views/HexView.cs index b05f0b506..bd12221ce 100644 --- a/Terminal.Gui/Views/HexView.cs +++ b/Terminal.Gui/Views/HexView.cs @@ -57,7 +57,7 @@ public class HexView : View, IDesignable _leftSideHasFocus = true; _firstNibble = true; - AddCommand (Command.Select, HandleMouseClick); + AddCommand (Command.Activate, HandleMouseClick); AddCommand (Command.Left, () => MoveLeft ()); AddCommand (Command.Right, () => MoveRight ()); AddCommand (Command.Down, () => MoveDown (BytesPerLine)); @@ -101,8 +101,8 @@ public class HexView : View, IDesignable KeyBindings.Remove (Key.Enter); // The Select handler deals with both single and double clicks - MouseBindings.ReplaceCommands (MouseFlags.Button1Clicked, Command.Select); - MouseBindings.Add (MouseFlags.Button1DoubleClicked, Command.Select); + MouseBindings.ReplaceCommands (MouseFlags.Button1Clicked, Command.Activate); + MouseBindings.Add (MouseFlags.Button1DoubleClicked, Command.Activate); MouseBindings.Add (MouseFlags.WheeledUp, Command.ScrollUp); MouseBindings.Add (MouseFlags.WheeledDown, Command.ScrollDown); @@ -363,7 +363,7 @@ public class HexView : View, IDesignable return false; } - if (RaiseSelecting (commandContext) is true) + if (RaiseActivating (commandContext) is true) { return true; } diff --git a/Terminal.Gui/Views/Label.cs b/Terminal.Gui/Views/Label.cs index 512e961fc..39eeaa2b6 100644 --- a/Terminal.Gui/Views/Label.cs +++ b/Terminal.Gui/Views/Label.cs @@ -81,7 +81,7 @@ public class Label : View, IDesignable } /// - protected override bool OnSelecting (CommandEventArgs args) + protected override bool OnActivating (CommandEventArgs args) { // If Label can't focus and is clicked, invoke HotKey on next peer if (!CanFocus) @@ -89,7 +89,7 @@ public class Label : View, IDesignable return InvokeCommand (Command.HotKey, args.Context) == true; } - return base.OnSelecting (args); + return base.OnActivating (args); } /// diff --git a/Terminal.Gui/Views/ListView.cs b/Terminal.Gui/Views/ListView.cs index 453737c85..b35ce27c8 100644 --- a/Terminal.Gui/Views/ListView.cs +++ b/Terminal.Gui/Views/ListView.cs @@ -59,10 +59,10 @@ public class ListView : View, IDesignable // Things this view knows how to do // - AddCommand (Command.Up, ctx => RaiseSelecting (ctx) == true || MoveUp ()); - AddCommand (Command.Down, ctx => RaiseSelecting (ctx) == true || MoveDown ()); + AddCommand (Command.Up, ctx => RaiseActivating (ctx) == true || MoveUp ()); + AddCommand (Command.Down, ctx => RaiseActivating (ctx) == true || MoveDown ()); - // TODO: add RaiseSelecting to all of these + // TODO: add RaiseActivating to all of these AddCommand (Command.ScrollUp, () => ScrollVertical (-1)); AddCommand (Command.ScrollDown, () => ScrollVertical (1)); AddCommand (Command.PageUp, () => MovePageUp ()); @@ -87,7 +87,7 @@ public class ListView : View, IDesignable // Select (Space key and single-click) - If markable, change mark and raise Select event AddCommand ( - Command.Select, + Command.Activate, ctx => { if (!_allowsMarking) @@ -95,7 +95,7 @@ public class ListView : View, IDesignable return false; } - if (RaiseSelecting (ctx) == true) + if (RaiseActivating (ctx) == true) { return true; } @@ -115,7 +115,7 @@ public class ListView : View, IDesignable SelectedItem = 0; - if (RaiseSelecting (ctx) == true) + if (RaiseActivating (ctx) == true) { return true; } @@ -151,8 +151,8 @@ public class ListView : View, IDesignable KeyBindings.Add (Key.End, Command.End); - // Key.Space is already bound to Command.Select; this gives us select then move down - KeyBindings.Add (Key.Space.WithShift, Command.Select, Command.Down); + // Key.Space is already bound to Command.Activate; this gives us select then move down + KeyBindings.Add (Key.Space.WithShift, Command.Activate, Command.Down); // Use the form of Add that lets us pass context to the handler KeyBindings.Add (Key.A.WithCtrl, new KeyBinding ([Command.SelectAll], true)); diff --git a/Terminal.Gui/Views/NumericUpDown.cs b/Terminal.Gui/Views/NumericUpDown.cs index adb94d554..0fa64bff8 100644 --- a/Terminal.Gui/Views/NumericUpDown.cs +++ b/Terminal.Gui/Views/NumericUpDown.cs @@ -98,7 +98,7 @@ public class NumericUpDown : View where T : notnull } // BUGBUG: If this is uncommented, the numericupdown in a shortcut will not work - //if (RaiseSelecting (ctx) is true) + //if (RaiseActivating (ctx) is true) //{ // return true; //} @@ -120,7 +120,7 @@ public class NumericUpDown : View where T : notnull } // BUGBUG: If this is uncommented, the numericupdown in a shortcut will not work - //if (RaiseSelecting (ctx) is true) + //if (RaiseActivating (ctx) is true) //{ // return true; //} diff --git a/Terminal.Gui/Views/ScrollBar/ScrollBar.cs b/Terminal.Gui/Views/ScrollBar/ScrollBar.cs index e854bcc63..a76545702 100644 --- a/Terminal.Gui/Views/ScrollBar/ScrollBar.cs +++ b/Terminal.Gui/Views/ScrollBar/ScrollBar.cs @@ -517,18 +517,18 @@ public class ScrollBar : View, IOrientation, IDesignable // TODO: Change this to work OnMouseEvent with continuouse press and grab so it's continous. /// - protected override bool OnSelecting (CommandEventArgs args) + protected override bool OnActivating (CommandEventArgs args) { // Only handle mouse clicks if (args.Context is not CommandContext { Binding.MouseEventArgs: { } mouseArgs }) { - return base.OnSelecting (args); + return base.OnActivating (args); } // Check if the mouse click is a single click if (!mouseArgs.IsSingleClicked) { - return base.OnSelecting (args); + return base.OnActivating (args); } int sliderCenter; diff --git a/Terminal.Gui/Views/ScrollBar/ScrollSlider.cs b/Terminal.Gui/Views/ScrollBar/ScrollSlider.cs index d3d861ac2..a4d1a5f33 100644 --- a/Terminal.Gui/Views/ScrollBar/ScrollSlider.cs +++ b/Terminal.Gui/Views/ScrollBar/ScrollSlider.cs @@ -236,7 +236,7 @@ public class ScrollSlider : View, IOrientation, IDesignable OnScrolled (distance); Scrolled?.Invoke (this, new (in distance)); - RaiseSelecting (new CommandContext (Command.Select, this, new KeyBinding ([Command.Select], null, distance))); + RaiseActivating (new CommandContext (Command.Activate, this, new KeyBinding ([Command.Activate], null, distance))); } /// diff --git a/Terminal.Gui/Views/Selectors/FlagSelector.cs b/Terminal.Gui/Views/Selectors/FlagSelector.cs index c2c8c15f9..d1553520f 100644 --- a/Terminal.Gui/Views/Selectors/FlagSelector.cs +++ b/Terminal.Gui/Views/Selectors/FlagSelector.cs @@ -31,7 +31,7 @@ public class FlagSelector : SelectorBase, IDesignable checkbox.CheckedStateChanging += OnCheckboxOnCheckedStateChanging; checkbox.CheckedStateChanged += OnCheckboxOnCheckedStateChanged; - checkbox.Selecting += OnCheckboxOnSelecting; + checkbox.Activating += OnCheckboxOnActivating; checkbox.Accepting += OnCheckboxOnAccepting; } @@ -76,7 +76,7 @@ public class FlagSelector : SelectorBase, IDesignable Value = newValue; } - private void OnCheckboxOnSelecting (object? sender, CommandEventArgs args) + private void OnCheckboxOnActivating (object? sender, CommandEventArgs args) { if (sender is not CheckBox checkbox) { @@ -91,7 +91,7 @@ public class FlagSelector : SelectorBase, IDesignable } // Selecting doesn't normally propogate, so we do it here - if (InvokeCommand (Command.Select, args.Context) is true) + if (InvokeCommand (Command.Activate, args.Context) is true) { // Do not return here; we want to toggle the checkbox state args.Handled = true; diff --git a/Terminal.Gui/Views/Selectors/OptionSelector.cs b/Terminal.Gui/Views/Selectors/OptionSelector.cs index ab4159cc3..52733db1d 100644 --- a/Terminal.Gui/Views/Selectors/OptionSelector.cs +++ b/Terminal.Gui/Views/Selectors/OptionSelector.cs @@ -43,14 +43,14 @@ public class OptionSelector : SelectorBase, IDesignable } if (!CanFocus) { - if (RaiseSelecting (args.Context) is true) + if (RaiseActivating (args.Context) is true) { return true; } } else if (!HasFocus && Value is null) { - if (RaiseSelecting (args.Context) is true) + if (RaiseActivating (args.Context) is true) { return true; } @@ -63,9 +63,9 @@ public class OptionSelector : SelectorBase, IDesignable } /// - protected override bool OnSelecting (CommandEventArgs args) + protected override bool OnActivating (CommandEventArgs args) { - if (base.OnSelecting (args) is true) + if (base.OnActivating (args) is true) { return true; } @@ -112,12 +112,12 @@ public class OptionSelector : SelectorBase, IDesignable checkbox.RadioStyle = true; - checkbox.Selecting += OnCheckboxOnSelecting; + checkbox.Activating += OnCheckboxOnActivating; checkbox.Accepting += OnCheckboxOnAccepting; } - private void OnCheckboxOnSelecting (object? sender, CommandEventArgs args) + private void OnCheckboxOnActivating (object? sender, CommandEventArgs args) { if (sender is not CheckBox checkbox) { @@ -149,7 +149,7 @@ public class OptionSelector : SelectorBase, IDesignable } // Selecting doesn't normally propogate, so we do it here - if (InvokeCommand (Command.Select, args.Context) is true) + if (InvokeCommand (Command.Activate, args.Context) is true) { // Do not return here; we want to toggle the checkbox state args.Handled = true; diff --git a/Terminal.Gui/Views/Selectors/SelectorBase.cs b/Terminal.Gui/Views/Selectors/SelectorBase.cs index 03b7ac2ba..fab5ba57c 100644 --- a/Terminal.Gui/Views/Selectors/SelectorBase.cs +++ b/Terminal.Gui/Views/Selectors/SelectorBase.cs @@ -80,15 +80,15 @@ public abstract class SelectorBase : View, IOrientation if ((HasFocus || !CanFocus) && HotKey == keyCommandContext.Binding.Key?.NoAlt.NoCtrl.NoShift!) { // It's this.HotKey OR Another View (Label?) forwarded the hotkey command to us - Act just like `Space` (Select) - return Focused?.InvokeCommand (Command.Select, args.Context) is true; + return Focused?.InvokeCommand (Command.Activate, args.Context) is true; } return base.OnHandlingHotKey (args); } /// - protected override bool OnSelecting (CommandEventArgs args) + protected override bool OnActivating (CommandEventArgs args) { - return base.OnSelecting (args); + return base.OnActivating (args); } private int? _value; diff --git a/Terminal.Gui/Views/Shortcut.cs b/Terminal.Gui/Views/Shortcut.cs index 87d0f9f89..857891aa6 100644 --- a/Terminal.Gui/Views/Shortcut.cs +++ b/Terminal.Gui/Views/Shortcut.cs @@ -249,13 +249,13 @@ public class Shortcut : View, IOrientation, IDesignable AddCommand (Command.HotKey, DispatchCommand); // Select (Space key or click) - - AddCommand (Command.Select, DispatchCommand); + AddCommand (Command.Activate, DispatchCommand); } /// /// Dispatches the Command in the (Raises Selected, then Accepting, then invoke the /// Action, if any). - /// Called when Command.Select, Accept, or HotKey has been invoked on this Shortcut. + /// Called when Command.Activate, Accept, or HotKey has been invoked on this Shortcut. /// /// /// @@ -279,12 +279,12 @@ public class Shortcut : View, IOrientation, IDesignable Logging.Debug ($"{Title} ({commandContext?.Source?.Title}) - Invoking Select on CommandView ({CommandView.GetType ().Name})."); - CommandView.InvokeCommand (Command.Select, keyCommandContext); + CommandView.InvokeCommand (Command.Activate, keyCommandContext); } - Logging.Debug ($"{Title} ({commandContext?.Source?.Title}) - RaiseSelecting ..."); + Logging.Debug ($"{Title} ({commandContext?.Source?.Title}) - RaiseActivating ..."); - if (RaiseSelecting (commandContext) is true) + if (RaiseActivating (commandContext) is true) { return true; } @@ -426,7 +426,7 @@ public class Shortcut : View, IOrientation, IDesignable } // Clean up old - _commandView.Selecting -= CommandViewOnSelecting; + _commandView.Activating -= CommandViewOnActivating; _commandView.Accepting -= CommandViewOnAccepted; Remove (_commandView); _commandView?.Dispose (); @@ -452,7 +452,7 @@ public class Shortcut : View, IOrientation, IDesignable Title = _commandView.Text; - _commandView.Selecting += CommandViewOnSelecting; + _commandView.Activating += CommandViewOnActivating; _commandView.Accepting += CommandViewOnAccepted; //ShowHide (); @@ -466,13 +466,13 @@ public class Shortcut : View, IOrientation, IDesignable e.Handled = true; } - void CommandViewOnSelecting (object? sender, CommandEventArgs e) + void CommandViewOnActivating (object? sender, CommandEventArgs e) { if ((e.Context is CommandContext keyCommandContext && keyCommandContext.Binding.Data != this) || e.Context is CommandContext) { // Forward command to ourselves - InvokeCommand (Command.Select, new ([Command.Select], null, this)); + InvokeCommand (Command.Activate, new ([Command.Activate], null, this)); } e.Handled = true; diff --git a/Terminal.Gui/Views/Slider/Slider.cs b/Terminal.Gui/Views/Slider/Slider.cs index 0535beff0..5c7a9f347 100644 --- a/Terminal.Gui/Views/Slider/Slider.cs +++ b/Terminal.Gui/Views/Slider/Slider.cs @@ -1426,7 +1426,7 @@ public class Slider : View, IOrientation AddCommand (Command.RightEnd, () => MoveEnd ()); AddCommand (Command.RightExtend, () => ExtendPlus ()); AddCommand (Command.LeftExtend, () => ExtendMinus ()); - AddCommand (Command.Select, () => Select ()); + AddCommand (Command.Activate, () => Select ()); AddCommand (Command.Accept, (ctx) => Accept (ctx)); SetKeyBindings (); @@ -1467,7 +1467,7 @@ public class Slider : View, IOrientation KeyBindings.Remove (Key.Enter); KeyBindings.Add (Key.Enter, Command.Accept); KeyBindings.Remove (Key.Space); - KeyBindings.Add (Key.Space, Command.Select); + KeyBindings.Add (Key.Space, Command.Activate); } private Dictionary> GetSetOptionDictionary () { return _setOptions.ToDictionary (e => e, e => _options [e]); } diff --git a/Terminal.Gui/Views/TabView/TabRow.cs b/Terminal.Gui/Views/TabView/TabRow.cs index 54dd618fa..0385624ce 100644 --- a/Terminal.Gui/Views/TabView/TabRow.cs +++ b/Terminal.Gui/Views/TabView/TabRow.cs @@ -24,7 +24,7 @@ internal class TabRow : View Visible = false, Text = Glyphs.RightArrow.ToString () }; - _rightScrollIndicator.Selecting += (s, e) => + _rightScrollIndicator.Activating += (s, e) => { _host.Tab_Selecting (s, e); }; @@ -37,7 +37,7 @@ internal class TabRow : View Visible = false, Text = Glyphs.LeftArrow.ToString () }; - _leftScrollIndicator.Selecting += (s, e) => + _leftScrollIndicator.Activating += (s, e) => { _host.Tab_Selecting (s, e); }; diff --git a/Terminal.Gui/Views/TabView/TabView.cs b/Terminal.Gui/Views/TabView/TabView.cs index b41ac7bb8..d9061e211 100644 --- a/Terminal.Gui/Views/TabView/TabView.cs +++ b/Terminal.Gui/Views/TabView/TabView.cs @@ -563,8 +563,8 @@ public class TabView : View if (maxWidth == 0) { tab.Visible = true; - tab.Selecting += Tab_Selecting!; - tab.Border!.Selecting += Tab_Selecting!; + tab.Activating += Tab_Selecting!; + tab.Border!.Activating += Tab_Selecting!; yield return tab; @@ -594,8 +594,8 @@ public class TabView : View // there is enough space! tab.Visible = true; - tab.Selecting += Tab_Selecting!; - tab.Border!.Selecting += Tab_Selecting!; + tab.Activating += Tab_Selecting!; + tab.Border!.Activating += Tab_Selecting!; yield return tab; @@ -655,8 +655,8 @@ public class TabView : View if (tab.Visible) { - tab.Selecting -= Tab_Selecting!; - tab.Border!.Selecting -= Tab_Selecting!; + tab.Activating -= Tab_Selecting!; + tab.Border!.Activating -= Tab_Selecting!; tab.Visible = false; } } @@ -665,8 +665,8 @@ public class TabView : View { foreach (Tab tabToRender in _tabLocations) { - tabToRender.Selecting -= Tab_Selecting!; - tabToRender.Border!.Selecting -= Tab_Selecting!; + tabToRender.Activating -= Tab_Selecting!; + tabToRender.Border!.Activating -= Tab_Selecting!; tabToRender.Visible = false; } diff --git a/Terminal.Gui/Views/TableView/CheckBoxTableSourceWrapper.cs b/Terminal.Gui/Views/TableView/CheckBoxTableSourceWrapper.cs index aaec4e9b5..c9b199566 100644 --- a/Terminal.Gui/Views/TableView/CheckBoxTableSourceWrapper.cs +++ b/Terminal.Gui/Views/TableView/CheckBoxTableSourceWrapper.cs @@ -28,9 +28,9 @@ public abstract class CheckBoxTableSourceWrapperBase : ITableSource Wrapping = toWrap; this.tableView = tableView; - tableView.KeyBindings.ReplaceCommands (Key.Space, Command.Select); + tableView.KeyBindings.ReplaceCommands (Key.Space, Command.Activate); - tableView.Selecting += TableView_Selecting; + tableView.Activating += TableView_Selecting; tableView.CellToggled += TableView_CellToggled; } diff --git a/Terminal.Gui/Views/TableView/TableSelection.cs b/Terminal.Gui/Views/TableView/TableSelection.cs index 2fe21f9cd..8b5ec0c8e 100644 --- a/Terminal.Gui/Views/TableView/TableSelection.cs +++ b/Terminal.Gui/Views/TableView/TableSelection.cs @@ -14,7 +14,7 @@ public class TableSelection } /// - /// True if the selection was made through and therefore should persist even + /// True if the selection was made through and therefore should persist even /// through keyboard navigation. /// public bool IsToggled { get; set; } diff --git a/Terminal.Gui/Views/TableView/TableView.cs b/Terminal.Gui/Views/TableView/TableView.cs index 451636799..405b2a0f4 100644 --- a/Terminal.Gui/Views/TableView/TableView.cs +++ b/Terminal.Gui/Views/TableView/TableView.cs @@ -243,12 +243,12 @@ public class TableView : View, IDesignable AddCommand (Command.Accept, () => OnCellActivated (new (Table, SelectedColumn, SelectedRow))); AddCommand ( - Command.Select, // was Command.ToggleChecked + Command.Activate, // was Command.ToggleChecked ctx => { if (ToggleCurrentCellSelection () is true) { - return RaiseSelecting (ctx) is true; + return RaiseActivating (ctx) is true; } return false; @@ -461,7 +461,7 @@ public class TableView : View, IDesignable /// public event EventHandler CellActivated; - /// This event is raised when a cell is toggled (see + /// This event is raised when a cell is toggled (see public event EventHandler CellToggled; /// @@ -1574,7 +1574,7 @@ public class TableView : View, IDesignable /// Origin point for the selection in Y /// End point for the selection in X /// End point for the selection in Y - /// True if selection is result of + /// True if selection is result of /// private TableSelection CreateTableSelection (int pt1X, int pt1Y, int pt2X, int pt2Y, bool toggle = false) { diff --git a/Terminal.Gui/Views/TableView/TreeTableSource.cs b/Terminal.Gui/Views/TableView/TreeTableSource.cs index 8eccb4203..a9a0209c9 100644 --- a/Terminal.Gui/Views/TableView/TreeTableSource.cs +++ b/Terminal.Gui/Views/TableView/TreeTableSource.cs @@ -42,7 +42,7 @@ public class TreeTableSource : IEnumerableTableSource, IDisposable where T _tableView = table; _tree = tree; _tableView.KeyDown += Table_KeyPress; - _tableView.Selecting += Table_Selecting; + _tableView.Activating += Table_Selecting; List colList = subsequentColumns.Keys.ToList (); colList.Insert (0, firstColumnName); @@ -56,7 +56,7 @@ public class TreeTableSource : IEnumerableTableSource, IDisposable where T public void Dispose () { _tableView.KeyDown -= Table_KeyPress; - _tableView.Selecting -= Table_Selecting; + _tableView.Activating -= Table_Selecting; _tree.Dispose (); } diff --git a/Terminal.Gui/Views/TreeView/TreeView.cs b/Terminal.Gui/Views/TreeView/TreeView.cs index a0ca872c1..92ee00cd1 100644 --- a/Terminal.Gui/Views/TreeView/TreeView.cs +++ b/Terminal.Gui/Views/TreeView/TreeView.cs @@ -291,7 +291,7 @@ public class TreeView : View, ITreeView where T : class } ); - AddCommand (Command.Select, ActivateSelectedObjectIfAny); + AddCommand (Command.Activate, ActivateSelectedObjectIfAny); AddCommand (Command.Accept, ActivateSelectedObjectIfAny); // Default keybindings for this view @@ -317,7 +317,7 @@ public class TreeView : View, ITreeView where T : class KeyBindings.Add (Key.A.WithCtrl, Command.SelectAll); KeyBindings.Remove (ObjectActivationKey); - KeyBindings.Add (ObjectActivationKey, Command.Select); + KeyBindings.Add (ObjectActivationKey, Command.Activate); } /// diff --git a/Tests/UnitTests/View/Mouse/MouseTests.cs b/Tests/UnitTests/View/Mouse/MouseTests.cs index f2c17e186..08724645a 100644 --- a/Tests/UnitTests/View/Mouse/MouseTests.cs +++ b/Tests/UnitTests/View/Mouse/MouseTests.cs @@ -119,7 +119,7 @@ public class MouseTests : TestsAllViews var selectingCount = 0; - view.Selecting += (s, e) => selectingCount++; + view.Activating += (s, e) => selectingCount++; me.Flags = clicked; view.NewMouseEvent (me); diff --git a/Tests/UnitTests/Views/ButtonTests.cs b/Tests/UnitTests/Views/ButtonTests.cs index 6e3690eee..16a5993a2 100644 --- a/Tests/UnitTests/Views/ButtonTests.cs +++ b/Tests/UnitTests/Views/ButtonTests.cs @@ -287,7 +287,7 @@ public class ButtonTests (ITestOutputHelper output) var selectingCount = 0; - button.Selecting += (s, e) => selectingCount++; + button.Activating += (s, e) => selectingCount++; var acceptedCount = 0; button.Accepting += (s, e) => @@ -343,7 +343,7 @@ public class ButtonTests (ITestOutputHelper output) var selectingCount = 0; - button.Selecting += (s, e) => + button.Activating += (s, e) => { selectingCount++; e.Handled = true; diff --git a/Tests/UnitTests/Views/CheckBoxTests.cs b/Tests/UnitTests/Views/CheckBoxTests.cs index a14d1c45d..8b55a0567 100644 --- a/Tests/UnitTests/Views/CheckBoxTests.cs +++ b/Tests/UnitTests/Views/CheckBoxTests.cs @@ -271,10 +271,10 @@ public class CheckBoxTests (ITestOutputHelper output) ckb.CheckedState = initialState; - ckb.Selecting += OnActivating; + ckb.Activating += OnActivating; Assert.Equal (initialState, ckb.CheckedState); - bool? ret = ckb.InvokeCommand (Command.Select); + bool? ret = ckb.InvokeCommand (Command.Activate); Assert.True (ret); Assert.True (checkedInvoked); Assert.Equal (initialState, ckb.CheckedState); diff --git a/Tests/UnitTests/Views/ShortcutTests.cs b/Tests/UnitTests/Views/ShortcutTests.cs index 045644b9d..37068d99a 100644 --- a/Tests/UnitTests/Views/ShortcutTests.cs +++ b/Tests/UnitTests/Views/ShortcutTests.cs @@ -86,12 +86,12 @@ public class ShortcutTests var commandViewAcceptCount = 0; shortcut.CommandView.Accepting += (s, e) => { commandViewAcceptCount++; }; var commandViewSelectCount = 0; - shortcut.CommandView.Selecting += (s, e) => { commandViewSelectCount++; }; + shortcut.CommandView.Activating += (s, e) => { commandViewSelectCount++; }; var shortcutAcceptCount = 0; shortcut.Accepting += (s, e) => { shortcutAcceptCount++; }; var shortcutSelectCount = 0; - shortcut.Selecting += (s, e) => { shortcutSelectCount++; }; + shortcut.Activating += (s, e) => { shortcutSelectCount++; }; Application.TopRunnableView.Add (shortcut); Application.TopRunnableView.SetRelativeLayout (new (100, 100)); @@ -203,7 +203,7 @@ public class ShortcutTests shortcut.CommandView.Accepting += (s, e) => { checkboxAccepted++; }; var checkboxSelected = 0; - shortcut.CommandView.Selecting += (s, e) => + shortcut.CommandView.Activating += (s, e) => { if (e.Handled) { @@ -217,7 +217,7 @@ public class ShortcutTests Application.TopRunnableView.LayoutSubViews (); var selected = 0; - shortcut.Selecting += (s, e) => + shortcut.Activating += (s, e) => { selected++; }; @@ -278,7 +278,7 @@ public class ShortcutTests shortcut.Accepting += (s, e) => accepted++; var selected = 0; - shortcut.Selecting += (s, e) => selected++; + shortcut.Activating += (s, e) => selected++; Application.RaiseKeyDownEvent (key); diff --git a/Tests/UnitTests/Views/TableViewTests.cs b/Tests/UnitTests/Views/TableViewTests.cs index 791501a08..ec3fed7ed 100644 --- a/Tests/UnitTests/Views/TableViewTests.cs +++ b/Tests/UnitTests/Views/TableViewTests.cs @@ -3048,7 +3048,7 @@ A B C dt.Rows.Add (1, 2, 3, 4, 5, 6); tableView.MultiSelect = true; - tableView.KeyBindings.ReplaceCommands (Key.Space, Command.Select); + tableView.KeyBindings.ReplaceCommands (Key.Space, Command.Activate); Point selectedCell = tableView.GetAllSelectedCells ().Single (); Assert.Equal (0, selectedCell.X); @@ -3120,7 +3120,7 @@ A B C dt.Rows.Add (1, 2, 3, 4, 5, 6); tableView.FullRowSelect = true; tableView.MultiSelect = true; - tableView.KeyBindings.ReplaceCommands (Key.Space, Command.Select); + tableView.KeyBindings.ReplaceCommands (Key.Space, Command.Activate); // Toggle Select Cell 0,0 tableView.NewKeyDownEvent (new () { KeyCode = KeyCode.Space }); @@ -3160,7 +3160,7 @@ A B C dt.Rows.Add (1, 2, 3, 4, 5, 6); dt.Rows.Add (1, 2, 3, 4, 5, 6); tableView.MultiSelect = true; - tableView.KeyBindings.ReplaceCommands (Key.Space, Command.Select); + tableView.KeyBindings.ReplaceCommands (Key.Space, Command.Activate); // Make a square selection tableView.NewKeyDownEvent (new () { KeyCode = KeyCode.ShiftMask | KeyCode.CursorDown }); @@ -3201,7 +3201,7 @@ A B C dt.Rows.Add (1, 2, 3, 4, 5, 6); dt.Rows.Add (1, 2, 3, 4, 5, 6); tableView.MultiSelect = true; - tableView.KeyBindings.ReplaceCommands (Key.Space, Command.Select); + tableView.KeyBindings.ReplaceCommands (Key.Space, Command.Activate); // Make first square selection (0,0 to 1,1) tableView.NewKeyDownEvent (new () { KeyCode = KeyCode.ShiftMask | KeyCode.CursorDown }); diff --git a/Tests/UnitTestsParallelizable/ViewBase/Keyboard/KeyBindingsTests.cs b/Tests/UnitTestsParallelizable/ViewBase/Keyboard/KeyBindingsTests.cs index 588654222..18d9849b3 100644 --- a/Tests/UnitTestsParallelizable/ViewBase/Keyboard/KeyBindingsTests.cs +++ b/Tests/UnitTestsParallelizable/ViewBase/Keyboard/KeyBindingsTests.cs @@ -159,7 +159,7 @@ public class KeyBindingsTests view.HandlingHotKey += (s, e) => hotKeyRaised = true; view.Accepting += (s, e) => acceptRaised = true; - view.Selecting += (s, e) => selectRaised = true; + view.Activating += (s, e) => selectRaised = true; Assert.Equal (KeyCode.T, view.HotKey); Assert.True (app.Keyboard.RaiseKeyDownEvent (Key.T)); diff --git a/Tests/UnitTestsParallelizable/ViewBase/Mouse/MouseEventRoutingTests.cs b/Tests/UnitTestsParallelizable/ViewBase/Mouse/MouseEventRoutingTests.cs index b72cd4c84..6765442d5 100644 --- a/Tests/UnitTestsParallelizable/ViewBase/Mouse/MouseEventRoutingTests.cs +++ b/Tests/UnitTestsParallelizable/ViewBase/Mouse/MouseEventRoutingTests.cs @@ -195,7 +195,7 @@ public class MouseEventRoutingTests (ITestOutputHelper output) superView.Add (subView); int selectingCount = 0; - subView.Selecting += (_, _) => selectingCount++; + subView.Activating += (_, _) => selectingCount++; MouseEventArgs mouseEvent = new () { @@ -395,7 +395,7 @@ public class MouseEventRoutingTests (ITestOutputHelper output) }; bool selectingCalled = false; - view.Selecting += (_, _) => { selectingCalled = true; }; + view.Activating += (_, _) => { selectingCalled = true; }; MouseEventArgs mouseEvent = new () { @@ -468,7 +468,7 @@ public class MouseEventRoutingTests (ITestOutputHelper output) superView.Add (view); int selectingCount = 0; - view.Selecting += (_, _) => selectingCount++; + view.Activating += (_, _) => selectingCount++; MouseEventArgs mouseEvent = new () { diff --git a/Tests/UnitTestsParallelizable/ViewBase/Mouse/MouseTests.cs b/Tests/UnitTestsParallelizable/ViewBase/Mouse/MouseTests.cs index 9fa3d824f..b56450d55 100644 --- a/Tests/UnitTestsParallelizable/ViewBase/Mouse/MouseTests.cs +++ b/Tests/UnitTestsParallelizable/ViewBase/Mouse/MouseTests.cs @@ -58,7 +58,7 @@ public class MouseTests (ITestOutputHelper output) : TestsAllViews } var selectingCount = 0; - testView.Selecting += (sender, args) => selectingCount++; + testView.Activating += (sender, args) => selectingCount++; testView.NewMouseEvent (new () { Position = new (0, 0), Flags = MouseFlags.Button1Clicked }); Assert.True (superView.HasFocus); diff --git a/Tests/UnitTestsParallelizable/ViewBase/ViewCommandTests.cs b/Tests/UnitTestsParallelizable/ViewBase/ViewCommandTests.cs index 00b9dea4b..8a73ab75b 100644 --- a/Tests/UnitTestsParallelizable/ViewBase/ViewCommandTests.cs +++ b/Tests/UnitTestsParallelizable/ViewBase/ViewCommandTests.cs @@ -256,7 +256,7 @@ public class ViewCommandTests Assert.Equal (canFocus, view.CanFocus); Assert.False (view.HasFocus); - view.InvokeCommand (Command.Select); + view.InvokeCommand (Command.Activate); Assert.Equal (1, view.OnSelectingCount); @@ -271,8 +271,8 @@ public class ViewCommandTests var view = new ViewEventTester (); Assert.False (view.HasFocus); - view.HandleOnSelecting = true; - Assert.True (view.InvokeCommand (Command.Select)); + view.HandleOnActivating = true; + Assert.True (view.InvokeCommand (Command.Activate)); Assert.Equal (1, view.OnSelectingCount); @@ -285,9 +285,9 @@ public class ViewCommandTests var view = new View (); var selectingInvoked = false; - view.Selecting += ViewOnSelect; + view.Activating += ViewOnSelect; - bool? ret = view.InvokeCommand (Command.Select); + bool? ret = view.InvokeCommand (Command.Activate); Assert.True (ret); Assert.True (selectingInvoked); @@ -306,14 +306,14 @@ public class ViewCommandTests var view = new View (); var selecting = false; - view.Selecting += ViewOnSelecting; + view.Activating += ViewOnActivating; - view.InvokeCommand (Command.Select); + view.InvokeCommand (Command.Activate); Assert.True (selecting); return; - void ViewOnSelecting (object? sender, CommandEventArgs e) { selecting = true; } + void ViewOnActivating (object? sender, CommandEventArgs e) { selecting = true; } } [Fact] @@ -402,7 +402,7 @@ public class ViewCommandTests HandlingHotKeyCount++; }; - Selecting += (s, a) => + Activating += (s, a) => { a.Handled = HandleSelecting; SelectingCount++; @@ -445,16 +445,16 @@ public class ViewCommandTests public int OnSelectingCount { get; set; } public int SelectingCount { get; set; } - public bool HandleOnSelecting { get; set; } + public bool HandleOnActivating { get; set; } public bool HandleSelecting { get; set; } /// - protected override bool OnSelecting (CommandEventArgs args) + protected override bool OnActivating (CommandEventArgs args) { OnSelectingCount++; - return HandleOnSelecting; + return HandleOnActivating; } public int OnCommandNotBoundCount { get; set; } diff --git a/Tests/UnitTestsParallelizable/Views/AllViewsTests.cs b/Tests/UnitTestsParallelizable/Views/AllViewsTests.cs index 2aa9a09c0..c72f9ed2e 100644 --- a/Tests/UnitTestsParallelizable/Views/AllViewsTests.cs +++ b/Tests/UnitTestsParallelizable/Views/AllViewsTests.cs @@ -147,12 +147,12 @@ public class AllViewsTests (ITestOutputHelper output) : TestsAllViews } var selectingCount = 0; - view.Selecting += (s, e) => selectingCount++; + view.Activating += (s, e) => selectingCount++; var acceptedCount = 0; view.Accepting += (s, e) => { acceptedCount++; }; - if (view.InvokeCommand (Command.Select) == true) + if (view.InvokeCommand (Command.Activate) == true) { Assert.Equal (1, selectingCount); Assert.Equal (0, acceptedCount); @@ -179,7 +179,7 @@ public class AllViewsTests (ITestOutputHelper output) : TestsAllViews } var selectingCount = 0; - view.Selecting += (s, e) => selectingCount++; + view.Activating += (s, e) => selectingCount++; var acceptingCount = 0; view.Accepting += (s, e) => { acceptingCount++; }; diff --git a/Tests/UnitTestsParallelizable/Views/CheckBoxTests.cs b/Tests/UnitTestsParallelizable/Views/CheckBoxTests.cs index 047f2d8db..5778e8b0f 100644 --- a/Tests/UnitTestsParallelizable/Views/CheckBoxTests.cs +++ b/Tests/UnitTestsParallelizable/Views/CheckBoxTests.cs @@ -22,7 +22,7 @@ public class CheckBoxTests () ckb.CheckedStateChanging += (s, e) => checkedStateChangingCount++; var selectCount = 0; - ckb.Selecting += (s, e) => selectCount++; + ckb.Activating += (s, e) => selectCount++; var acceptCount = 0; ckb.Accepting += (s, e) => acceptCount++; @@ -250,7 +250,7 @@ public class CheckBoxTests () checkBox.CheckedStateChanging += (s, e) => checkedStateChangingCount++; var selectCount = 0; - checkBox.Selecting += (s, e) => selectCount++; + checkBox.Activating += (s, e) => selectCount++; var acceptCount = 0; checkBox.Accepting += (s, e) => acceptCount++; @@ -292,7 +292,7 @@ public class CheckBoxTests () checkBox.CheckedStateChanging += (s, e) => checkedStateChangingCount++; var selectCount = 0; - checkBox.Selecting += (s, e) => selectCount++; + checkBox.Activating += (s, e) => selectCount++; var acceptCount = 0; diff --git a/Tests/UnitTestsParallelizable/Views/ShortcutTests.cs b/Tests/UnitTestsParallelizable/Views/ShortcutTests.cs index 2e6bfe7fa..a653ed433 100644 --- a/Tests/UnitTestsParallelizable/Views/ShortcutTests.cs +++ b/Tests/UnitTestsParallelizable/Views/ShortcutTests.cs @@ -484,7 +484,7 @@ public class ShortcutTests }; var selected = 0; - shortcut.Selecting += (s, e) => selected++; + shortcut.Activating += (s, e) => selected++; app.Keyboard.RaiseKeyDownEvent (key); diff --git a/Tests/UnitTestsParallelizable/Views/TextFieldTests.cs b/Tests/UnitTestsParallelizable/Views/TextFieldTests.cs index bd49aa1d5..36d8d909e 100644 --- a/Tests/UnitTestsParallelizable/Views/TextFieldTests.cs +++ b/Tests/UnitTestsParallelizable/Views/TextFieldTests.cs @@ -49,7 +49,7 @@ public class TextFieldTests (ITestOutputHelper output) : FakeDriverBase { TextField tf = new (); - tf.Selecting += (sender, args) => Assert.Fail ("Selected should not be raied."); + tf.Activating += (sender, args) => Assert.Fail ("Selected should not be raied."); Runnable top = new (); top.Add (tf); @@ -65,7 +65,7 @@ public class TextFieldTests (ITestOutputHelper output) : FakeDriverBase TextField tf = new (); var selectingCount = 0; - tf.Selecting += (sender, args) => selectingCount++; + tf.Activating += (sender, args) => selectingCount++; Runnable top = new (); top.Add (tf);