MouseBinding.cs 917 B

12345678910111213141516171819202122232425262728293031
  1. #nullable enable
  2. namespace Terminal.Gui;
  3. /// <summary>
  4. /// Provides a collection of <see cref="Command"/> objects for mouse events.
  5. /// </summary>
  6. /// <seealso cref="Command"/>
  7. public record struct MouseBinding : IInputBinding
  8. {
  9. /// <summary>Initializes a new instance.</summary>
  10. /// <param name="commands">The commands this mouse binding will invoke.</param>
  11. /// <param name="mouseFlags">The mouse flags that trigger this binding.</param>
  12. public MouseBinding (Command [] commands, MouseFlags mouseFlags)
  13. {
  14. Commands = commands;
  15. MouseEventArgs = new MouseEventArgs()
  16. {
  17. Flags = mouseFlags
  18. };
  19. }
  20. /// <summary>The commands this key binding will invoke.</summary>
  21. public Command [] Commands { get; set; }
  22. /// <summary>
  23. /// The mouse event arguments.
  24. /// </summary>
  25. public MouseEventArgs? MouseEventArgs { get; set; }
  26. }