Class WindowEventDispatcher
- Namespace
- SharpConsoleUI.Windows
- Assembly
- SharpConsoleUI.dll
Handles event dispatching and routing for window mouse/keyboard events. Extracted from Window class as part of Phase 3.5 refactoring. Manages focus, hit testing, and event bubbling.
public class WindowEventDispatcher
- Inheritance
-
WindowEventDispatcher
- Inherited Members
Constructors
WindowEventDispatcher(Window)
Initializes a new instance of the WindowEventDispatcher class.
public WindowEventDispatcher(Window window)
Parameters
windowWindowThe window this dispatcher belongs to
Methods
GetControlAtPosition(Point?)
Gets the control at the specified window-relative coordinates.
public IWindowControl? GetControlAtPosition(Point? point)
Parameters
pointPoint?The window-relative coordinates to check.
Returns
- IWindowControl
The control at the specified position, or null if none found or outside content area.
HasActiveInteractiveContent(out IInteractiveControl?)
Determines whether there is an active interactive control with focus.
public bool HasActiveInteractiveContent(out IInteractiveControl? interactiveContent)
Parameters
interactiveContentIInteractiveControlThe active interactive control, if found.
Returns
- bool
True if there is an active interactive control; otherwise false.
HasInteractiveContent(out Point)
Determines whether there is interactive content that needs cursor display.
public bool HasInteractiveContent(out Point cursorPosition)
Parameters
cursorPositionPointWhen returning true, contains the cursor position in window coordinates.
Returns
- bool
True if cursor should be displayed; otherwise false.
ProcessInput(ConsoleKeyInfo)
Processes keyboard input for the window and its controls.
public bool ProcessInput(ConsoleKeyInfo key)
Parameters
keyConsoleKeyInfoThe key information to process.
Returns
- bool
True if the input was handled; otherwise false.
ProcessMouseEvent(MouseEventArgs)
Handles mouse events for this window and propagates them to controls
public bool ProcessMouseEvent(MouseEventArgs args)
Parameters
argsMouseEventArgsMouse event arguments with window-relative coordinates
Returns
- bool
True if the event was handled
SwitchFocus(bool)
Switches focus to the next or previous interactive control.
public void SwitchFocus(bool backward = false)
Parameters
backwardboolTrue to switch backward; false to switch forward.