MouseEventArgs.cs 1.5 KB

12345678910111213141516171819202122232425262728293031
  1. using System.ComponentModel;
  2. namespace Terminal.Gui;
  3. /// <summary>
  4. /// Specifies the event arguments for <see cref="Terminal.Gui.MouseEventArgs"/>. This is a higher-level construct than
  5. /// the wrapped <see cref="Terminal.Gui.MouseEventArgs"/> class and is used for the events defined on <see cref="View"/> and subclasses
  6. /// of View (e.g. <see cref="View.MouseEnter"/> and <see cref="View.MouseClick"/>).
  7. /// </summary>
  8. public class MouseEventArgs : HandledEventArgs
  9. {
  10. /// <summary>
  11. /// Flags indicating the state of the mouse buttons and the type of event that occurred.
  12. /// </summary>
  13. public MouseFlags Flags { get; set; }
  14. /// <summary>
  15. /// The screen-relative mouse position.
  16. /// </summary>
  17. public Point ScreenPosition { get; set; }
  18. /// <summary>The deepest View who's <see cref="View.Frame"/> contains <see cref="ScreenPosition"/>.</summary>
  19. public View View { get; set; }
  20. /// <summary>The position of the mouse in <see cref="View"/>'s Viewport-relative coordinates. Only valid if <see cref="View"/> is set.</summary>
  21. public Point Position { get; set; }
  22. /// <summary>Returns a <see cref="T:System.String"/> that represents the current <see cref="Terminal.Gui.MouseEventArgs"/>.</summary>
  23. /// <returns>A <see cref="T:System.String"/> that represents the current <see cref="Terminal.Gui.MouseEventArgs"/>.</returns>
  24. public override string ToString () { return $"({ScreenPosition}):{Flags}:{View.Id}:{Position}"; }
  25. }