|
@@ -124,6 +124,16 @@ namespace Terminal.Gui {
|
|
|
|
|
|
TextFormatter viewText;
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Event fired when the view is added.
|
|
|
+ /// </summary>
|
|
|
+ public Action<View> AddedView;
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Event fired when the view is being removing.
|
|
|
+ /// </summary>
|
|
|
+ public Action<View> RemovingView;
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// Event fired when the view gets focus.
|
|
|
/// </summary>
|
|
@@ -552,6 +562,7 @@ namespace Terminal.Gui {
|
|
|
subviews = new List<View> ();
|
|
|
subviews.Add (view);
|
|
|
view.container = this;
|
|
|
+ OnAddedView (view);
|
|
|
if (view.CanFocus)
|
|
|
CanFocus = true;
|
|
|
SetNeedsLayout ();
|
|
@@ -596,6 +607,7 @@ namespace Terminal.Gui {
|
|
|
if (view == null || subviews == null)
|
|
|
return;
|
|
|
|
|
|
+ OnRemovingView (view);
|
|
|
SetNeedsLayout ();
|
|
|
SetNeedsDisplay ();
|
|
|
var touched = view.Frame;
|
|
@@ -933,6 +945,20 @@ namespace Terminal.Gui {
|
|
|
public bool Handled { get; set; }
|
|
|
}
|
|
|
|
|
|
+ /// <inheritdoc/>
|
|
|
+ public override void OnAddedView (View view)
|
|
|
+ {
|
|
|
+ AddedView?.Invoke (view);
|
|
|
+ base.OnAddedView (view);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <inheritdoc/>
|
|
|
+ public override void OnRemovingView (View view)
|
|
|
+ {
|
|
|
+ RemovingView?.Invoke (view);
|
|
|
+ base.OnRemovingView (view);
|
|
|
+ }
|
|
|
+
|
|
|
/// <inheritdoc/>
|
|
|
public override bool OnEnter ()
|
|
|
{
|