class_tabcontainer.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the TabContainer.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_TabContainer:
  5. TabContainer
  6. ============
  7. **Inherits:** :ref:`Control<class_control>` **<** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Tabbed Container.
  12. Member Functions
  13. ----------------
  14. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
  15. | :ref:`Control<class_control>` | :ref:`get_current_tab_control<class_TabContainer_get_current_tab_control>` **(** **)** const |
  16. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`Popup<class_popup>` | :ref:`get_popup<class_TabContainer_get_popup>` **(** **)** const |
  18. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`int<class_int>` | :ref:`get_previous_tab<class_TabContainer_get_previous_tab>` **(** **)** const |
  20. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`Control<class_control>` | :ref:`get_tab_control<class_TabContainer_get_tab_control>` **(** :ref:`int<class_int>` idx **)** const |
  22. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`int<class_int>` | :ref:`get_tab_count<class_TabContainer_get_tab_count>` **(** **)** const |
  24. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`bool<class_bool>` | :ref:`get_tab_disabled<class_TabContainer_get_tab_disabled>` **(** :ref:`int<class_int>` tab_idx **)** const |
  26. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`Texture<class_texture>` | :ref:`get_tab_icon<class_TabContainer_get_tab_icon>` **(** :ref:`int<class_int>` tab_idx **)** const |
  28. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`String<class_string>` | :ref:`get_tab_title<class_TabContainer_get_tab_title>` **(** :ref:`int<class_int>` tab_idx **)** const |
  30. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`int<class_int>` | :ref:`get_tabs_rearrange_group<class_TabContainer_get_tabs_rearrange_group>` **(** **)** const |
  32. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`set_popup<class_TabContainer_set_popup>` **(** :ref:`Node<class_node>` popup **)** |
  34. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`set_tab_disabled<class_TabContainer_set_tab_disabled>` **(** :ref:`int<class_int>` tab_idx, :ref:`bool<class_bool>` disabled **)** |
  36. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
  37. | void | :ref:`set_tab_icon<class_TabContainer_set_tab_icon>` **(** :ref:`int<class_int>` tab_idx, :ref:`Texture<class_texture>` icon **)** |
  38. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
  39. | void | :ref:`set_tab_title<class_TabContainer_set_tab_title>` **(** :ref:`int<class_int>` tab_idx, :ref:`String<class_string>` title **)** |
  40. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
  41. | void | :ref:`set_tabs_rearrange_group<class_TabContainer_set_tabs_rearrange_group>` **(** :ref:`int<class_int>` group_id **)** |
  42. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
  43. Signals
  44. -------
  45. .. _class_TabContainer_pre_popup_pressed:
  46. - **pre_popup_pressed** **(** **)**
  47. Emitted when the ``TabContainer``'s :ref:`Popup<class_popup>` button is clicked. See :ref:`set_popup<class_TabContainer_set_popup>` for details.
  48. .. _class_TabContainer_tab_changed:
  49. - **tab_changed** **(** :ref:`int<class_int>` tab **)**
  50. Emitted when switching to another tab.
  51. .. _class_TabContainer_tab_selected:
  52. - **tab_selected** **(** :ref:`int<class_int>` tab **)**
  53. Emitted when a tab is selected, even if it is the current tab.
  54. Member Variables
  55. ----------------
  56. .. _class_TabContainer_current_tab:
  57. - :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``.
  58. .. _class_TabContainer_drag_to_rearrange_enabled:
  59. - :ref:`bool<class_bool>` **drag_to_rearrange_enabled**
  60. .. _class_TabContainer_tab_align:
  61. - :ref:`TabAlign<enum_tabcontainer_tabalign>` **tab_align** - The alignment of all tabs in the tab container. See the ``ALIGN_*`` constants for details.
  62. .. _class_TabContainer_tabs_visible:
  63. - :ref:`bool<class_bool>` **tabs_visible** - If ``true`` tabs are visible. If ``false`` tabs' content and titles are hidden. Default value: ``true``.
  64. Enums
  65. -----
  66. .. _enum_TabContainer_TabAlign:
  67. enum **TabAlign**
  68. - **ALIGN_LEFT** = **0**
  69. - **ALIGN_CENTER** = **1**
  70. - **ALIGN_RIGHT** = **2**
  71. Description
  72. -----------
  73. Sets the active tab's ``visible`` property to the value ``true``. Sets all other children's to ``false``.
  74. Ignores non-:ref:`Control<class_control>` children.
  75. 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.
  76. 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.
  77. Member Function Description
  78. ---------------------------
  79. .. _class_TabContainer_get_current_tab_control:
  80. - :ref:`Control<class_control>` **get_current_tab_control** **(** **)** const
  81. Returns the child :ref:`Control<class_control>` node located at the active tab index.
  82. .. _class_TabContainer_get_popup:
  83. - :ref:`Popup<class_popup>` **get_popup** **(** **)** const
  84. Returns the :ref:`Popup<class_popup>` node instance if one has been set already with :ref:`set_popup<class_TabContainer_set_popup>`.
  85. .. _class_TabContainer_get_previous_tab:
  86. - :ref:`int<class_int>` **get_previous_tab** **(** **)** const
  87. Returns the previously active tab index.
  88. .. _class_TabContainer_get_tab_control:
  89. - :ref:`Control<class_control>` **get_tab_control** **(** :ref:`int<class_int>` idx **)** const
  90. Returns the currently visible tab's :ref:`Control<class_control>` node.
  91. .. _class_TabContainer_get_tab_count:
  92. - :ref:`int<class_int>` **get_tab_count** **(** **)** const
  93. Returns the number of tabs.
  94. .. _class_TabContainer_get_tab_disabled:
  95. - :ref:`bool<class_bool>` **get_tab_disabled** **(** :ref:`int<class_int>` tab_idx **)** const
  96. Returns ``true`` if the tab at index ``tab_idx`` is disabled.
  97. .. _class_TabContainer_get_tab_icon:
  98. - :ref:`Texture<class_texture>` **get_tab_icon** **(** :ref:`int<class_int>` tab_idx **)** const
  99. Returns the :ref:`Texture<class_texture>` for the tab at index ``tab_idx`` or null if the tab has no :ref:`Texture<class_texture>`.
  100. .. _class_TabContainer_get_tab_title:
  101. - :ref:`String<class_string>` **get_tab_title** **(** :ref:`int<class_int>` tab_idx **)** const
  102. 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>`.
  103. .. _class_TabContainer_get_tabs_rearrange_group:
  104. - :ref:`int<class_int>` **get_tabs_rearrange_group** **(** **)** const
  105. .. _class_TabContainer_set_popup:
  106. - void **set_popup** **(** :ref:`Node<class_node>` popup **)**
  107. 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.
  108. .. _class_TabContainer_set_tab_disabled:
  109. - void **set_tab_disabled** **(** :ref:`int<class_int>` tab_idx, :ref:`bool<class_bool>` disabled **)**
  110. 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>`.
  111. .. _class_TabContainer_set_tab_icon:
  112. - void **set_tab_icon** **(** :ref:`int<class_int>` tab_idx, :ref:`Texture<class_texture>` icon **)**
  113. Sets an icon for the tab at index ``tab_idx``.
  114. .. _class_TabContainer_set_tab_title:
  115. - void **set_tab_title** **(** :ref:`int<class_int>` tab_idx, :ref:`String<class_string>` title **)**
  116. 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>`.
  117. .. _class_TabContainer_set_tabs_rearrange_group:
  118. - void **set_tabs_rearrange_group** **(** :ref:`int<class_int>` group_id **)**