Hex1bNode
Namespace: Hex1b
Assembly: Hex1b.dll
public abstract class Hex1bNodeInheritance
Object → Hex1bNode
Properties
Bounds
The bounds assigned to this node after layout.
Returns: Rect
public Rect Bounds { get; set; }ContentBounds
The bounds of this node's actual content for hit testing purposes. Defaults to . Override for nodes that position content within a larger layout area (e.g., AnchoredNode).
Returns: Rect
public virtual Rect ContentBounds { get; }HeightHint
Hint for how this node should be sized vertically within its parent. Used by VStack to distribute height among children.
Returns: Nullable<SizeHint>
public SizeHint? HeightHint { get; set; }HitTestBounds
Gets the bounds used for mouse hit testing. By default, returns the full Bounds. Override in nodes where only a portion of the bounds should respond to clicks (e.g., SplitterNode's divider).
Returns: Rect
public virtual Rect HitTestBounds { get; }IsDirty
Whether this node needs to be re-rendered. New nodes start dirty. The framework clears this after each render frame.
Returns: Boolean
public bool IsDirty { get; }IsFocusable
Returns true if this node can receive focus.
Returns: Boolean
public virtual 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 virtual bool IsFocused { 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 virtual bool IsHovered { get; set; }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 virtual bool ManagesChildFocus { get; }MetricName
User-assigned or auto-generated metric name segment for this node. Combined with ancestor names to form the hierarchical metric path.
Returns: String
public string? MetricName { get; }Parent
The parent node in the tree (set during reconciliation).
Returns: Hex1bNode
public Hex1bNode? Parent { get; set; }PreferredCursorShape
Gets the preferred cursor shape when the mouse is over this node. Override this to customize cursor appearance (e.g., text input uses a bar cursor).
Returns: CursorShape
public virtual CursorShape PreferredCursorShape { get; }PreviousBounds
The bounds from the previous frame, used for dirty region tracking. Before the first arrange, this will be an empty rect at (0,0).
Returns: Rect
public Rect PreviousBounds { get; }WidthHint
Hint for how this node should be sized horizontally within its parent. Used by HStack to distribute width among children.
Returns: Nullable<SizeHint>
public SizeHint? WidthHint { get; set; }Methods
Arrange(Rect)
Assigns final bounds to this node and arranges children. When per-node metrics are enabled, records the duration. Subclasses override to implement arranging logic. Call base.ArrangeCore(bounds) to save bounds and mark dirty on change.
Parameters:
bounds(Rect):
public void Arrange(Rect bounds)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 virtual 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:
bindings(InputBindingsBuilder): The builder to add bindings to.
public virtual void ConfigureDefaultBindings(InputBindingsBuilder bindings)GetChildren()
Gets the direct children of this node. Used for input routing and tree traversal. Container nodes should override this to return their children.
Returns: IEnumerable<Hex1bNode>
public virtual IEnumerable<Hex1bNode> GetChildren()GetFocusableNodes()
Gets all focusable nodes in this subtree (including this node if focusable).
Returns: IEnumerable<Hex1bNode>
public virtual IEnumerable<Hex1bNode> GetFocusableNodes()HandleInput(Hex1bEvent)
Handles an input event (after bindings have been checked). Override this in nodes to handle input that wasn't matched by any binding.
Parameters:
inputEvent(Hex1bEvent): The input event to handle (keyboard or mouse).
Returns: InputResult
Handled if the input was consumed, NotHandled otherwise.
public virtual InputResult HandleInput(Hex1bEvent inputEvent)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.
public virtual InputResult HandleMouseClick(int localX, int localY, Hex1bMouseEvent mouseEvent)HandlePasteAsync(Hex1bPasteEvent)
Handles a bracketed paste event asynchronously. Override this in nodes that can consume pasted content (e.g., text editors, file drop zones).
Parameters:
pasteEvent(Hex1bPasteEvent): The paste event containing a streaming .
Returns: Task<InputResult>
if the paste was consumed, to bubble the paste to ancestor nodes.
public virtual Task<InputResult> HandlePasteAsync(Hex1bPasteEvent pasteEvent)MarkDirty()
Marks this node as needing re-rendering. Call this when internal state changes that don't flow through widget reconciliation.
public void MarkDirty()Measure(Constraints)
Measures the desired size of this node given the constraints. When per-node metrics are enabled, records the duration. Subclasses override to implement measuring logic.
Parameters:
constraints(Constraints):
Returns: Size
public Size Measure(Constraints constraints)MeasureCore(Constraints)
Override this method to implement measuring logic for this node.
Parameters:
constraints(Constraints):
Returns: Size
protected abstract Size MeasureCore(Constraints constraints)NeedsRender()
Checks if this node or any of its descendants need rendering. Used to determine if a subtree can be skipped entirely.
Returns: Boolean
public bool NeedsRender()Render(Hex1bRenderContext)
Renders the node to the given context.
Parameters:
context(Hex1bRenderContext):
public abstract void Render(Hex1bRenderContext context)SyncFocusIndex()
Syncs internal focus tracking to match the current IsFocused state of child nodes. Called after externally setting focus on a child node. Container nodes should override this to update their internal focus index.
public virtual void SyncFocusIndex()