:github_url: hide .. meta:: :keywords: expandable, collapsible, collapse .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/FoldableContainer.xml. .. _class_FoldableContainer: FoldableContainer ================= **Inherits:** :ref:`Container` **<** :ref:`Control` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` A container that can be expanded/collapsed. .. rst-class:: classref-introduction-group 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 :ref:`foldable_group` and :ref:`FoldableGroup`. .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+ | :ref:`FocusMode` | focus_mode | ``2`` (overrides :ref:`Control`) | +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+ | :ref:`FoldableGroup` | :ref:`foldable_group` | | +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+ | :ref:`bool` | :ref:`folded` | ``false`` | +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+ | :ref:`String` | :ref:`language` | ``""`` | +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+ | :ref:`MouseFilter` | mouse_filter | ``0`` (overrides :ref:`Control`) | +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+ | :ref:`String` | :ref:`title` | ``""`` | +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+ | :ref:`HorizontalAlignment` | :ref:`title_alignment` | ``0`` | +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+ | :ref:`TitlePosition` | :ref:`title_position` | ``0`` | +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+ | :ref:`TextDirection` | :ref:`title_text_direction` | ``0`` | +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+ | :ref:`OverrunBehavior` | :ref:`title_text_overrun_behavior` | ``0`` | +-------------------------------------------------------------------+--------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------+ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +--------+-----------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`add_title_bar_control`\ (\ control\: :ref:`Control`\ ) | +--------+-----------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`expand`\ (\ ) | +--------+-----------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`fold`\ (\ ) | +--------+-----------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`remove_title_bar_control`\ (\ control\: :ref:`Control`\ ) | +--------+-----------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-reftable-group Theme Properties ---------------- .. table:: :widths: auto +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Color` | :ref:`collapsed_font_color` | ``Color(1, 1, 1, 1)`` | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Color` | :ref:`font_color` | ``Color(0.875, 0.875, 0.875, 1)`` | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Color` | :ref:`font_outline_color` | ``Color(1, 1, 1, 1)`` | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Color` | :ref:`hover_font_color` | ``Color(0.95, 0.95, 0.95, 1)`` | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`int` | :ref:`h_separation` | ``2`` | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`int` | :ref:`outline_size` | ``0`` | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Font` | :ref:`font` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`int` | :ref:`font_size` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Texture2D` | :ref:`expanded_arrow` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Texture2D` | :ref:`expanded_arrow_mirrored` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Texture2D` | :ref:`folded_arrow` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Texture2D` | :ref:`folded_arrow_mirrored` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`StyleBox` | :ref:`focus` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`StyleBox` | :ref:`panel` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`StyleBox` | :ref:`title_collapsed_hover_panel` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`StyleBox` | :ref:`title_collapsed_panel` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`StyleBox` | :ref:`title_hover_panel` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`StyleBox` | :ref:`title_panel` | | +-----------------------------------+-----------------------------------------------------------------------------------------------------+-----------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Signals ------- .. _class_FoldableContainer_signal_folding_changed: .. rst-class:: classref-signal **folding_changed**\ (\ is_folded\: :ref:`bool`\ ) :ref:`🔗` Emitted when the container is folded/expanded. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Enumerations ------------ .. _enum_FoldableContainer_TitlePosition: .. rst-class:: classref-enumeration enum **TitlePosition**: :ref:`🔗` .. _class_FoldableContainer_constant_POSITION_TOP: .. rst-class:: classref-enumeration-constant :ref:`TitlePosition` **POSITION_TOP** = ``0`` Makes the title appear at the top of the container. .. _class_FoldableContainer_constant_POSITION_BOTTOM: .. rst-class:: classref-enumeration-constant :ref:`TitlePosition` **POSITION_BOTTOM** = ``1`` Makes the title appear at the bottom of the container. Also makes all StyleBoxes flipped vertically. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_FoldableContainer_property_foldable_group: .. rst-class:: classref-property :ref:`FoldableGroup` **foldable_group** :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_foldable_group**\ (\ value\: :ref:`FoldableGroup`\ ) - :ref:`FoldableGroup` **get_foldable_group**\ (\ ) The :ref:`FoldableGroup` associated with the container. When multiple **FoldableContainer** nodes share the same group, only one of them is allowed to be unfolded. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_property_folded: .. rst-class:: classref-property :ref:`bool` **folded** = ``false`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_folded**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_folded**\ (\ ) If ``true``, the container will becomes folded and will hide all its children. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_property_language: .. rst-class:: classref-property :ref:`String` **language** = ``""`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_language**\ (\ value\: :ref:`String`\ ) - :ref:`String` **get_language**\ (\ ) Language code used for text shaping algorithms. If left empty, current locale is used instead. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_property_title: .. rst-class:: classref-property :ref:`String` **title** = ``""`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_title**\ (\ value\: :ref:`String`\ ) - :ref:`String` **get_title**\ (\ ) The container's title text. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_property_title_alignment: .. rst-class:: classref-property :ref:`HorizontalAlignment` **title_alignment** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_title_alignment**\ (\ value\: :ref:`HorizontalAlignment`\ ) - :ref:`HorizontalAlignment` **get_title_alignment**\ (\ ) Title's horizontal text alignment. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_property_title_position: .. rst-class:: classref-property :ref:`TitlePosition` **title_position** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_title_position**\ (\ value\: :ref:`TitlePosition`\ ) - :ref:`TitlePosition` **get_title_position**\ (\ ) Title's position. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_property_title_text_direction: .. rst-class:: classref-property :ref:`TextDirection` **title_text_direction** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_title_text_direction**\ (\ value\: :ref:`TextDirection`\ ) - :ref:`TextDirection` **get_title_text_direction**\ (\ ) Title text writing direction. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_property_title_text_overrun_behavior: .. rst-class:: classref-property :ref:`OverrunBehavior` **title_text_overrun_behavior** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_title_text_overrun_behavior**\ (\ value\: :ref:`OverrunBehavior`\ ) - :ref:`OverrunBehavior` **get_title_text_overrun_behavior**\ (\ ) Defines the behavior of the title when the text is longer than the available space. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_FoldableContainer_method_add_title_bar_control: .. rst-class:: classref-method |void| **add_title_bar_control**\ (\ control\: :ref:`Control`\ ) :ref:`🔗` Adds a :ref:`Control` that will be placed next to the container's title, obscuring the clickable area. Prime usage is adding :ref:`Button` nodes, but it can be any :ref:`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. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_method_expand: .. rst-class:: classref-method |void| **expand**\ (\ ) :ref:`🔗` Expands the container and emits :ref:`folding_changed`. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_method_fold: .. rst-class:: classref-method |void| **fold**\ (\ ) :ref:`🔗` Folds the container and emits :ref:`folding_changed`. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_method_remove_title_bar_control: .. rst-class:: classref-method |void| **remove_title_bar_control**\ (\ control\: :ref:`Control`\ ) :ref:`🔗` Removes a :ref:`Control` added with :ref:`add_title_bar_control()`. The node is not freed automatically, you need to use :ref:`Node.queue_free()`. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Theme Property Descriptions --------------------------- .. _class_FoldableContainer_theme_color_collapsed_font_color: .. rst-class:: classref-themeproperty :ref:`Color` **collapsed_font_color** = ``Color(1, 1, 1, 1)`` :ref:`🔗` The title's font color when collapsed. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_color_font_color: .. rst-class:: classref-themeproperty :ref:`Color` **font_color** = ``Color(0.875, 0.875, 0.875, 1)`` :ref:`🔗` The title's font color when expanded. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_color_font_outline_color: .. rst-class:: classref-themeproperty :ref:`Color` **font_outline_color** = ``Color(1, 1, 1, 1)`` :ref:`🔗` The title's font outline color. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_color_hover_font_color: .. rst-class:: classref-themeproperty :ref:`Color` **hover_font_color** = ``Color(0.95, 0.95, 0.95, 1)`` :ref:`🔗` The title's font hover color. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_constant_h_separation: .. rst-class:: classref-themeproperty :ref:`int` **h_separation** = ``2`` :ref:`🔗` The horizontal separation between the title's icon and text, and between title bar controls. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_constant_outline_size: .. rst-class:: classref-themeproperty :ref:`int` **outline_size** = ``0`` :ref:`🔗` The title's font outline size. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_font_font: .. rst-class:: classref-themeproperty :ref:`Font` **font** :ref:`🔗` The title's font. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_font_size_font_size: .. rst-class:: classref-themeproperty :ref:`int` **font_size** :ref:`🔗` The title's font size. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_icon_expanded_arrow: .. rst-class:: classref-themeproperty :ref:`Texture2D` **expanded_arrow** :ref:`🔗` The title's icon used when expanded. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_icon_expanded_arrow_mirrored: .. rst-class:: classref-themeproperty :ref:`Texture2D` **expanded_arrow_mirrored** :ref:`🔗` The title's icon used when expanded (for bottom title). .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_icon_folded_arrow: .. rst-class:: classref-themeproperty :ref:`Texture2D` **folded_arrow** :ref:`🔗` The title's icon used when folded (for left-to-right layouts). .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_icon_folded_arrow_mirrored: .. rst-class:: classref-themeproperty :ref:`Texture2D` **folded_arrow_mirrored** :ref:`🔗` The title's icon used when collapsed (for right-to-left layouts). .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_style_focus: .. rst-class:: classref-themeproperty :ref:`StyleBox` **focus** :ref:`🔗` Background used when **FoldableContainer** has GUI focus. The :ref:`focus` :ref:`StyleBox` is displayed *over* the base :ref:`StyleBox`, so a partially transparent :ref:`StyleBox` should be used to ensure the base :ref:`StyleBox` remains visible. A :ref:`StyleBox` that represents an outline or an underline works well for this purpose. To disable the focus visual effect, assign a :ref:`StyleBoxEmpty` resource. Note that disabling the focus visual effect will harm keyboard/controller navigation usability, so this is not recommended for accessibility reasons. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_style_panel: .. rst-class:: classref-themeproperty :ref:`StyleBox` **panel** :ref:`🔗` Default background for the **FoldableContainer**. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_style_title_collapsed_hover_panel: .. rst-class:: classref-themeproperty :ref:`StyleBox` **title_collapsed_hover_panel** :ref:`🔗` Background used when the mouse cursor enters the title's area when collapsed. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_style_title_collapsed_panel: .. rst-class:: classref-themeproperty :ref:`StyleBox` **title_collapsed_panel** :ref:`🔗` Default background for the **FoldableContainer**'s title when collapsed. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_style_title_hover_panel: .. rst-class:: classref-themeproperty :ref:`StyleBox` **title_hover_panel** :ref:`🔗` Background used when the mouse cursor enters the title's area when expanded. .. rst-class:: classref-item-separator ---- .. _class_FoldableContainer_theme_style_title_panel: .. rst-class:: classref-themeproperty :ref:`StyleBox` **title_panel** :ref:`🔗` Default background for the **FoldableContainer**'s title when expanded. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)` .. |void| replace:: :abbr:`void (No return value.)`