From 6eeb3149b99f264b5fa072aec08382639fa56063 Mon Sep 17 00:00:00 2001 From: BDisp Date: Sat, 6 Jun 2020 23:01:35 +0100 Subject: [PATCH] Change some Action and Class names. --- Designer/Program.cs | 4 ++-- Terminal.Gui/Core/View.cs | 16 ++++++++-------- Terminal.Gui/Views/ComboBox.cs | 4 ++-- Terminal.Gui/Views/DateField.cs | 2 +- Terminal.Gui/Views/ListView.cs | 4 ++-- Terminal.Gui/Views/RadioGroup.cs | 4 ++-- Terminal.Gui/Views/ScrollView.cs | 4 ++-- Terminal.Gui/Views/TextField.cs | 4 ++-- Terminal.Gui/Views/TimeField.cs | 2 +- UICatalog/Scenarios/AllViewsTester.cs | 18 +++++++++--------- UICatalog/Scenarios/Buttons.cs | 2 +- UICatalog/Scenarios/Progress.cs | 4 ++-- UICatalog/UICatalog.cs | 2 +- 13 files changed, 35 insertions(+), 35 deletions(-) diff --git a/Designer/Program.cs b/Designer/Program.cs index 143159350..139e3b986 100644 --- a/Designer/Program.cs +++ b/Designer/Program.cs @@ -122,12 +122,12 @@ namespace Designer { view.Text = $"Entering in: {view}"; } - private static void Text_MouseLeave (View.MouseEventEventArgs e, TextField view) + private static void Text_MouseLeave (View.MouseEventArgs e, TextField view) { view.Text = $"Mouse leave at X: {e.MouseEvent.X}; Y: {e.MouseEvent.Y} HasFocus: {e.MouseEvent.View.HasFocus}"; } - private static void Text_MouseEnter (View.MouseEventEventArgs e, TextField view) + private static void Text_MouseEnter (View.MouseEventArgs e, TextField view) { view.Text = $"Mouse enter at X: {e.MouseEvent.X}; Y: {e.MouseEvent.Y} HasFocus: {e.MouseEvent.View.HasFocus}"; } diff --git a/Terminal.Gui/Core/View.cs b/Terminal.Gui/Core/View.cs index 109f072ed..6ac03c572 100644 --- a/Terminal.Gui/Core/View.cs +++ b/Terminal.Gui/Core/View.cs @@ -134,17 +134,17 @@ namespace Terminal.Gui { /// /// Event fired when the view receives the mouse event for the first time. /// - public Action MouseEnter; + public Action MouseEnter; /// /// Event fired when the view receives a mouse event for the last time. /// - public Action MouseLeave; + public Action MouseLeave; /// /// Event fired when a mouse event is generated. /// - public Action MouseClick; + public Action MouseClick; internal Direction FocusDirection { get => SuperView?.FocusDirection ?? focusDirection; @@ -1462,12 +1462,12 @@ namespace Terminal.Gui { /// /// Specifies the event arguments for /// - public class MouseEventEventArgs : EventArgs { + public class MouseEventArgs : EventArgs { /// /// Constructs. /// /// - public MouseEventEventArgs (MouseEvent me) => MouseEvent = me; + public MouseEventArgs (MouseEvent me) => MouseEvent = me; /// /// The for the event. /// @@ -1482,7 +1482,7 @@ namespace Terminal.Gui { /// public override bool OnMouseEnter (MouseEvent mouseEvent) { - MouseEventEventArgs args = new MouseEventEventArgs (mouseEvent); + MouseEventArgs args = new MouseEventArgs (mouseEvent); MouseEnter?.Invoke (args); if (args.Handled) return true; @@ -1495,7 +1495,7 @@ namespace Terminal.Gui { /// public override bool OnMouseLeave (MouseEvent mouseEvent) { - MouseEventEventArgs args = new MouseEventEventArgs (mouseEvent); + MouseEventArgs args = new MouseEventArgs (mouseEvent); MouseLeave?.Invoke (args); if (args.Handled) return true; @@ -1513,7 +1513,7 @@ namespace Terminal.Gui { /// true, if the event was handled, false otherwise. public virtual bool OnMouseEvent (MouseEvent mouseEvent) { - MouseEventEventArgs args = new MouseEventEventArgs (mouseEvent); + MouseEventArgs args = new MouseEventArgs (mouseEvent); MouseClick?.Invoke (args); if (args.Handled) return true; diff --git a/Terminal.Gui/Views/ComboBox.cs b/Terminal.Gui/Views/ComboBox.cs index 712b287ae..3b11ed724 100644 --- a/Terminal.Gui/Views/ComboBox.cs +++ b/Terminal.Gui/Views/ComboBox.cs @@ -22,7 +22,7 @@ namespace Terminal.Gui { /// Client code can hook up to this event, it is /// raised when the selection has been confirmed. /// - public Action Changed; + public Action SelectedItemChanged; IList listsource; IList searchset; @@ -139,7 +139,7 @@ namespace Terminal.Gui { listsource = new List (source); } - private void Search_MouseClick (object sender, MouseEventEventArgs e) + private void Search_MouseClick (object sender, MouseEventArgs e) { if (e.MouseEvent.Flags != MouseFlags.Button1Clicked) return; diff --git a/Terminal.Gui/Views/DateField.cs b/Terminal.Gui/Views/DateField.cs index 297c0d32c..235440510 100644 --- a/Terminal.Gui/Views/DateField.cs +++ b/Terminal.Gui/Views/DateField.cs @@ -77,7 +77,7 @@ namespace Terminal.Gui { shortFormat = GetShortFormat (longFormat); CursorPosition = 1; Date = date; - Changed += DateField_Changed; + TextChanged += DateField_Changed; } void DateField_Changed (ustring e) diff --git a/Terminal.Gui/Views/ListView.cs b/Terminal.Gui/Views/ListView.cs index dc60c99fa..f4daf0472 100644 --- a/Terminal.Gui/Views/ListView.cs +++ b/Terminal.Gui/Views/ListView.cs @@ -307,7 +307,7 @@ namespace Terminal.Gui { /// /// This event is raised when the selected item in the has changed. /// - public Action SelectedChanged; + public Action SelectedItemChanged; /// /// This event is raised when the user Double Clicks on an item or presses ENTER to open the selected item. @@ -469,7 +469,7 @@ namespace Terminal.Gui { { if (selected != lastSelectedItem) { var value = source.ToList () [selected]; - SelectedChanged?.Invoke (new ListViewItemEventArgs (selected, value)); + SelectedItemChanged?.Invoke (new ListViewItemEventArgs (selected, value)); lastSelectedItem = selected; return true; } diff --git a/Terminal.Gui/Views/RadioGroup.cs b/Terminal.Gui/Views/RadioGroup.cs index 88b8b12c9..8db6c07ea 100644 --- a/Terminal.Gui/Views/RadioGroup.cs +++ b/Terminal.Gui/Views/RadioGroup.cs @@ -127,7 +127,7 @@ namespace Terminal.Gui { /// /// Invoked when the selected radio label has changed /// - public Action SelectionChanged; + public Action SelectedItemChanged; /// /// The currently selected item from the list of radio labels @@ -137,7 +137,7 @@ namespace Terminal.Gui { get => selected; set { selected = value; - SelectionChanged?.Invoke (selected); + SelectedItemChanged?.Invoke (selected); SetNeedsDisplay (); } } diff --git a/Terminal.Gui/Views/ScrollView.cs b/Terminal.Gui/Views/ScrollView.cs index e4900c877..0857380bb 100644 --- a/Terminal.Gui/Views/ScrollView.cs +++ b/Terminal.Gui/Views/ScrollView.cs @@ -389,12 +389,12 @@ namespace Terminal.Gui { SetNeedsLayout (); } - void View_MouseLeave (MouseEventEventArgs e) + void View_MouseLeave (MouseEventArgs e) { Application.UngrabMouse (); } - void View_MouseEnter (MouseEventEventArgs e) + void View_MouseEnter (MouseEventArgs e) { Application.GrabMouse (this); } diff --git a/Terminal.Gui/Views/TextField.cs b/Terminal.Gui/Views/TextField.cs index 18833c012..6f709af3b 100644 --- a/Terminal.Gui/Views/TextField.cs +++ b/Terminal.Gui/Views/TextField.cs @@ -41,7 +41,7 @@ namespace Terminal.Gui { /// /// The passed is a containing the old value. /// - public Action Changed; + public Action TextChanged; /// /// Initializes a new instance of the class using positioning. @@ -145,7 +145,7 @@ namespace Terminal.Gui { historyText.Add (ustring.Make (text)); idxhistoryText++; } - Changed?.Invoke (oldText); + TextChanged?.Invoke (oldText); if (point > text.Count) point = Math.Max (DisplaySize (text, 0) - 1, 0); diff --git a/Terminal.Gui/Views/TimeField.cs b/Terminal.Gui/Views/TimeField.cs index a5cb59b5f..efe8e6ee2 100644 --- a/Terminal.Gui/Views/TimeField.cs +++ b/Terminal.Gui/Views/TimeField.cs @@ -77,7 +77,7 @@ namespace Terminal.Gui { shortFormat = $" hh\\{sepChar}mm"; CursorPosition = 1; Time = time; - Changed += TimeField_Changed; + TextChanged += TimeField_Changed; } void TimeField_Changed (ustring e) diff --git a/UICatalog/Scenarios/AllViewsTester.cs b/UICatalog/Scenarios/AllViewsTester.cs index bcee24f6f..e74821e0f 100644 --- a/UICatalog/Scenarios/AllViewsTester.cs +++ b/UICatalog/Scenarios/AllViewsTester.cs @@ -94,7 +94,7 @@ namespace UICatalog { _classListView.OpenSelectedItem += (a) => { Top.SetFocus (_settingsPane); }; - _classListView.SelectedChanged += (args) => { + _classListView.SelectedItemChanged += (args) => { ClearClass (_curView); _curView = CreateClass (_viewClasses.Values.ToArray () [_classListView.SelectedItem]); }; @@ -131,10 +131,10 @@ namespace UICatalog { _xRadioGroup = new RadioGroup (radioItems) { X = 0, Y = Pos.Bottom (label), - SelectionChanged = (selected) => DimPosChanged (_curView), + SelectedItemChanged = (selected) => DimPosChanged (_curView), }; _xText = new TextField ($"{_xVal}") { X = Pos.Right (label) + 1, Y = 0, Width = 4 }; - _xText.Changed += (args) => { + _xText.TextChanged += (args) => { try { _xVal = int.Parse (_xText.Text.ToString ()); DimPosChanged (_curView); @@ -150,7 +150,7 @@ namespace UICatalog { label = new Label ("y:") { X = Pos.Right (_xRadioGroup) + 1, Y = 0 }; _locationFrame.Add (label); _yText = new TextField ($"{_yVal}") { X = Pos.Right (label) + 1, Y = 0, Width = 4 }; - _yText.Changed += (args) => { + _yText.TextChanged += (args) => { try { _yVal = int.Parse (_yText.Text.ToString ()); DimPosChanged (_curView); @@ -162,7 +162,7 @@ namespace UICatalog { _yRadioGroup = new RadioGroup (radioItems) { X = Pos.X (label), Y = Pos.Bottom (label), - SelectionChanged = (selected) => DimPosChanged (_curView), + SelectedItemChanged = (selected) => DimPosChanged (_curView), }; _locationFrame.Add (_yRadioGroup); @@ -179,10 +179,10 @@ namespace UICatalog { _wRadioGroup = new RadioGroup (radioItems) { X = 0, Y = Pos.Bottom (label), - SelectionChanged = (selected) => DimPosChanged (_curView) + SelectedItemChanged = (selected) => DimPosChanged (_curView) }; _wText = new TextField ($"{_wVal}") { X = Pos.Right (label) + 1, Y = 0, Width = 4 }; - _wText.Changed += (args) => { + _wText.TextChanged += (args) => { try { _wVal = int.Parse (_wText.Text.ToString ()); DimPosChanged (_curView); @@ -197,7 +197,7 @@ namespace UICatalog { label = new Label ("height:") { X = Pos.Right (_wRadioGroup) + 1, Y = 0 }; _sizeFrame.Add (label); _hText = new TextField ($"{_hVal}") { X = Pos.Right (label) + 1, Y = 0, Width = 4 }; - _hText.Changed += (args) => { + _hText.TextChanged += (args) => { try { _hVal = int.Parse (_hText.Text.ToString ()); DimPosChanged (_curView); @@ -210,7 +210,7 @@ namespace UICatalog { _hRadioGroup = new RadioGroup (radioItems) { X = Pos.X (label), Y = Pos.Bottom (label), - SelectionChanged = (selected) => DimPosChanged (_curView), + SelectedItemChanged = (selected) => DimPosChanged (_curView), }; _sizeFrame.Add (_hRadioGroup); diff --git a/UICatalog/Scenarios/Buttons.cs b/UICatalog/Scenarios/Buttons.cs index b494dd5b4..c6176d198 100644 --- a/UICatalog/Scenarios/Buttons.cs +++ b/UICatalog/Scenarios/Buttons.cs @@ -149,7 +149,7 @@ namespace UICatalog { ColorScheme = Colors.TopLevel }; - lvTextAlig.SelectedChanged += (e) => { + lvTextAlig.SelectedItemChanged += (e) => { switch (e.Value) { case "Left": sizeBtn.TextAlignment = TextAlignment.Left; diff --git a/UICatalog/Scenarios/Progress.cs b/UICatalog/Scenarios/Progress.cs index c763375b3..845f381fb 100644 --- a/UICatalog/Scenarios/Progress.cs +++ b/UICatalog/Scenarios/Progress.cs @@ -167,7 +167,7 @@ namespace UICatalog { systemTimerDemo.PulseProgressBar.Fraction = 1F; }; systemTimerDemo.Speed.Text = $"{_systemTimerTick}"; - systemTimerDemo.Speed.Changed += (a) => { + systemTimerDemo.Speed.TextChanged += (a) => { uint result; if (uint.TryParse (systemTimerDemo.Speed.Text.ToString(), out result)) { _systemTimerTick = result; @@ -210,7 +210,7 @@ namespace UICatalog { }; mainLoopTimeoutDemo.Speed.Text = $"{_mainLooopTimeoutTick}"; - mainLoopTimeoutDemo.Speed.Changed += (a) => { + mainLoopTimeoutDemo.Speed.TextChanged += (a) => { uint result; if (uint.TryParse (mainLoopTimeoutDemo.Speed.Text.ToString (), out result)) { _mainLooopTimeoutTick = result; diff --git a/UICatalog/UICatalog.cs b/UICatalog/UICatalog.cs index e65cde97c..f4cf3cba4 100644 --- a/UICatalog/UICatalog.cs +++ b/UICatalog/UICatalog.cs @@ -195,7 +195,7 @@ namespace UICatalog { _categoryListView.OpenSelectedItem += (a) => { _top.SetFocus (_rightPane); }; - _categoryListView.SelectedChanged += CategoryListView_SelectedChanged; + _categoryListView.SelectedItemChanged += CategoryListView_SelectedChanged; _leftPane.Add (_categoryListView); _rightPane = new Window ("Scenarios") {