Skip to content

Container

Eduard Gushchin edited this page Jun 22, 2026 · 3 revisions

Home | API by Category | Complete API Index | API Compatibility

Field Value
Full name Electron2D.Container
Namespace Electron2D
Kind class
Category UI and Text

Overview

Provides the base control for nodes that arrange direct child controls.

Syntax

public class Electron2D.Container : Electron2D.Control

Remarks

Container is the common base for layout controls in the 0.1.0 Preview UI surface. It only arranges direct children that inherit from Electron2D.Control and leaves other child nodes untouched.

Layout is recalculated during the scene tree process step. Call Electron2D.Container.QueueSort after changing custom container state when an immediate frame has not already been scheduled by the caller.

Thread Safety

This type is not synchronized. Create and mutate containers on the main scene thread.

Since

This type is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Control
  • Electron2D.HBoxContainer
  • Electron2D.VBoxContainer

Members

Member Kind Summary
Electron2D.Container() Constructor Initializes a new instance of the Electron2D.Container type.
FitChildInRect(Electron2D.Control, Electron2D.Rect2) Method Fits a direct child control inside a local rectangle.
QueueSort() Method Queues this container for a layout recalculation.
_Process(System.Double) Method Called every process frame to recalculate queued container layout.

Member Details

Electron2D.Container()

Kind: Constructor

public Electron2D.Container()

Summary

Initializes a new instance of the Electron2D.Container type.

Remarks

The new container starts with layout queued so its children are arranged on the next scene tree process step.

Thread Safety

This constructor is not synchronized. Call it on the main scene thread.

Since

This constructor is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Container.QueueSort

FitChildInRect(Electron2D.Control, Electron2D.Rect2)

Kind: Method

public System.Void FitChildInRect(Electron2D.Control, Electron2D.Rect2)(Electron2D.Control child, Electron2D.Rect2 rect)

Summary

Fits a direct child control inside a local rectangle.

Remarks

This method resets the child anchors to the local rectangle mode used by containers, then writes the final position and size through the public Electron2D.Control.Position and Electron2D.Control.Size API.

A child is never made smaller than Electron2D.Control.GetCombinedMinimumSize. If rect is too small, the child may extend past the rectangle.

Parameters

  • child: The direct child control to place.
  • rect: The local rectangle assigned to child.

Exceptions

  • System.ArgumentNullException: Thrown when child is null.
  • System.ArgumentOutOfRangeException: Thrown when rect contains a negative size or a non-finite component.
  • System.InvalidOperationException: Thrown when child is not a direct child of this container.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Container.QueueSort
  • Electron2D.Control.GetCombinedMinimumSize

QueueSort()

Kind: Method

public System.Void QueueSort()()

Summary

Queues this container for a layout recalculation.

Remarks

The preview runtime recalculates container layout during Electron2D.Node._Process(System.Double). Multiple calls before a frame are coalesced.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Container.FitChildInRect(Electron2D.Control,Electron2D.Rect2)

_Process(System.Double)

Kind: Method

public System.Void _Process(System.Double)(System.Double delta)

Summary

Called every process frame to recalculate queued container layout.

Remarks

Container layout is recalculated every process frame in the preview runtime so parent size changes are reflected without requiring a hidden resize notification system.

Parameters

  • delta: The elapsed frame time in seconds.

Thread Safety

This method is not synchronized. The scene tree calls it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Container.QueueSort

Clone this wiki locally