Container
Inherits: Control < CanvasItem < Actor < Object
Inherited by: AspectRatioContainer, Box, BoxContainer, CenterContainer, EditorProperty, FlowContainer, FoldableContainer, GraphElement, GridContainer, MarginContainer, PanelContainer, ScrollContainer, SplitContainer, SubViewportContainer, TabContainer
Base class for all GUI containers.
Description
Section titled “Description”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.
Properties
Section titled “Properties”| Type | Name | Default |
|---|---|---|
| bool | accessibility_region | false |
| Control.MouseFilter | mouse_filter | 1 |
| bool | propagate_maximum_size | true |
Methods
Section titled “Methods”| Returns | Method |
|---|---|
[]i32 | _get_allowed_size_flags_horizontal() |
[]i32 | _get_allowed_size_flags_vertical() |
| void | fit_child_in_rect(child, rect) |
| void | queue_sort() |
Signals
Section titled “Signals”pre_sort_children
Section titled “pre_sort_children”pre_sort_children()Emitted when children are going to be sorted.
sort_children
Section titled “sort_children”sort_children()Emitted when sorting the children is needed.
Enumerations and constants
Section titled “Enumerations and constants”- NOTIFICATION_PRE_SORT_CHILDREN =
50— Notification just before children are going to be sorted, in case there’s something to process beforehand.
- NOTIFICATION_SORT_CHILDREN =
51— Notification for when sorting the children, it must be obeyed immediately.
Property descriptions
Section titled “Property descriptions”accessibility_region
Section titled “accessibility_region”bool accessibility_region = false
Setter/getter: set_accessibility_region(), is_accessibility_region()
If true, this container is marked as a region for accessibility. Use Control.accessibility_name to give the region a descriptive name. Screen readers can navigate between regions using landmark navigation.
mouse_filter
Section titled “mouse_filter”Control.MouseFilter mouse_filter = 1
Setter/getter: set_mouse_filter(), get_mouse_filter()
No description yet.
propagate_maximum_size
Section titled “propagate_maximum_size”bool propagate_maximum_size = true
Setter/getter: set_propagate_maximum_size(), is_propagating_maximum_size()
No description yet.
Method descriptions
Section titled “Method descriptions”_get_allowed_size_flags_horizontal
Section titled “_get_allowed_size_flags_horizontal”[]i32 _get_allowed_size_flags_horizontal() virtual const
Implement to return a list of allowed horizontal Control.SizeFlags for child actors. 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 Control.SIZE_SHRINK_BEGIN. As such, this value is always implicitly allowed.
_get_allowed_size_flags_vertical
Section titled “_get_allowed_size_flags_vertical”[]i32 _get_allowed_size_flags_vertical() virtual const
Implement to return a list of allowed vertical Control.SizeFlags for child actors. 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 Control.SIZE_SHRINK_BEGIN. As such, this value is always implicitly allowed.
fit_child_in_rect
Section titled “fit_child_in_rect”void fit_child_in_rect(child: Control, rect: Rect2)
Fit a child control in a given rect. This is mainly a helper for creating custom container classes.
queue_sort
Section titled “queue_sort”void queue_sort()
Queue resort of the contained children. This is called automatically anyway, but can be called upon request.