Files
godot-docs/classes/class_tabcontainer.rst
2018-02-19 10:48:33 +01:00

185 lines
9.5 KiB
ReStructuredText

.. 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/<name>/doc_classes.
.. _class_TabContainer:
TabContainer
============
**Inherits:** :ref:`Control<class_control>` **<** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
**Category:** Core
Brief Description
-----------------
Tabbed Container.
Member Functions
----------------
+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Control<class_control>` | :ref:`get_current_tab_control<class_TabContainer_get_current_tab_control>` **(** **)** const |
+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Popup<class_popup>` | :ref:`get_popup<class_TabContainer_get_popup>` **(** **)** const |
+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_previous_tab<class_TabContainer_get_previous_tab>` **(** **)** const |
+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Control<class_control>` | :ref:`get_tab_control<class_TabContainer_get_tab_control>` **(** :ref:`int<class_int>` idx **)** const |
+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_tab_count<class_TabContainer_get_tab_count>` **(** **)** const |
+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`get_tab_disabled<class_TabContainer_get_tab_disabled>` **(** :ref:`int<class_int>` tab_idx **)** const |
+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Texture<class_texture>` | :ref:`get_tab_icon<class_TabContainer_get_tab_icon>` **(** :ref:`int<class_int>` tab_idx **)** const |
+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_string>` | :ref:`get_tab_title<class_TabContainer_get_tab_title>` **(** :ref:`int<class_int>` tab_idx **)** const |
+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_popup<class_TabContainer_set_popup>` **(** :ref:`Node<class_node>` popup **)** |
+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_tab_disabled<class_TabContainer_set_tab_disabled>` **(** :ref:`int<class_int>` tab_idx, :ref:`bool<class_bool>` disabled **)** |
+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_tab_icon<class_TabContainer_set_tab_icon>` **(** :ref:`int<class_int>` tab_idx, :ref:`Texture<class_texture>` icon **)** |
+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_tab_title<class_TabContainer_set_tab_title>` **(** :ref:`int<class_int>` tab_idx, :ref:`String<class_string>` title **)** |
+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
Signals
-------
.. _class_TabContainer_pre_popup_pressed:
- **pre_popup_pressed** **(** **)**
Emitted when the ``TabContainer``'s :ref:`Popup<class_popup>` button is clicked. See :ref:`set_popup<class_TabContainer_set_popup>` for details.
.. _class_TabContainer_tab_changed:
- **tab_changed** **(** :ref:`int<class_int>` tab **)**
Emitted when switching to another tab.
.. _class_TabContainer_tab_selected:
- **tab_selected** **(** :ref:`int<class_int>` tab **)**
Emitted when a tab is selected, even if it is the current tab.
Member Variables
----------------
.. _class_TabContainer_current_tab:
- :ref:`int<class_int>` **current_tab** - The current tab index. When set, this index's :ref:`Control<class_control>` node's ``visible`` property is set to ``true`` and all others are set to ``false``.
.. _class_TabContainer_tab_align:
- :ref:`TabAlign<enum_tabcontainer_tabalign>` **tab_align** - The alignment of all tabs in the tab container. See the ``ALIGN_*`` constants for details.
.. _class_TabContainer_tabs_visible:
- :ref:`bool<class_bool>` **tabs_visible** - If ``true`` tabs are visible. If ``false`` tabs' content and titles are hidden. Default value: ``true``.
Enums
-----
.. _enum_TabContainer_TabAlign:
enum **TabAlign**
- **ALIGN_LEFT** = **0**
- **ALIGN_CENTER** = **1**
- **ALIGN_RIGHT** = **2**
Description
-----------
Sets the active tab's ``visible`` property to the value ``true``. Sets all other children's to ``false``.
Ignores non-:ref:`Control<class_control>` children.
Individual tabs are always visible unless you use :ref:`set_tab_disabled<class_TabContainer_set_tab_disabled>` and :ref:`set_tab_title<class_TabContainer_set_tab_title>` to hide it.
To hide only a tab's content, nest the content inside a child :ref:`Control<class_control>`, so it receives the ``TabContainer``'s visibility setting instead.
Member Function Description
---------------------------
.. _class_TabContainer_get_current_tab_control:
- :ref:`Control<class_control>` **get_current_tab_control** **(** **)** const
Returns the child :ref:`Control<class_control>` node located at the active tab index.
.. _class_TabContainer_get_popup:
- :ref:`Popup<class_popup>` **get_popup** **(** **)** const
Returns the :ref:`Popup<class_popup>` node instance if one has been set already with :ref:`set_popup<class_TabContainer_set_popup>`.
.. _class_TabContainer_get_previous_tab:
- :ref:`int<class_int>` **get_previous_tab** **(** **)** const
Returns the previously active tab index.
.. _class_TabContainer_get_tab_control:
- :ref:`Control<class_control>` **get_tab_control** **(** :ref:`int<class_int>` idx **)** const
Returns the currently visible tab's :ref:`Control<class_control>` node.
.. _class_TabContainer_get_tab_count:
- :ref:`int<class_int>` **get_tab_count** **(** **)** const
Returns the number of tabs.
.. _class_TabContainer_get_tab_disabled:
- :ref:`bool<class_bool>` **get_tab_disabled** **(** :ref:`int<class_int>` tab_idx **)** const
Returns ``true`` if the tab at index ``tab_idx`` is disabled.
.. _class_TabContainer_get_tab_icon:
- :ref:`Texture<class_texture>` **get_tab_icon** **(** :ref:`int<class_int>` tab_idx **)** const
Returns the :ref:`Texture<class_texture>` for the tab at index ``tab_idx`` or null if the tab has no :ref:`Texture<class_texture>`.
.. _class_TabContainer_get_tab_title:
- :ref:`String<class_string>` **get_tab_title** **(** :ref:`int<class_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_set_tab_title>`.
.. _class_TabContainer_set_popup:
- void **set_popup** **(** :ref:`Node<class_node>` popup **)**
If set on a :ref:`Popup<class_popup>` node instance, a popup menu icon appears in the top-right corner of the ``TabContainer``. Clicking it will expand the :ref:`Popup<class_popup>` node.
.. _class_TabContainer_set_tab_disabled:
- void **set_tab_disabled** **(** :ref:`int<class_int>` tab_idx, :ref:`bool<class_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_set_tab_title>`.
.. _class_TabContainer_set_tab_icon:
- void **set_tab_icon** **(** :ref:`int<class_int>` tab_idx, :ref:`Texture<class_texture>` icon **)**
Sets an icon for the tab at index ``tab_idx``.
.. _class_TabContainer_set_tab_title:
- void **set_tab_title** **(** :ref:`int<class_int>` tab_idx, :ref:`String<class_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_set_tab_title>`.