MenuClosingEventArgs.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. namespace Terminal.Gui {
  3. /// <summary>
  4. /// An <see cref="EventArgs"/> which allows passing a cancelable menu closing event.
  5. /// </summary>
  6. public class MenuClosingEventArgs : EventArgs {
  7. /// <summary>
  8. /// The current <see cref="MenuBarItem"/> parent.
  9. /// </summary>
  10. public MenuBarItem CurrentMenu { get; }
  11. /// <summary>
  12. /// Indicates whether the current menu will reopen.
  13. /// </summary>
  14. public bool Reopen { get; }
  15. /// <summary>
  16. /// Indicates whether the current menu is a sub-menu.
  17. /// </summary>
  18. public bool IsSubMenu { get; }
  19. /// <summary>
  20. /// Flag that allows the cancellation of the event. If set to <see langword="true"/> in the
  21. /// event handler, the event will be canceled.
  22. /// </summary>
  23. public bool Cancel { get; set; }
  24. /// <summary>
  25. /// Initializes a new instance of <see cref="MenuClosingEventArgs"/>.
  26. /// </summary>
  27. /// <param name="currentMenu">The current <see cref="MenuBarItem"/> parent.</param>
  28. /// <param name="reopen">Whether the current menu will reopen.</param>
  29. /// <param name="isSubMenu">Indicates whether it is a sub-menu.</param>
  30. public MenuClosingEventArgs (MenuBarItem currentMenu, bool reopen, bool isSubMenu)
  31. {
  32. CurrentMenu = currentMenu;
  33. Reopen = reopen;
  34. IsSubMenu = isSubMenu;
  35. }
  36. }
  37. }