Class ScrollableLayoutNode
- Namespace
- SharpConsoleUI.Layout
- Assembly
- SharpConsoleUI.dll
A layout node that supports scrolling. Manages a viewport into a larger content area.
public class ScrollableLayoutNode : LayoutNode
- Inheritance
-
ScrollableLayoutNode
- Inherited Members
Constructors
ScrollableLayoutNode(IWindowControl?, ILayoutContainer?)
Creates a new scrollable layout node.
public ScrollableLayoutNode(IWindowControl? control = null, ILayoutContainer? layout = null)
Parameters
controlIWindowControllayoutILayoutContainer
Properties
CanScrollHorizontally
Gets whether horizontal scrolling is needed.
public bool CanScrollHorizontally { get; }
Property Value
CanScrollVertically
Gets whether vertical scrolling is needed.
public bool CanScrollVertically { get; }
Property Value
ContentSize
Gets the total content size (may be larger than viewport).
public LayoutSize ContentSize { get; }
Property Value
MaxScrollX
Gets the maximum horizontal scroll offset.
public int MaxScrollX { get; }
Property Value
MaxScrollY
Gets the maximum vertical scroll offset.
public int MaxScrollY { get; }
Property Value
ScrollX
Gets or sets the scroll offset (top-left of visible area).
public int ScrollX { get; set; }
Property Value
ScrollY
Gets or sets the scroll offset (top-left of visible area).
public int ScrollY { get; set; }
Property Value
ViewportSize
Gets the viewport size (visible area).
public LayoutSize ViewportSize { get; }
Property Value
Methods
EnsureVisible(LayoutRect)
Scrolls to ensure the specified rectangle is visible.
public void EnsureVisible(LayoutRect rect)
Parameters
rectLayoutRect
EnsureVisible(int)
Scrolls to ensure the specified Y position is visible.
public void EnsureVisible(int y)
Parameters
yint
GetVisibleChildRange()
Gets the visible range of children indices. Useful for virtual scrolling (only process visible items).
public (int StartIndex, int Count) GetVisibleChildRange()
Returns
HitTest(int, int)
Hit test with scroll offset applied. Translates the hit test coordinates by the scroll offset before checking children.
public override LayoutNode? HitTest(int x, int y)
Parameters
Returns
Measure(LayoutConstraints)
Measures the scrollable content. The content can exceed the available space (will scroll).
public LayoutSize Measure(LayoutConstraints constraints)
Parameters
constraintsLayoutConstraints
Returns
PageDown()
Scrolls down by one page.
public void PageDown()
PageUp()
Scrolls up by one page.
public void PageUp()
Paint(CharacterBuffer, LayoutRect)
Paints the scrollable content with scroll offset applied.
public void Paint(CharacterBuffer buffer, LayoutRect clipRect)
Parameters
bufferCharacterBufferclipRectLayoutRect
ScrollBy(int, int)
Scrolls by the specified amounts.
public void ScrollBy(int deltaX, int deltaY)
Parameters
ScrollTo(int, int)
Scrolls to the specified position.
public void ScrollTo(int x, int y)
Parameters
ScrollToBottom()
Scrolls to the bottom.
public void ScrollToBottom()
ScrollToTop()
Scrolls to the top.
public void ScrollToTop()