Table of Contents

Class WindowContentLayout

Namespace
SharpConsoleUI.Layout
Assembly
SharpConsoleUI.dll

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

public class WindowContentLayout : ILayoutContainer, IRegionClippingLayout
Inheritance
WindowContentLayout
Implements
Inherited Members

Properties

CanScroll

Gets whether scrolling is needed.

public bool CanScroll { get; }

Property Value

bool

MaxScrollOffset

Gets the maximum scroll offset.

public int MaxScrollOffset { get; }

Property Value

int

ScrollOffset

Gets or sets the current scroll offset for the scrollable section.

public int ScrollOffset { get; set; }

Property Value

int

ScrollableBottom

Gets the Y position where scrollable content ends (set during arrange).

public int ScrollableBottom { get; }

Property Value

int

ScrollableContentHeight

Gets the total height of scrollable content.

public int ScrollableContentHeight { get; }

Property Value

int

ScrollableTop

Gets the Y position where scrollable content starts (set during arrange).

public int ScrollableTop { get; }

Property Value

int

StickyBottomHeight

Gets the height of sticky bottom controls (set during arrange).

public int StickyBottomHeight { get; }

Property Value

int

StickyTopHeight

Gets the height of sticky top controls (set during arrange).

public int StickyTopHeight { get; }

Property Value

int

ViewportHeight

Gets the height of the scrollable viewport.

public int ViewportHeight { get; }

Property Value

int

Methods

ArrangeChildren(LayoutNode, LayoutRect)

Arranges children with sticky positioning.

public void ArrangeChildren(LayoutNode node, LayoutRect finalRect)

Parameters

node LayoutNode
finalRect LayoutRect

EnsureVisible(int)

Scrolls to ensure the specified Y position is visible in the scrollable area.

public void EnsureVisible(int y)

Parameters

y int

GetPaintClipRect(LayoutNode, LayoutRect)

Gets the paint clip rectangle for a child node based on its sticky position. This prevents scrollable content from painting over sticky regions.

public LayoutRect GetPaintClipRect(LayoutNode child, LayoutRect parentClipRect)

Parameters

child LayoutNode

The child node to get the clip rectangle for.

parentClipRect LayoutRect

The parent's clip rectangle.

Returns

LayoutRect

A restricted clip rectangle based on the child's sticky position.

MeasureChildren(LayoutNode, LayoutConstraints)

Measures all children and returns the total desired size.

public LayoutSize MeasureChildren(LayoutNode node, LayoutConstraints constraints)

Parameters

node LayoutNode
constraints LayoutConstraints

Returns

LayoutSize

PageDown()

Scrolls down by one page.

public void PageDown()

PageUp()

Scrolls up by one page.

public void PageUp()

ScrollBy(int)

Scrolls by the specified amount.

public void ScrollBy(int delta)

Parameters

delta int

ScrollToBottom()

Scrolls to the bottom.

public void ScrollToBottom()

ScrollToTop()

Scrolls to the top.

public void ScrollToTop()