MenuClosingEventArgs.cs 1.3 KB

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