namespace Terminal.Gui; /// Mouse flags reported in . /// They just happen to map to the ncurses ones. [Flags] public enum MouseFlags { /// The first mouse button was pressed. Button1Pressed = 0x2, /// The first mouse button was released. Button1Released = 0x1, /// The first mouse button was clicked (press+release). Button1Clicked = 0x4, /// The first mouse button was double-clicked. Button1DoubleClicked = 0x8, /// The first mouse button was triple-clicked. Button1TripleClicked = 0x10, /// The second mouse button was pressed. Button2Pressed = 0x80, /// The second mouse button was released. Button2Released = 0x40, /// The second mouse button was clicked (press+release). Button2Clicked = 0x100, /// The second mouse button was double-clicked. Button2DoubleClicked = 0x200, /// The second mouse button was triple-clicked. Button2TripleClicked = 0x400, /// The third mouse button was pressed. Button3Pressed = 0x2000, /// The third mouse button was released. Button3Released = 0x1000, /// The third mouse button was clicked (press+release). Button3Clicked = 0x4000, /// The third mouse button was double-clicked. Button3DoubleClicked = 0x8000, /// The third mouse button was triple-clicked. Button3TripleClicked = 0x10000, /// The fourth mouse button was pressed. Button4Pressed = 0x80000, /// The fourth mouse button was released. Button4Released = 0x40000, /// The fourth button was clicked (press+release). Button4Clicked = 0x100000, /// The fourth button was double-clicked. Button4DoubleClicked = 0x200000, /// The fourth button was triple-clicked. Button4TripleClicked = 0x400000, /// Flag: the shift key was pressed when the mouse button took place. ButtonShift = 0x2000000, /// Flag: the ctrl key was pressed when the mouse button took place. ButtonCtrl = 0x1000000, /// Flag: the alt key was pressed when the mouse button took place. ButtonAlt = 0x4000000, /// The mouse position is being reported in this event. ReportMousePosition = 0x8000000, /// Vertical button wheeled up. WheeledUp = 0x10000000, /// Vertical button wheeled down. WheeledDown = 0x20000000, /// Vertical button wheeled up while pressing ButtonShift. WheeledLeft = ButtonShift | WheeledUp, /// Vertical button wheeled down while pressing ButtonShift. WheeledRight = ButtonShift | WheeledDown, /// Mask that captures all the events. AllEvents = 0x7ffffff } // TODO: Merge MouseEvent and MouseEventEventArgs into a single class. /// /// Low-level construct that conveys the details of mouse events, such as coordinates and button state, from /// ConsoleDrivers up to and Views. /// /// /// The class includes the Action which takes a /// MouseEvent argument. /// public class MouseEvent { /// Flags indicating the kind of mouse event that is being posted. public MouseFlags Flags { get; set; } /// /// Indicates if the current mouse event has already been processed and the driver should stop notifying any other /// event subscriber. Its important to set this value to true specially when updating any View's layout from inside the /// subscriber method. /// public bool Handled { get; set; } /// The offset X (column) location for the mouse event. public int OfX { get; set; } /// The offset Y (column) location for the mouse event. public int OfY { get; set; } /// The current view at the location for the mouse event. public View View { get; set; } /// The X (column) location for the mouse event. public int X { get; set; } /// The Y (column) location for the mouse event. public int Y { get; set; } /// Returns a that represents the current . /// A that represents the current . public override string ToString () { return $"({X},{Y}):{Flags}"; } }