MenuOpeningEventArgs.cs 1.1 KB

123456789101112131415161718192021222324252627
  1. #nullable disable
  2. namespace Terminal.Gui.Views;
  3. #pragma warning disable CS0618 // Type or member is obsolete
  4. /// <summary>
  5. /// An <see cref="EventArgs"/> which allows passing a cancelable menu opening event or replacing with a new
  6. /// <see cref="MenuBarItem"/>.
  7. /// </summary>
  8. public class MenuOpeningEventArgs : EventArgs
  9. {
  10. /// <summary>Initializes a new instance of <see cref="MenuOpeningEventArgs"/>.</summary>
  11. /// <param name="currentMenu">The current <see cref="MenuBarItem"/> parent.</param>
  12. public MenuOpeningEventArgs (MenuBarItem currentMenu) { CurrentMenu = currentMenu; }
  13. /// <summary>
  14. /// Flag that allows the cancellation of the event. If set to <see langword="true"/> in the event handler, the
  15. /// event will be canceled.
  16. /// </summary>
  17. public bool Cancel { get; set; }
  18. /// <summary>The current <see cref="MenuBarItem"/> parent.</summary>
  19. public MenuBarItem CurrentMenu { get; }
  20. /// <summary>The new <see cref="MenuBarItem"/> to be replaced.</summary>
  21. public MenuBarItem NewMenuBarItem { get; set; }
  22. }