Table of Contents

Namespace SharpConsoleUI.Layout

Classes

CharacterBuffer

A 2D buffer of character cells for rendering. Supports double-buffering for efficient diff-based output.

ControlBounds

Represents the complete bounds and coordinate information for a control within a window

HorizontalLayout

Layout algorithm that arranges children horizontally. Similar to HorizontalGridControl behavior.

LayoutNode

Represents a node in the layout DOM tree. Wraps an IWindowControl and manages layout state (measure/arrange/paint).

LayoutNodeFactory

Shared utility for building layout subtrees from controls. Extracts the control-type to layout-algorithm mapping so both WindowRenderer and ScrollablePanelControl can build proper layout trees.

PortalPositioner

Static utility for calculating portal overlay positions with automatic flip and clamping logic. Extracts the shared positioning pattern from DropdownControl and MenuControl into a reusable component.

ScrollableLayoutNode

A layout node that supports scrolling. Manages a viewport into a larger content area.

TabLayout

Layout algorithm for TabControl that positions tab content below a header row. Similar to VerticalStackLayout but reserves space for tab headers.

VerticalStackLayout

Layout algorithm that stacks children vertically. Similar to ColumnContainer behavior.

WindowContentLayout

Root layout for window content. Handles sticky top, scrollable middle, and sticky bottom sections.

WindowLayoutManager

Manages layout calculations and coordinate translations for all controls in a window

Structs

BufferSnapshot

Immutable snapshot of a CharacterBuffer at a point in time.

Cell

Represents a single character cell in the character buffer. Contains the character, foreground color, background color, decorations, and dirty state.

CellChange

Represents a change to a single cell in the buffer.

LayoutConstraints

Represents layout constraints for measuring controls. Defines minimum and maximum width/height bounds.

LayoutRect

Represents a rectangle with position and size. Immutable value type for layout calculations and hit testing. Named LayoutRect to avoid conflicts with System.Drawing.Rectangle during transition.

LayoutSize

Represents a size with width and height dimensions. Immutable value type for layout calculations. Named LayoutSize to avoid conflicts with System.Drawing.Size during transition.

Padding

Immutable padding values for content spacing. Replaces Spectre.Console.Padding.

PortalPositionRequest

Describes a portal positioning request.

PortalPositionResult

The calculated portal position after applying placement and clamping logic.

Interfaces

IDOMMeasurable

Interface for controls that support native DOM-based measurement only. Controls implementing this interface provide optimized size calculation.

IDOMPaintable

Interface for controls that support DOM-based painting. Controls implementing this interface can paint directly to a CharacterBuffer. All controls must implement this interface for the DOM layout system.

IHasPortalBounds

Implemented by portal content controls that need custom absolute positioning. When Window.CreatePortal() receives a content that implements this interface, it uses GetPortalBounds() to position the overlay instead of defaulting to (0,0).

ILayoutContainer

Interface for layout algorithms that determine how children are measured and arranged. Different implementations provide different layout strategies (vertical stack, horizontal, grid, etc.)

IRegionClippingLayout

Interface for layout containers that support region-specific clipping. This allows different clip rectangles to be applied to children based on their properties, such as preventing scrollable content from painting over sticky controls.

Enums

HorizontalAlignment

Horizontal alignment options for controls within their container.

PortalPlacement

Preferred placement direction for a portal overlay relative to its anchor.

TextJustification

Text justification for content alignment within controls. Replaces Spectre.Console.Justify.

VerticalAlignment

Vertical alignment options for controls within their container.