MenuClosingEventArgs.cs 1.2 KB

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