:github_url: hide .. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the TabContainer.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_TabContainer: TabContainer ============ **Inherits:** :ref:`Container` **<** :ref:`Control` **<** :ref:`CanvasItem` **<** :ref:`Node` **<** :ref:`Object` **Category:** Core Brief Description ----------------- Tabbed Container. Properties ---------- +---------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`current_tab` | +---------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`drag_to_rearrange_enabled` | +---------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`TabAlign` | :ref:`tab_align` | +---------------------------------------------+-----------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`tabs_visible` | +---------------------------------------------+-----------------------------------------------------------------------------------------+ Methods ------- +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Control` | :ref:`get_current_tab_control` **(** **)** const | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Popup` | :ref:`get_popup` **(** **)** const | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_previous_tab` **(** **)** const | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Control` | :ref:`get_tab_control` **(** :ref:`int` idx **)** const | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_tab_count` **(** **)** const | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`get_tab_disabled` **(** :ref:`int` tab_idx **)** const | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Texture` | :ref:`get_tab_icon` **(** :ref:`int` tab_idx **)** const | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_tab_title` **(** :ref:`int` tab_idx **)** const | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_tabs_rearrange_group` **(** **)** const | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_popup` **(** :ref:`Node` popup **)** | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_tab_disabled` **(** :ref:`int` tab_idx, :ref:`bool` disabled **)** | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_tab_icon` **(** :ref:`int` tab_idx, :ref:`Texture` icon **)** | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_tab_title` **(** :ref:`int` tab_idx, :ref:`String` title **)** | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_tabs_rearrange_group` **(** :ref:`int` group_id **)** | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+ Theme Properties ---------------- +---------------------------------+---------------------+ | :ref:`Texture` | decrement | +---------------------------------+---------------------+ | :ref:`Texture` | decrement_highlight | +---------------------------------+---------------------+ | :ref:`Font` | font | +---------------------------------+---------------------+ | :ref:`Color` | font_color_bg | +---------------------------------+---------------------+ | :ref:`Color` | font_color_disabled | +---------------------------------+---------------------+ | :ref:`Color` | font_color_fg | +---------------------------------+---------------------+ | :ref:`int` | hseparation | +---------------------------------+---------------------+ | :ref:`Texture` | increment | +---------------------------------+---------------------+ | :ref:`Texture` | increment_highlight | +---------------------------------+---------------------+ | :ref:`int` | label_valign_bg | +---------------------------------+---------------------+ | :ref:`int` | label_valign_fg | +---------------------------------+---------------------+ | :ref:`Texture` | menu | +---------------------------------+---------------------+ | :ref:`Texture` | menu_highlight | +---------------------------------+---------------------+ | :ref:`StyleBox` | panel | +---------------------------------+---------------------+ | :ref:`int` | side_margin | +---------------------------------+---------------------+ | :ref:`StyleBox` | tab_bg | +---------------------------------+---------------------+ | :ref:`StyleBox` | tab_disabled | +---------------------------------+---------------------+ | :ref:`StyleBox` | tab_fg | +---------------------------------+---------------------+ | :ref:`int` | top_margin | +---------------------------------+---------------------+ Signals ------- .. _class_TabContainer_signal_pre_popup_pressed: - **pre_popup_pressed** **(** **)** Emitted when the ``TabContainer``'s :ref:`Popup` button is clicked. See :ref:`set_popup` for details. ---- .. _class_TabContainer_signal_tab_changed: - **tab_changed** **(** :ref:`int` tab **)** Emitted when switching to another tab. ---- .. _class_TabContainer_signal_tab_selected: - **tab_selected** **(** :ref:`int` tab **)** Emitted when a tab is selected, even if it is the current tab. Enumerations ------------ .. _enum_TabContainer_TabAlign: .. _class_TabContainer_constant_ALIGN_LEFT: .. _class_TabContainer_constant_ALIGN_CENTER: .. _class_TabContainer_constant_ALIGN_RIGHT: enum **TabAlign**: - **ALIGN_LEFT** = **0** --- Align the tabs to the left. - **ALIGN_CENTER** = **1** --- Align the tabs to the center. - **ALIGN_RIGHT** = **2** --- Align the tabs to the right. Description ----------- Sets the active tab's ``visible`` property to the value ``true``. Sets all other children's to ``false``. Ignores non-:ref:`Control` children. Individual tabs are always visible unless you use :ref:`set_tab_disabled` and :ref:`set_tab_title` to hide it. To hide only a tab's content, nest the content inside a child :ref:`Control`, so it receives the ``TabContainer``'s visibility setting instead. Property Descriptions --------------------- .. _class_TabContainer_property_current_tab: - :ref:`int` **current_tab** +----------+------------------------+ | *Setter* | set_current_tab(value) | +----------+------------------------+ | *Getter* | get_current_tab() | +----------+------------------------+ The current tab index. When set, this index's :ref:`Control` node's ``visible`` property is set to ``true`` and all others are set to ``false``. ---- .. _class_TabContainer_property_drag_to_rearrange_enabled: - :ref:`bool` **drag_to_rearrange_enabled** +----------+--------------------------------------+ | *Setter* | set_drag_to_rearrange_enabled(value) | +----------+--------------------------------------+ | *Getter* | get_drag_to_rearrange_enabled() | +----------+--------------------------------------+ If ``true``, tabs can be rearranged with mouse drag. ---- .. _class_TabContainer_property_tab_align: - :ref:`TabAlign` **tab_align** +----------+----------------------+ | *Setter* | set_tab_align(value) | +----------+----------------------+ | *Getter* | get_tab_align() | +----------+----------------------+ The alignment of all tabs in the tab container. See the ``ALIGN_*`` constants for details. ---- .. _class_TabContainer_property_tabs_visible: - :ref:`bool` **tabs_visible** +----------+-------------------------+ | *Setter* | set_tabs_visible(value) | +----------+-------------------------+ | *Getter* | are_tabs_visible() | +----------+-------------------------+ If ``true``, tabs are visible. If ``false``, tabs' content and titles are hidden. Default value: ``true``. Method Descriptions ------------------- .. _class_TabContainer_method_get_current_tab_control: - :ref:`Control` **get_current_tab_control** **(** **)** const Returns the child :ref:`Control` node located at the active tab index. ---- .. _class_TabContainer_method_get_popup: - :ref:`Popup` **get_popup** **(** **)** const Returns the :ref:`Popup` node instance if one has been set already with :ref:`set_popup`. ---- .. _class_TabContainer_method_get_previous_tab: - :ref:`int` **get_previous_tab** **(** **)** const Returns the previously active tab index. ---- .. _class_TabContainer_method_get_tab_control: - :ref:`Control` **get_tab_control** **(** :ref:`int` idx **)** const Returns the currently visible tab's :ref:`Control` node. ---- .. _class_TabContainer_method_get_tab_count: - :ref:`int` **get_tab_count** **(** **)** const Returns the number of tabs. ---- .. _class_TabContainer_method_get_tab_disabled: - :ref:`bool` **get_tab_disabled** **(** :ref:`int` tab_idx **)** const Returns ``true`` if the tab at index ``tab_idx`` is disabled. ---- .. _class_TabContainer_method_get_tab_icon: - :ref:`Texture` **get_tab_icon** **(** :ref:`int` tab_idx **)** const Returns the :ref:`Texture` for the tab at index ``tab_idx`` or null if the tab has no :ref:`Texture`. ---- .. _class_TabContainer_method_get_tab_title: - :ref:`String` **get_tab_title** **(** :ref:`int` tab_idx **)** const Returns the title of the tab at index ``tab_idx``. Tab titles default to the name of the indexed child node, but this can be overridden with :ref:`set_tab_title`. ---- .. _class_TabContainer_method_get_tabs_rearrange_group: - :ref:`int` **get_tabs_rearrange_group** **(** **)** const Returns the ``TabContainer`` rearrange group id. ---- .. _class_TabContainer_method_set_popup: - void **set_popup** **(** :ref:`Node` popup **)** If set on a :ref:`Popup` node instance, a popup menu icon appears in the top-right corner of the ``TabContainer``. Clicking it will expand the :ref:`Popup` node. ---- .. _class_TabContainer_method_set_tab_disabled: - void **set_tab_disabled** **(** :ref:`int` tab_idx, :ref:`bool` disabled **)** If ``disabled`` is ``false``, hides the tab at index ``tab_idx``. Note that its title text will remain, unless also removed with :ref:`set_tab_title`. ---- .. _class_TabContainer_method_set_tab_icon: - void **set_tab_icon** **(** :ref:`int` tab_idx, :ref:`Texture` icon **)** Sets an icon for the tab at index ``tab_idx``. ---- .. _class_TabContainer_method_set_tab_title: - void **set_tab_title** **(** :ref:`int` tab_idx, :ref:`String` title **)** Sets a title for the tab at index ``tab_idx``. Tab titles default to the name of the indexed child node, but this can be overridden with :ref:`set_tab_title`. ---- .. _class_TabContainer_method_set_tabs_rearrange_group: - void **set_tabs_rearrange_group** **(** :ref:`int` group_id **)** Defines rearrange group id, choose for each ``TabContainer`` the same value to enable tab drag between ``TabContainer``. Enable drag with ``set_drag_to_rearrange_enabled(true)``.