Pārlūkot izejas kodu

Change some Action and Class names.

BDisp 5 gadi atpakaļ
vecāks
revīzija
6eeb3149b9

+ 2 - 2
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}";
 		}

+ 8 - 8
Terminal.Gui/Core/View.cs

@@ -134,17 +134,17 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// Event fired when the view receives the mouse event for the first time.
 		/// </summary>
-		public Action<MouseEventEventArgs> MouseEnter;
+		public Action<MouseEventArgs> MouseEnter;
 
 		/// <summary>
 		/// Event fired when the view receives a mouse event for the last time.
 		/// </summary>
-		public Action<MouseEventEventArgs> MouseLeave;
+		public Action<MouseEventArgs> MouseLeave;
 
 		/// <summary>
 		/// Event fired when a mouse event is generated.
 		/// </summary>
-		public Action<MouseEventEventArgs> MouseClick;
+		public Action<MouseEventArgs> MouseClick;
 
 		internal Direction FocusDirection {
 			get => SuperView?.FocusDirection ?? focusDirection;
@@ -1462,12 +1462,12 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// Specifies the event arguments for <see cref="MouseEvent"/>
 		/// </summary>
-		public class MouseEventEventArgs : EventArgs {
+		public class MouseEventArgs : EventArgs {
 			/// <summary>
 			/// Constructs.
 			/// </summary>
 			/// <param name="me"></param>
-			public MouseEventEventArgs (MouseEvent me) => MouseEvent = me;
+			public MouseEventArgs (MouseEvent me) => MouseEvent = me;
 			/// <summary>
 			/// The <see cref="MouseEvent"/> for the event.
 			/// </summary>
@@ -1482,7 +1482,7 @@ namespace Terminal.Gui {
 		/// <inheritdoc/>
 		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 {
 		/// <inheritdoc/>
 		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 {
 		/// <returns><c>true</c>, if the event was handled, <c>false</c> otherwise.</returns>
 		public virtual bool OnMouseEvent (MouseEvent mouseEvent)
 		{
-			MouseEventEventArgs args = new MouseEventEventArgs (mouseEvent);
+			MouseEventArgs args = new MouseEventArgs (mouseEvent);
 			MouseClick?.Invoke (args);
 			if (args.Handled)
 				return true;

+ 2 - 2
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.
 		/// </remarks>
-		public Action<ustring> Changed;
+		public Action<ustring> SelectedItemChanged;
 
 		IList<string> listsource;
 		IList<string> searchset;
@@ -139,7 +139,7 @@ namespace Terminal.Gui {
 			listsource = new List<string> (source);
 		}
 
-		private void Search_MouseClick (object sender, MouseEventEventArgs e)
+		private void Search_MouseClick (object sender, MouseEventArgs e)
 		{
 			if (e.MouseEvent.Flags != MouseFlags.Button1Clicked)
 				return;

+ 1 - 1
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)

+ 2 - 2
Terminal.Gui/Views/ListView.cs

@@ -307,7 +307,7 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// This event is raised when the selected item in the <see cref="ListView"/> has changed.
 		/// </summary>
-		public Action<ListViewItemEventArgs> SelectedChanged;
+		public Action<ListViewItemEventArgs> SelectedItemChanged;
 
 		/// <summary>
 		/// 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;
 			}

+ 2 - 2
Terminal.Gui/Views/RadioGroup.cs

@@ -127,7 +127,7 @@ namespace Terminal.Gui {
 		/// <summary>
 		/// Invoked when the selected radio label has changed
 		/// </summary>
-		public Action<int> SelectionChanged;
+		public Action<int> SelectedItemChanged;
 
 		/// <summary>
 		/// 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 ();
 			}
 		}

+ 2 - 2
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);
 		}

+ 2 - 2
Terminal.Gui/Views/TextField.cs

@@ -41,7 +41,7 @@ namespace Terminal.Gui {
 		/// <remarks>
 		///   The passed <see cref="EventArgs"/> is a <see cref="ustring"/> containing the old value. 
 		/// </remarks>
-		public Action<ustring> Changed;
+		public Action<ustring> TextChanged;
 
 		/// <summary>
 		/// Initializes a new instance of the <see cref="TextField"/> class using <see cref="LayoutStyle.Computed"/> 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);

+ 1 - 1
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)

+ 9 - 9
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);
 

+ 1 - 1
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;

+ 2 - 2
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;

+ 1 - 1
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") {