Table of Contents

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

window Window

The window this dispatcher belongs to

Methods

GetControlAtPosition(Point?)

Gets the control at the specified window-relative coordinates.

public IWindowControl? GetControlAtPosition(Point? point)

Parameters

point Point?

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

interactiveContent IInteractiveControl

The 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

cursorPosition Point

When 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

key ConsoleKeyInfo

The 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

args MouseEventArgs

Mouse 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

backward bool

True to switch backward; false to switch forward.