ToplevelEventArgs.cs 1.4 KB

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