Table of Contents

Class WindowQueryHelper

Namespace
SharpConsoleUI.Windows
Assembly
SharpConsoleUI.dll

Provides static helper methods for querying and finding windows. Extracted from ConsoleWindowSystem as part of Phase 3.3 refactoring.

public static class WindowQueryHelper
Inheritance
WindowQueryHelper
Inherited Members

Methods

FindDeepestModalChild(Window, ConsoleWindowSystem)

Finds the deepest modal child window with the highest Z-index.

public static Window? FindDeepestModalChild(Window window, ConsoleWindowSystem context)

Parameters

window Window

The parent window to search for modal children.

context ConsoleWindowSystem

The window system context.

Returns

Window

The deepest modal child, or null if none found.

FindWindowToActivate(Window, ConsoleWindowSystem, Action<Window>)

Finds the appropriate window to activate based on modality rules. Handles active modal children and recursive modal hierarchies.

public static Window FindWindowToActivate(Window targetWindow, ConsoleWindowSystem context, Action<Window> flashWindow)

Parameters

targetWindow Window

The window to activate.

context ConsoleWindowSystem

The window system context.

flashWindow Action<Window>

Action to flash a window for user feedback.

Returns

Window

The window that should actually be activated.

GetWindowAtPoint(Point, ConsoleWindowSystem)

Finds the topmost window at the specified point. Considers parent-child relationships to avoid returning windows covered by their modal children.

public static Window? GetWindowAtPoint(Point point, ConsoleWindowSystem context)

Parameters

point Point

The point in absolute screen coordinates.

context ConsoleWindowSystem

The window system context.

Returns

Window

The topmost window at the point, or null if none found.

IsChildWindow(Window, Window)

Checks if a window is a child (or descendant) of another window.

public static bool IsChildWindow(Window potentialChild, Window potentialParent)

Parameters

potentialChild Window

The window to check.

potentialParent Window

The potential parent window.

Returns

bool

True if potentialChild is a descendant of potentialParent; false otherwise.