Table of Contents

Class Container

Namespace
Godot
Assembly
GodotSharp.dll

Base class for all GUI containers. A Container automatically arranges its child controls in a certain way. This class can be inherited to make custom container types.

public class Container : Control, IDisposable
Inheritance
Container
Implements
Derived
Inherited Members

Constructors

Container()

public Container()

Fields

NotificationPreSortChildren

Notification just before children are going to be sorted, in case there's something to process beforehand.

public const long NotificationPreSortChildren = 50

Field Value

long

NotificationSortChildren

Notification for when sorting the children, it must be obeyed immediately.

public const long NotificationSortChildren = 51

Field Value

long

Methods

FitChildInRect(Control, Rect2)

Fit a child control in a given rect. This is mainly a helper for creating custom container classes.

public void FitChildInRect(Control child, Rect2 rect)

Parameters

child Control
rect Rect2

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

QueueSort()

Queue resort of the contained children. This is called automatically anyway, but can be called upon request.

public void QueueSort()

_GetAllowedSizeFlagsHorizontal()

Implement to return a list of allowed horizontal Control.SizeFlags for child nodes. This doesn't technically prevent the usages of any other size flags, if your implementation requires that. This only limits the options available to the user in the Inspector dock.

Note: Having no size flags is equal to having ShrinkBegin. As such, this value is always implicitly allowed.

public virtual int[] _GetAllowedSizeFlagsHorizontal()

Returns

int[]

_GetAllowedSizeFlagsVertical()

Implement to return a list of allowed vertical Control.SizeFlags for child nodes. This doesn't technically prevent the usages of any other size flags, if your implementation requires that. This only limits the options available to the user in the Inspector dock.

Note: Having no size flags is equal to having ShrinkBegin. As such, this value is always implicitly allowed.

public virtual int[] _GetAllowedSizeFlagsVertical()

Returns

int[]

Events

PreSortChildren

Emitted when children are going to be sorted.

public event Action PreSortChildren

Event Type

Action

SortChildren

Emitted when sorting the children is needed.

public event Action SortChildren

Event Type

Action