using System.ComponentModel; namespace Terminal.Gui.App; /// /// Defines a contract for mouse event handling and state management in a Terminal.Gui application. /// /// This interface allows for decoupling of mouse-related functionality from the static class, /// enabling better testability and parallel test execution. /// /// public interface IMouse : IMouseGrabHandler { /// /// Sets the application instance that this mouse handler is associated with. /// This provides access to application state without coupling to static Application class. /// IApplication? App { get; set; } /// /// Gets or sets the last known position of the mouse. /// Point? LastMousePosition { get; set; } /// /// Gets or sets whether the mouse is disabled. The mouse is enabled by default. /// bool IsMouseDisabled { get; set; } /// /// Gets the list of non- views that are currently under the mouse. /// List CachedViewsUnderMouse { get; } /// /// Raised when a mouse event occurs. Can be cancelled by setting to . /// /// /// /// coordinates are screen-relative. /// /// /// will be the deepest view under the mouse. /// /// /// coordinates are view-relative. Only valid if is set. /// /// /// Use this even to handle mouse events at the application level, before View-specific handling. /// /// event EventHandler? MouseEvent; /// /// INTERNAL API: Called when a mouse event is raised by the driver. Determines the view under the mouse and /// calls the appropriate View mouse event handlers. /// /// This method can be used to simulate a mouse event, e.g. in unit tests. /// The mouse event with coordinates relative to the screen. void RaiseMouseEvent (MouseEventArgs mouseEvent); /// /// INTERNAL: Raises the MouseEnter and MouseLeave events for the views that are under the mouse. /// /// The position of the mouse. /// The most recent result from GetViewsUnderLocation(). void RaiseMouseEnterLeaveEvents (Point screenPosition, List currentViewsUnderMouse); /// /// INTERNAL: Resets mouse state, clearing event handlers and cached views. /// void ResetState (); }