Przeglądaj źródła

Made changes as suggested.

BDisp 5 lat temu
rodzic
commit
0d9b1d96ea
2 zmienionych plików z 18 dodań i 24 usunięć
  1. 0 12
      Terminal.Gui/Core/Responder.cs
  2. 18 12
      Terminal.Gui/Core/View.cs

+ 0 - 12
Terminal.Gui/Core/Responder.cs

@@ -164,18 +164,6 @@ namespace Terminal.Gui {
 			return false;
 		}
 
-		/// <summary>
-		/// Method invoked when a view is added.
-		/// </summary>
-		/// <param name="view">The view added.</param>
-		public virtual void OnAddedView (View view) { }
-
-		/// <summary>
-		/// Method invoked when a view being removing.
-		/// </summary>
-		/// <param name="view">The view being removing.</param>
-		public virtual void OnRemovingView (View view) { }
-
 		/// <summary>
 		/// Method invoked when a view gets focus.
 		/// </summary>

+ 18 - 12
Terminal.Gui/Core/View.cs

@@ -125,14 +125,14 @@ namespace Terminal.Gui {
 		TextFormatter viewText;
 
 		/// <summary>
-		/// Event fired when the view is added.
+		/// Event fired when a subview is being added to this view.
 		/// </summary>
-		public Action<View> AddedView;
+		public Action<View> Adding;
 
 		/// <summary>
-		/// Event fired when the view is being removing.
+		/// Event fired when a subview is being removed from this view.
 		/// </summary>
-		public Action<View> RemovingView;
+		public Action<View> Removing;
 
 		/// <summary>
 		/// Event fired when the view gets focus.
@@ -562,7 +562,7 @@ namespace Terminal.Gui {
 				subviews = new List<View> ();
 			subviews.Add (view);
 			view.container = this;
-			OnAddedView (view);
+			OnAdding (view);
 			if (view.CanFocus)
 				CanFocus = true;
 			SetNeedsLayout ();
@@ -607,7 +607,7 @@ namespace Terminal.Gui {
 			if (view == null || subviews == null)
 				return;
 
-			OnRemovingView (view);
+			OnRemoving (view);
 			SetNeedsLayout ();
 			SetNeedsDisplay ();
 			var touched = view.Frame;
@@ -945,16 +945,22 @@ namespace Terminal.Gui {
 			public bool Handled { get; set; }
 		}
 
-		/// <inheritdoc/>
-		public override void OnAddedView (View view)
+		/// <summary>
+		/// Method invoked  when a subview is being added to this view.
+		/// </summary>
+		/// <param name="view">The subview being added.</param>
+		public virtual void OnAdding (View view)
 		{
-			AddedView?.Invoke (view);
+			Adding?.Invoke (view);
 		}
 
-		/// <inheritdoc/>
-		public override void OnRemovingView (View view)
+		/// <summary>
+		/// Method invoked when a subview is being removed from this view.
+		/// </summary>
+		/// <param name="view">The subview being removed.</param>
+		public virtual void OnRemoving (View view)
 		{
-			RemovingView?.Invoke (view);
+			Removing?.Invoke (view);
 		}
 
 		/// <inheritdoc/>