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.
public sealed class ScrollPanelNode : Hex1bNode, ILayoutProviderInheritance
Object → Hex1bNode → ScrollPanelNode
Implements
Properties
Child
Returns: Hex1bNode
public Hex1bNode? Child { get; set; }ClipMode
The clip mode for this layout region.
Returns: ClipMode
public ClipMode ClipMode { get; }ClipRect
The effective clipping rectangle (the viewport, not including scrollbar).
Returns: Rect
public Rect ClipRect { get; }ContentSize
The size of the content being scrolled (in characters). This is set during layout.
Returns: Int32
public int ContentSize { get; }IsFocusable
Returns true if this node can receive focus.
Returns: Boolean
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
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
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
public override bool IsHovered { get; set; }IsScrollable
Whether the scrollbar is currently needed (content exceeds viewport).
Returns: Boolean
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
public override bool ManagesChildFocus { get; }MaxOffset
The maximum scroll offset.
Returns: Int32
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
public int Offset { get; set; }Orientation
The scroll orientation (vertical or horizontal).
Returns: ScrollOrientation
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
public ILayoutProvider? ParentLayoutProvider { get; set; }ShowScrollbar
Whether to show the scrollbar when content is scrollable.
Returns: Boolean
public bool ShowScrollbar { get; set; }SourceWidget
The source widget that created this node. Used to create event arguments for scroll events.
Returns: ScrollPanelWidget
public ScrollPanelWidget? SourceWidget { get; set; }ViewportSize
The size of the visible viewport (in characters). This is set during layout.
Returns: Int32
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:
bounds(Rect):
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>
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:
bindings(InputBindingsBuilder): The builder to add bindings to.
public override void ConfigureDefaultBindings(InputBindingsBuilder bindings)GetChildren()
Gets the direct children of this container for input routing.
Returns: IEnumerable<Hex1bNode>
public override IEnumerable<Hex1bNode> GetChildren()GetFocusableNodes()
Gets all focusable nodes in this subtree (including this node if focusable).
Returns: IEnumerable<Hex1bNode>
public override IEnumerable<Hex1bNode> GetFocusableNodes()InvalidateFocusCache()
public void InvalidateFocusCache()MeasureCore(Constraints)
Override this method to implement measuring logic for this node.
Parameters:
constraints(Constraints):
Returns: Size
protected override Size MeasureCore(Constraints constraints)Render(Hex1bRenderContext)
Renders the node to the given context.
Parameters:
context(Hex1bRenderContext):
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:
amount(Int32):
public void ScrollBy(int amount)ScrollByPage(int)
Scrolls by a full page in the given direction.
Parameters:
direction(Int32): Use+1to scroll forward (down/right) by one viewport,-1to scroll backward (up/left) by one viewport. Larger magnitudes multiply the step (e.g.2scrolls two pages forward).
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.
public void ScrollToBottom()ScrollToTop()
Scrolls to the start of the content (offset 0). Programmatic mutation does not fire the OnScroll event.
public void ScrollToTop()SetInitialFocus()
public void SetInitialFocus()ShouldRenderAt(int, int)
Determines if a character at the given absolute position should be rendered.
Parameters:
Returns: Boolean
public bool ShouldRenderAt(int x, int y)SyncFocusIndex()
Syncs _focusedIndex to match which child node has IsFocused = true.
public override void SyncFocusIndex()