diff --git a/Terminal.Gui/Views/Toplevel.cs b/Terminal.Gui/Views/Toplevel.cs index aab3b6b9d..feaf1e185 100644 --- a/Terminal.Gui/Views/Toplevel.cs +++ b/Terminal.Gui/Views/Toplevel.cs @@ -76,29 +76,6 @@ public partial class Toplevel : View /// Gets the latest added into this Toplevel. public StatusBar? StatusBar => (StatusBar?)Subviews?.LastOrDefault (s => s is StatusBar); - - // TODO: Overlapped - Rename to AllSubviewsClosed - Move to View? - /// - /// Invoked when the last child of the Toplevel is closed from by - /// . - /// - public event EventHandler? AllChildClosed; - - // TODO: Overlapped - Rename to *Subviews* - Move to View? - /// - /// Invoked when a child of the Toplevel is closed by - /// . - /// - public event EventHandler? ChildClosed; - - // TODO: Overlapped - Rename to *Subviews* - Move to View? - /// Invoked when a child Toplevel's has been loaded. - public event EventHandler? ChildLoaded; - - // TODO: Overlapped - Rename to *Subviews* - Move to View? - /// Invoked when a cjhild Toplevel's has been unloaded. - public event EventHandler? ChildUnloaded; - #endregion #region Life Cycle @@ -186,23 +163,6 @@ public partial class Toplevel : View internal virtual void OnActivate (Toplevel deactivated) { Activate?.Invoke (this, new (deactivated)); } - /// - /// Stops and closes the specified by . If is - /// the top-most Toplevel, will be called, causing the application to - /// exit. - /// - /// The Toplevel to request stop. - //public virtual void RequestStop (Toplevel top) { top.RequestStop (); } - - internal virtual void OnAllChildClosed () { AllChildClosed?.Invoke (this, EventArgs.Empty); } - - internal virtual void OnChildClosed (Toplevel top) - { - ChildClosed?.Invoke (this, new (top)); - } - - internal virtual void OnChildLoaded (Toplevel top) { ChildLoaded?.Invoke (this, new (top)); } - internal virtual void OnChildUnloaded (Toplevel top) { ChildUnloaded?.Invoke (this, new (top)); } internal virtual void OnClosed (Toplevel top) { Closed?.Invoke (this, new (top)); } internal virtual bool OnClosing (ToplevelClosingEventArgs ev) @@ -242,41 +202,7 @@ public partial class Toplevel : View } #endregion - - #region Draw - - ///// - //public override void OnDrawContent (Rectangle viewport) - //{ - // if (!Visible) - // { - // return; - // } - - // if (NeedsDisplay || SubViewNeedsDisplay /*|| LayoutNeeded*/) - // { - // Clear (); - - // //LayoutSubviews (); - // //PositionToplevels (); - - // // BUGBUG: This appears to be a hack to get ScrollBarViews to render correctly. - // foreach (View view in Subviews) - // { - // if (view.Frame.IntersectsWith (Viewport) && !OutsideTopFrame (this)) - // { - // //view.SetNeedsLayout (); - // view.SetNeedsDisplay (); - // view.SetSubViewNeedsDisplay (); - // } - // } - - // base.OnDrawContent (viewport); - // } - //} - - #endregion - + #region Size / Position Management // TODO: Make cancelable? @@ -359,16 +285,6 @@ public partial class Toplevel : View /// Invoked when the terminal has been resized. The new of the terminal is provided. public event EventHandler? SizeChanging; - private bool OutsideTopFrame (Toplevel top) - { - if (top.Frame.X > Driver.Cols || top.Frame.Y > Driver.Rows) - { - return true; - } - - return false; - } - #endregion } diff --git a/UnitTests/Views/ToplevelTests.cs b/UnitTests/Views/ToplevelTests.cs index 844450abd..21ecde738 100644 --- a/UnitTests/Views/ToplevelTests.cs +++ b/UnitTests/Views/ToplevelTests.cs @@ -33,30 +33,6 @@ public partial class ToplevelTests (ITestOutputHelper output) var eventInvoked = ""; - top.ChildUnloaded += (s, e) => eventInvoked = "ChildUnloaded"; - top.OnChildUnloaded (top); - Assert.Equal ("ChildUnloaded", eventInvoked); - top.ChildLoaded += (s, e) => eventInvoked = "ChildLoaded"; - top.OnChildLoaded (top); - Assert.Equal ("ChildLoaded", eventInvoked); - top.Closed += (s, e) => eventInvoked = "Closed"; - top.OnClosed (top); - Assert.Equal ("Closed", eventInvoked); - top.Closing += (s, e) => eventInvoked = "Closing"; - top.OnClosing (new (top)); - Assert.Equal ("Closing", eventInvoked); - top.AllChildClosed += (s, e) => eventInvoked = "AllChildClosed"; - top.OnAllChildClosed (); - Assert.Equal ("AllChildClosed", eventInvoked); - top.ChildClosed += (s, e) => eventInvoked = "ChildClosed"; - top.OnChildClosed (top); - Assert.Equal ("ChildClosed", eventInvoked); - top.Deactivate += (s, e) => eventInvoked = "Deactivate"; - top.OnDeactivate (top); - Assert.Equal ("Deactivate", eventInvoked); - top.Activate += (s, e) => eventInvoked = "Activate"; - top.OnActivate (top); - Assert.Equal ("Activate", eventInvoked); top.Loaded += (s, e) => eventInvoked = "Loaded"; top.OnLoaded (); Assert.Equal ("Loaded", eventInvoked);