Class WindowLayoutManager
- Namespace
- SharpConsoleUI.Layout
- Assembly
- SharpConsoleUI.dll
Manages layout calculations and coordinate translations for all controls in a window
public class WindowLayoutManager
- Inheritance
-
WindowLayoutManager
- Inherited Members
- Extension Methods
Constructors
WindowLayoutManager(Window)
Initializes a new instance of the WindowLayoutManager class.
public WindowLayoutManager(Window window)
Parameters
windowWindowThe window to manage layout for.
Exceptions
- ArgumentNullException
Thrown when
windowis null.
Methods
GetControlAtWindowPosition(Point)
Finds the control at a specific window coordinate
public (IWindowControl? control, Point localPosition) GetControlAtWindowPosition(Point windowPosition)
Parameters
windowPositionPoint
Returns
GetControlBounds(IWindowControl)
Gets the bounds information for a specific control
public ControlBounds? GetControlBounds(IWindowControl control)
Parameters
controlIWindowControl
Returns
GetOrCreateControlBounds(IWindowControl)
Gets or creates bounds for a control
public ControlBounds GetOrCreateControlBounds(IWindowControl control)
Parameters
controlIWindowControl
Returns
TranslateLogicalCursorToContent(IWindowControl)
Translates a control's logical cursor position to window-CONTENT coordinates (origin at the content area, i.e. excluding the frame/title inset) by walking up the parent container hierarchy and accumulating offsets. This is the coordinate space portals are arranged in, so it is the correct anchor space for a portal overlay (e.g. a completion popup) — using the window-relative TranslateLogicalCursorToWindow(IWindowControl) here would double-count the inset.
public Point? TranslateLogicalCursorToContent(IWindowControl control)
Parameters
controlIWindowControl
Returns
TranslateLogicalCursorToWindow(IWindowControl)
Translates a control's logical cursor position to window coordinates by walking up the parent container hierarchy and accumulating offsets.
public Point? TranslateLogicalCursorToWindow(IWindowControl control)
Parameters
controlIWindowControl
Returns
UpdateLayout(int, int)
Calculates and updates the layout for all controls in the window
public void UpdateLayout(int availableWidth, int availableHeight)