ToplevelEventArgs.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. #nullable disable
  2. 
  3. namespace Terminal.Gui.Views;
  4. /// <summary>Args for events that relate to a specific <see cref="Toplevel"/>.</summary>
  5. public class ToplevelEventArgs : EventArgs
  6. {
  7. /// <summary>Creates a new instance of the <see cref="ToplevelClosingEventArgs"/> class.</summary>
  8. /// <param name="toplevel"></param>
  9. public ToplevelEventArgs (Toplevel toplevel) { Toplevel = toplevel; }
  10. /// <summary>Gets the <see cref="Toplevel"/> that the event is about.</summary>
  11. /// <remarks>
  12. /// This is usually but may not always be the same as the sender in <see cref="EventHandler"/>. For example if
  13. /// the reported event is about a different <see cref="Toplevel"/> or the event is raised by a separate class.
  14. /// </remarks>
  15. public Toplevel Toplevel { get; }
  16. }
  17. /// <summary><see cref="EventArgs"/> implementation for the <see cref="Toplevel.Closing"/> event.</summary>
  18. public class ToplevelClosingEventArgs : EventArgs
  19. {
  20. /// <summary>Initializes the event arguments with the requesting Toplevel.</summary>
  21. /// <param name="requestingTop">The <see cref="RequestingTop"/>.</param>
  22. public ToplevelClosingEventArgs (Toplevel requestingTop) { RequestingTop = requestingTop; }
  23. /// <summary>Provides an event cancellation option.</summary>
  24. public bool Cancel { get; set; }
  25. /// <summary>The Toplevel requesting stop.</summary>
  26. public View RequestingTop { get; }
  27. }