class_tabcontainer.rst 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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. | void | :ref:`set_popup<class_TabContainer_set_popup>` **(** :ref:`Node<class_node>` popup **)** |
  32. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`set_tab_disabled<class_TabContainer_set_tab_disabled>` **(** :ref:`int<class_int>` tab_idx, :ref:`bool<class_bool>` disabled **)** |
  34. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`set_tab_icon<class_TabContainer_set_tab_icon>` **(** :ref:`int<class_int>` tab_idx, :ref:`Texture<class_texture>` icon **)** |
  36. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
  37. | void | :ref:`set_tab_title<class_TabContainer_set_tab_title>` **(** :ref:`int<class_int>` tab_idx, :ref:`String<class_string>` title **)** |
  38. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------+
  39. Signals
  40. -------
  41. .. _class_TabContainer_pre_popup_pressed:
  42. - **pre_popup_pressed** **(** **)**
  43. Emitted when the ``TabContainer``'s :ref:`Popup<class_popup>` button is clicked. See :ref:`set_popup<class_TabContainer_set_popup>` for details.
  44. .. _class_TabContainer_tab_changed:
  45. - **tab_changed** **(** :ref:`int<class_int>` tab **)**
  46. Emitted when switching to another tab.
  47. .. _class_TabContainer_tab_selected:
  48. - **tab_selected** **(** :ref:`int<class_int>` tab **)**
  49. Emitted when a tab is selected, even if it is the current tab.
  50. Member Variables
  51. ----------------
  52. .. _class_TabContainer_current_tab:
  53. - :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``.
  54. .. _class_TabContainer_tab_align:
  55. - :ref:`TabAlign<enum_tabcontainer_tabalign>` **tab_align** - The alignment of all tabs in the tab container. See the ``ALIGN_*`` constants for details.
  56. .. _class_TabContainer_tabs_visible:
  57. - :ref:`bool<class_bool>` **tabs_visible** - If ``true`` tabs are visible. If ``false`` tabs' content and titles are hidden. Default value: ``true``.
  58. Enums
  59. -----
  60. .. _enum_TabContainer_TabAlign:
  61. enum **TabAlign**
  62. - **ALIGN_LEFT** = **0**
  63. - **ALIGN_CENTER** = **1**
  64. - **ALIGN_RIGHT** = **2**
  65. Description
  66. -----------
  67. Sets the active tab's ``visible`` property to the value ``true``. Sets all other children's to ``false``.
  68. Ignores non-:ref:`Control<class_control>` children.
  69. 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.
  70. 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.
  71. Member Function Description
  72. ---------------------------
  73. .. _class_TabContainer_get_current_tab_control:
  74. - :ref:`Control<class_control>` **get_current_tab_control** **(** **)** const
  75. Returns the child :ref:`Control<class_control>` node located at the active tab index.
  76. .. _class_TabContainer_get_popup:
  77. - :ref:`Popup<class_popup>` **get_popup** **(** **)** const
  78. Returns the :ref:`Popup<class_popup>` node instance if one has been set already with :ref:`set_popup<class_TabContainer_set_popup>`.
  79. .. _class_TabContainer_get_previous_tab:
  80. - :ref:`int<class_int>` **get_previous_tab** **(** **)** const
  81. Returns the previously active tab index.
  82. .. _class_TabContainer_get_tab_control:
  83. - :ref:`Control<class_control>` **get_tab_control** **(** :ref:`int<class_int>` idx **)** const
  84. Returns the currently visible tab's :ref:`Control<class_control>` node.
  85. .. _class_TabContainer_get_tab_count:
  86. - :ref:`int<class_int>` **get_tab_count** **(** **)** const
  87. Returns the number of tabs.
  88. .. _class_TabContainer_get_tab_disabled:
  89. - :ref:`bool<class_bool>` **get_tab_disabled** **(** :ref:`int<class_int>` tab_idx **)** const
  90. Returns ``true`` if the tab at index ``tab_idx`` is disabled.
  91. .. _class_TabContainer_get_tab_icon:
  92. - :ref:`Texture<class_texture>` **get_tab_icon** **(** :ref:`int<class_int>` tab_idx **)** const
  93. Returns the :ref:`Texture<class_texture>` for the tab at index ``tab_idx`` or null if the tab has no :ref:`Texture<class_texture>`.
  94. .. _class_TabContainer_get_tab_title:
  95. - :ref:`String<class_string>` **get_tab_title** **(** :ref:`int<class_int>` tab_idx **)** const
  96. 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>`.
  97. .. _class_TabContainer_set_popup:
  98. - void **set_popup** **(** :ref:`Node<class_node>` popup **)**
  99. 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.
  100. .. _class_TabContainer_set_tab_disabled:
  101. - void **set_tab_disabled** **(** :ref:`int<class_int>` tab_idx, :ref:`bool<class_bool>` disabled **)**
  102. 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>`.
  103. .. _class_TabContainer_set_tab_icon:
  104. - void **set_tab_icon** **(** :ref:`int<class_int>` tab_idx, :ref:`Texture<class_texture>` icon **)**
  105. Sets an icon for the tab at index ``tab_idx``.
  106. .. _class_TabContainer_set_tab_title:
  107. - void **set_tab_title** **(** :ref:`int<class_int>` tab_idx, :ref:`String<class_string>` title **)**
  108. 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>`.