ToplevelEventArgs.cs 1.4 KB

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