MenuClosingEventArgs.cs 1.3 KB

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