From 0d9b1d96ea7d2bdc05b4603b657667f66b7df043 Mon Sep 17 00:00:00 2001 From: BDisp Date: Wed, 24 Jun 2020 17:47:42 +0100 Subject: [PATCH] Made changes as suggested. --- Terminal.Gui/Core/Responder.cs | 12 ------------ Terminal.Gui/Core/View.cs | 30 ++++++++++++++++++------------ 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/Terminal.Gui/Core/Responder.cs b/Terminal.Gui/Core/Responder.cs index d980c3261..c6fd75c74 100644 --- a/Terminal.Gui/Core/Responder.cs +++ b/Terminal.Gui/Core/Responder.cs @@ -164,18 +164,6 @@ namespace Terminal.Gui { return false; } - /// - /// Method invoked when a view is added. - /// - /// The view added. - public virtual void OnAddedView (View view) { } - - /// - /// Method invoked when a view being removing. - /// - /// The view being removing. - public virtual void OnRemovingView (View view) { } - /// /// Method invoked when a view gets focus. /// diff --git a/Terminal.Gui/Core/View.cs b/Terminal.Gui/Core/View.cs index c0b1e8c20..8fc7a436e 100644 --- a/Terminal.Gui/Core/View.cs +++ b/Terminal.Gui/Core/View.cs @@ -125,14 +125,14 @@ namespace Terminal.Gui { TextFormatter viewText; /// - /// Event fired when the view is added. + /// Event fired when a subview is being added to this view. /// - public Action AddedView; + public Action Adding; /// - /// Event fired when the view is being removing. + /// Event fired when a subview is being removed from this view. /// - public Action RemovingView; + public Action Removing; /// /// Event fired when the view gets focus. @@ -562,7 +562,7 @@ namespace Terminal.Gui { subviews = new List (); 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; } } - /// - public override void OnAddedView (View view) + /// + /// Method invoked when a subview is being added to this view. + /// + /// The subview being added. + public virtual void OnAdding (View view) { - AddedView?.Invoke (view); + Adding?.Invoke (view); } - /// - public override void OnRemovingView (View view) + /// + /// Method invoked when a subview is being removed from this view. + /// + /// The subview being removed. + public virtual void OnRemoving (View view) { - RemovingView?.Invoke (view); + Removing?.Invoke (view); } ///