Skip to content

CompositeNode

Namespace: Hex1b.Nodes

Assembly: Hex1b.dll

Base class for nodes that manage composite widgets. Composite nodes hold state and delegate rendering to their content child.

csharp
public abstract class CompositeNode : Hex1bNode

Inheritance

ObjectHex1bNodeCompositeNode

Properties

ContentChild

The reconciled content child node. This is the root of the widget tree built by the composite widget.

Returns: Hex1bNode

csharp
public Hex1bNode? ContentChild { get; set; }

IsFocusable

Composite nodes are NOT themselves focusable - focus passes through to children. This ensures the input router continues traversing into ContentChild to find the actual focusable node (which has the input bindings).

Returns: Boolean

csharp
public override bool IsFocusable { get; }

IsFocused

Composite nodes are never themselves focused - focus state exists on the content child. The path builder should continue through GetChildren() to find the focused child.

Returns: Boolean

csharp
public override bool IsFocused { get; set; }

Methods

ArrangeCore(Rect)

Arranges the content child to fill the given bounds.

Parameters:

csharp
protected override void ArrangeCore(Rect rect)

GetChildren()

Returns the content child as the only child of this node. This enables focus traversal through composite widgets.

Returns: IReadOnlyList<Hex1bNode>

csharp
public override IReadOnlyList<Hex1bNode> GetChildren()

GetFocusableNodes()

Returns focusable nodes from the content child. This enables the focus ring to find the actual focusable nodes inside composite widgets.

Returns: IEnumerable<Hex1bNode>

csharp
public override IEnumerable<Hex1bNode> GetFocusableNodes()

MeasureCore(Constraints)

Measures the content child and returns its size.

Parameters:

Returns: Size

csharp
protected override Size MeasureCore(Constraints constraints)

Render(Hex1bRenderContext)

Renders the content child.

Parameters:

csharp
public override void Render(Hex1bRenderContext context)

Remarks

CompositeNode acts as a transparent container - it delegates measure, arrange, and render operations to its content child. Subclasses can override these methods to add additional behavior (e.g., wrapping content, handling input).

State that must survive re-renders (like popup visibility, selection index) should be stored as properties on the subclass.

Released under the MIT License.