Skip to content

ScrollbarNode ​

Namespace: Hex1b.Nodes

Assembly: Hex1b.dll

A standalone scrollbar node that handles thumb dragging and track clicking.

csharp
public sealed class ScrollbarNode : Hex1bNode

Inheritance ​

Object → Hex1bNode → ScrollbarNode

Properties ​

ContentSize ​

The total size of the content being scrolled.

Returns: Int32

csharp
public int ContentSize { get; set; }

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; }

IsScrollable ​

Whether the scrollbar is needed (content exceeds viewport).

Returns: Boolean

csharp
public bool IsScrollable { get; }

MaxOffset ​

The maximum scroll offset.

Returns: Int32

csharp
public int MaxOffset { get; }

Offset ​

The current scroll offset.

Returns: Int32

csharp
public int Offset { get; set; }

Orientation ​

The scrollbar orientation.

Returns: ScrollOrientation

csharp
public ScrollOrientation Orientation { get; set; }

ScrollHandler ​

Handler called when scroll offset changes.

Returns: Func<Int32, Task>

csharp
public Func<int, Task>? ScrollHandler { get; set; }

ViewportSize ​

The visible viewport size.

Returns: Int32

csharp
public int ViewportSize { get; set; }

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)

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)

HandleMouseClick(int, int, Hex1bMouseEvent) ​

Handles a mouse click event (after mouse bindings have been checked). Override this in nodes to handle clicks that weren't matched by any mouse binding. The coordinates in the event are local to this node's bounds (0,0 is top-left of node).

Parameters:

  • localX (Int32): The X coordinate relative to this node's bounds.
  • localY (Int32): The Y coordinate relative to this node's bounds.
  • mouseEvent (Hex1bMouseEvent): The original mouse event (with absolute coordinates).

Returns: InputResult

Handled if the click was consumed, NotHandled otherwise.

csharp
public override InputResult HandleMouseClick(int localX, int localY, Hex1bMouseEvent mouseEvent)

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)

Released under the MIT License.