Up to date
This page is up to date for Godot 4.3
.
If you still find outdated information, please open an issue.
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 contain 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ΒΆ
Theme PropertiesΒΆ
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
SignalsΒΆ
button_pressed(index: int) π
Emitted when a button is pressed.
button_toggled(toggled_on: bool, index: int) π
Emitted when a button is toggled.
folding_changed(is_folded: bool) π
Emitted when the container is folded/expanded.
EnumerationsΒΆ
enum TitlePosition: π
TitlePosition POSITION_TOP = 0
Make the title appear at the top of the container.
TitlePosition POSITION_BOTTOM = 1
Make the title appear at the bottom of the container.
Property DescriptionsΒΆ
The title buttons count, changing this will change the buttons array size which can add/remove buttons automatically.
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 it's 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_button(icon: Texture2D = null, position: int = -1, id: int = -1) π
Adds a button to the title.
void clear() π
Remove all the title buttons.
void expand() π
Expands the container and emits folding_changed.
void fold() π
Folds the container and emits folding_changed.
int get_button_at_position(position: Vector2) const π
Returns the button's index if the given position is inisde the button's rect. Returns -1 if no button was found at this position.
Texture2D get_button_icon(index: int) const π
Returns the icon of the button at the given index.
int get_button_id(index: int) const π
Returns the ID of the button at the given index.
int get_button_index(id: int) const π
Returns the index of the button with the given ID.
Variant get_button_metadata(index: int) const π
Returns the metadata for the button at the given index.
Rect2 get_button_rect(index: int) const π
Returns the Rect2 which represents the position and size of the button.
bool get_button_toggle_mode(index: int) const π
Returns whether the button at the given index is a toggle button.
String get_button_tooltip(index: int) const π
Returns the tooltip for the button at the given index.
bool is_button_auto_hide(index: int) const π
Returns true
if the button at the given index hides when the container is folded otherwise returns false
.
bool is_button_disabled(index: int) const π
Returns whether the button at the given index is disabled.
bool is_button_toggled(index: int) const π
Returns whether the button at the given index is toggled on/off.
bool is_button_visible(index: int) const π
Returns whether the button is visible/hidden.
Returns whether the container is expanded/folded.
int move_button(from: int, to: int) π
Changes the button's index.
void remove_button(index: int) π
Removes the button at the given index.
void set_button_auto_hide(index: int, auto_hide: bool) π
If true
, the button at the given index hides when the container is folded.
void set_button_disabled(index: int, disabled: bool) π
Disables the button at the given index.
void set_button_icon(index: int, icon: Texture2D) π
Changes the icon of the button at the given index.
void set_button_id(index: int, id: int) π
Changes the ID of the button at the given index.
void set_button_metadata(index: int, metadata: Variant) π
Set the metadata for the button at the given index.
void set_button_toggle_mode(index: int, enabled: bool) π
Set the button at the given index to be a toggle button.
void set_button_toggled(index: int, toggled_on: bool) π
Set the button at the given index as toggled on/off.
void set_button_tooltip(index: int, tooltip: String) π
Sets the tooltip for the button at the given index.
void set_button_visible(index: int, hidden: bool) π
Toggles the visibility of the button at the given index.
void set_expanded(expanded: bool) π
If true
, the container will becomes expanded and will show all it's children.
See also folded.
Theme Property DescriptionsΒΆ
Color arrow_collapsed_color = Color(0.226, 0.478, 0.921, 1)
π
The arrow's icon color when collapsed.
Color arrow_hover_color = Color(0.875, 0.875, 0.875, 1)
π
The arrow's icon color when hovered and expanded.
Color arrow_normal_color = Color(0.875, 0.875, 0.875, 0.8)
π
The arrow's icon color expanded.
Color button_icon_disabled = Color(0.875, 0.875, 0.875, 0.4)
π
The title's icon color when disabled.
Color button_icon_hovered = Color(0.875, 0.875, 0.875, 1)
π
The title's icon color when hovered.
Color button_icon_normal = Color(0.875, 0.875, 0.875, 0.8)
π
The title's icon color when normal.
Color button_icon_pressed = Color(0.226, 0.478, 0.921, 1)
π
The title's icon color when pressed.
Color collapsed_font_color = Color(0.226, 0.478, 0.921, 1)
π
The title's font color when collapsed.
Color font_color = Color(0.875, 0.875, 0.875, 0.8)
π
The title's font color when expanded.
Color font_outline_color = Color(0, 0, 0, 1)
π
The title's font outline color.
Color hover_font_color = Color(0.875, 0.875, 0.875, 1)
π
The title's font hover color.
The horizontal separation between the title's icon and text.
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).
StyleBox button_disabled_style π
The title's button disabled style.
StyleBox button_hovered_style π
The title's button hover style.
StyleBox button_normal_style π
The title's button normal style.
StyleBox button_pressed_style π
The title's button pressed style.
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.
StyleBox title_hover_panel π
Background used when the mouse cursor enters the title's area when expanded.
Default background for the FoldableContainer's title when expanded.