ToplevelEventArgs.cs 1.5 KB

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