namespace Terminal.Gui; /// Mouse flags reported in . /// They just happen to map to the ncurses ones. [Flags] public enum MouseFlags { /// /// No mouse event. This is the default value for when no mouse event is being reported. /// None = 0, /// 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 ButtonCtrl. WheeledLeft = ButtonCtrl | WheeledUp, /// Vertical button wheeled down while pressing ButtonCtrl. WheeledRight = ButtonCtrl | WheeledDown, /// Mask that captures all the events. AllEvents = 0x7ffffff } // TODO: Merge MouseEvent and MouseEventEventArgs into a single class. /// /// Conveys the details of mouse events, such as coordinates and button state, from /// ConsoleDrivers up to and Views. /// /// /// The class includes the event which takes a /// MouseEvent argument. /// public class MouseEvent { /// Flags indicating the kind of mouse event that is being posted. public MouseFlags Flags { get; set; } /// The View at the location for the mouse event. public View View { get; set; } /// The position of the mouse in -relative coordinates. public Point Position { get; set; } /// /// The screen-relative mouse position. /// /// /// /// is -relative. When the mouse is grabbed by a view, /// provides the mouse position screen-relative coordinates, enabling the grabbed view to know how much the /// mouse has moved. /// /// /// Calculated and processed in . /// /// public Point ScreenPosition { get; set; } /// /// Indicates if the current mouse event has been processed. Set this value to to indicate the mouse /// event was handled. /// public bool Handled { get; set; } /// Returns a that represents the current . /// A that represents the current . public override string ToString () { return $"({Position}):{Flags}"; } }