MenuOpeningEventArgs.cs 1.0 KB

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