Made changes as suggested.

This commit is contained in:
BDisp
2020-06-24 17:47:42 +01:00
parent fa96f467cc
commit 0d9b1d96ea
2 changed files with 18 additions and 24 deletions

View File

@@ -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>

View File

@@ -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/>