Skip to content

ScrollPanelNode ​

Namespace: Hex1b.Nodes

Assembly: Hex1b.dll

A node that provides scrolling capability for content that exceeds the available space. Only supports one direction at a time (vertical or horizontal). Implements ILayoutProvider to clip content that exceeds the visible viewport.

csharp
public sealed class ScrollPanelNode : Hex1bNode, ILayoutProvider

Inheritance ​

Object → Hex1bNode → ScrollPanelNode

Implements ​

Properties ​

Child ​

Returns: Hex1bNode

csharp
public Hex1bNode? Child { get; set; }

ClipMode ​

The clip mode for this layout region.

Returns: ClipMode

csharp
public ClipMode ClipMode { get; }

ClipRect ​

The effective clipping rectangle (the viewport, not including scrollbar).

Returns: Rect

csharp
public Rect ClipRect { get; }

ContentSize ​

The size of the content being scrolled (in characters). This is set during layout.

Returns: Int32

csharp
public int ContentSize { get; }

IsFocusable ​

Returns true if this node can receive focus.

Returns: Boolean

csharp
public override bool IsFocusable { get; }

IsFocused ​

Gets or sets whether this node is currently focused. Only meaningful for focusable nodes (where IsFocusable is true).

Returns: Boolean

csharp
public override bool IsFocused { get; set; }

IsFollowing ​

When true, the scroll panel auto-scrolls to the end when content grows. Set to false when the user scrolls away from the end. Re-engaged when the user scrolls back to the end.

Returns: Boolean

csharp
public bool IsFollowing { get; set; }

IsHovered ​

Gets or sets whether the mouse is currently hovering over this node. Set by Hex1bApp based on mouse position during each frame. Only set on focusable nodes (tracked via FocusRing hit testing).

Returns: Boolean

csharp
public override bool IsHovered { get; set; }

IsScrollable ​

Whether the scrollbar is currently needed (content exceeds viewport).

Returns: Boolean

csharp
public bool IsScrollable { get; }

ManagesChildFocus ​

Returns true if this node manages focus for its children. When a parent manages focus, child containers should NOT set initial focus themselves. Container nodes like SplitterNode should override this to return true.

Returns: Boolean

csharp
public override bool ManagesChildFocus { get; }

MaxOffset ​

The maximum scroll offset.

Returns: Int32

csharp
public int MaxOffset { get; }

Offset ​

The current scroll offset (in characters). For vertical scrolling, this is the row offset. For horizontal scrolling, this is the column offset.

Returns: Int32

csharp
public int Offset { get; set; }

Orientation ​

The scroll orientation (vertical or horizontal).

Returns: ScrollOrientation

csharp
public ScrollOrientation Orientation { get; set; }

ParentLayoutProvider ​

The parent layout provider, if any. Set when this provider becomes the current layout provider and there was already one active. Used to ensure nested clipping works correctly.

Returns: ILayoutProvider

csharp
public ILayoutProvider? ParentLayoutProvider { get; set; }

ShowScrollbar ​

Whether to show the scrollbar when content is scrollable.

Returns: Boolean

csharp
public bool ShowScrollbar { get; set; }

SourceWidget ​

The source widget that created this node. Used to create event arguments for scroll events.

Returns: ScrollPanelWidget

csharp
public ScrollPanelWidget? SourceWidget { get; set; }

ViewportSize ​

The size of the visible viewport (in characters). This is set during layout.

Returns: Int32

csharp
public int ViewportSize { get; }

Methods ​

ArrangeCore(Rect) ​

Override this method to implement arranging logic for this node. The base implementation saves previous bounds, marks dirty on change, and sets bounds.

Parameters:

csharp
protected override void ArrangeCore(Rect bounds)

ClipString(int, int, string) ​

Clips a string that starts at the given position, returning only the visible portion.

Parameters:

Returns: ValueTuple<Int32, String>

csharp
public (int adjustedX, string clippedText) ClipString(int x, int y, string text)

ConfigureDefaultBindings(InputBindingsBuilder) ​

Configures the default input bindings for this node type. Override in derived classes to add default key bindings. These bindings can be inspected and modified by the user's callback.

Parameters:

csharp
public override void ConfigureDefaultBindings(InputBindingsBuilder bindings)

GetChildren() ​

Gets the direct children of this container for input routing.

Returns: IEnumerable<Hex1bNode>

csharp
public override IEnumerable<Hex1bNode> GetChildren()

GetFocusableNodes() ​

Gets all focusable nodes in this subtree (including this node if focusable).

Returns: IEnumerable<Hex1bNode>

csharp
public override IEnumerable<Hex1bNode> GetFocusableNodes()

InvalidateFocusCache() ​

csharp
public void InvalidateFocusCache()

MeasureCore(Constraints) ​

Override this method to implement measuring logic for this node.

Parameters:

Returns: Size

csharp
protected override Size MeasureCore(Constraints constraints)

Render(Hex1bRenderContext) ​

Renders the node to the given context.

Parameters:

csharp
public override void Render(Hex1bRenderContext context)

ScrollBy(int) ​

Scrolls by the specified number of characters relative to the current offset. Positive values scroll forward (down/right); negative values scroll backward (up/left). The result is clamped to [0, ]. Programmatic mutation does not fire the OnScroll event.

Parameters:

csharp
public void ScrollBy(int amount)

ScrollByPage(int) ​

Scrolls by a full page in the given direction.

Parameters:

  • direction (Int32): Use +1 to scroll forward (down/right) by one viewport, -1 to scroll backward (up/left) by one viewport. Larger magnitudes multiply the step (e.g. 2 scrolls two pages forward).
csharp
public void ScrollByPage(int direction)

ScrollToBottom() ​

Scrolls to the end of the content (offset = ). When follow mode is enabled, this also re-engages following. Programmatic mutation does not fire the OnScroll event.

csharp
public void ScrollToBottom()

ScrollToTop() ​

Scrolls to the start of the content (offset 0). Programmatic mutation does not fire the OnScroll event.

csharp
public void ScrollToTop()

SetInitialFocus() ​

csharp
public void SetInitialFocus()

ShouldRenderAt(int, int) ​

Determines if a character at the given absolute position should be rendered.

Parameters:

Returns: Boolean

csharp
public bool ShouldRenderAt(int x, int y)

SyncFocusIndex() ​

Syncs _focusedIndex to match which child node has IsFocused = true.

csharp
public override void SyncFocusIndex()

Released under the MIT License.