Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
FoldableContainer
Inherits: Container < Control < CanvasItem < Node < Object
A container that can be expanded/collapsed.
Description
A container that can be expanded/collapsed, with a title that can be filled with controls, such as buttons.
The title can be positioned at the top or bottom of the container.
The container can be expanded or collapsed by clicking the title or by pressing ui_accept
when focused.
Child control nodes are hidden when the container is collapsed. Ignores non-control children.
Can allow grouping with other FoldableContainers, check foldable_group and FoldableGroup.
Properties
focus_mode |
|
|
|
||
|
||
mouse_filter |
|
|
|
||
|
||
|
||
|
||
|
Methods
void |
add_title_bar_control(control: Control) |
void |
expand() |
void |
fold() |
void |
remove_title_bar_control(control: Control) |
Theme Properties
|
||
|
||
|
||
|
||
|
||
|
||
Signals
folding_changed(is_folded: bool) 🔗
Emitted when the container is folded/expanded.
Enumerations
enum TitlePosition: 🔗
TitlePosition POSITION_TOP = 0
Makes the title appear at the top of the container.
TitlePosition POSITION_BOTTOM = 1
Makes the title appear at the bottom of the container. Also makes all StyleBoxes flipped vertically.
Property Descriptions
FoldableGroup foldable_group 🔗
void set_foldable_group(value: FoldableGroup)
FoldableGroup get_foldable_group()
The FoldableGroup associated with the container.
If true
, the container will becomes folded and will hide all its children.
Language code used for text shaping algorithms. If left empty, current locale is used instead.
The Container's title text.
TextDirection text_direction = 0
🔗
void set_text_direction(value: TextDirection)
TextDirection get_text_direction()
Base text writing direction.
OverrunBehavior text_overrun_behavior = 0
🔗
void set_text_overrun_behavior(value: OverrunBehavior)
OverrunBehavior get_text_overrun_behavior()
Defines the behavior of the FoldableContainer when the text is longer than the available space.
HorizontalAlignment title_alignment = 0
🔗
void set_title_alignment(value: HorizontalAlignment)
HorizontalAlignment get_title_alignment()
Title's horizontal text alignment as defined in the HorizontalAlignment enum.
TitlePosition title_position = 0
🔗
void set_title_position(value: TitlePosition)
TitlePosition get_title_position()
Title's position as defined in the TitlePosition enum.
Method Descriptions
void add_title_bar_control(control: Control) 🔗
Adds a Control that will be placed next to the container's title, obscuring the clickable area. Prime usage is adding Button nodes, but it can be any Control.
The control will be added as a child of this container and removed from previous parent if necessary. The controls will be placed aligned to the right, with the first added control being the leftmost one.
void expand() 🔗
Expands the container and emits folding_changed.
void fold() 🔗
Folds the container and emits folding_changed.
void remove_title_bar_control(control: Control) 🔗
Removes a Control added with add_title_bar_control(). The node is not freed automatically, you need to use Node.queue_free().
Theme Property Descriptions
Color collapsed_font_color = Color(1, 1, 1, 1)
🔗
The title's font color when collapsed.
Color font_color = Color(0.875, 0.875, 0.875, 1)
🔗
The title's font color when expanded.
Color font_outline_color = Color(1, 1, 1, 1)
🔗
The title's font outline color.
Color hover_font_color = Color(0.95, 0.95, 0.95, 1)
🔗
The title's font hover color.
The horizontal separation between the title's icon and text, and between title bar controls.
The title's font outline size.
The title's font.
The title's font size.
The title's icon used when expanded.
Texture2D expanded_arrow_mirrored 🔗
The title's icon used when expanded (for bottom title).
The title's icon used when folded (for left-to-right layouts).
Texture2D folded_arrow_mirrored 🔗
The title's icon used when collapsed (for right-to-left layouts).
Background used when FoldableContainer has GUI focus. The focus StyleBox is displayed over the base StyleBox, so a partially transparent StyleBox should be used to ensure the base StyleBox remains visible. A StyleBox that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a StyleBoxEmpty resource. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons.
Default background for the FoldableContainer.
StyleBox title_collapsed_hover_panel 🔗
Background used when the mouse cursor enters the title's area when collapsed.
StyleBox title_collapsed_panel 🔗
Default background for the FoldableContainer's title when collapsed.
Background used when the mouse cursor enters the title's area when expanded.
Default background for the FoldableContainer's title when expanded.