class_tabcontainer.rst 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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:`int<class_int>` **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. Numeric Constants
  59. -----------------
  60. - **ALIGN_LEFT** = **0**
  61. - **ALIGN_CENTER** = **1**
  62. - **ALIGN_RIGHT** = **2**
  63. Description
  64. -----------
  65. Sets the active tab's ``visible`` property to the value ``true``. Sets all other children's to ``false``.
  66. Ignores non-:ref:`Control<class_control>` children.
  67. 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.
  68. 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.
  69. Member Function Description
  70. ---------------------------
  71. .. _class_TabContainer_get_current_tab_control:
  72. - :ref:`Control<class_control>` **get_current_tab_control** **(** **)** const
  73. Returns the child :ref:`Control<class_control>` node located at the active tab index.
  74. .. _class_TabContainer_get_popup:
  75. - :ref:`Popup<class_popup>` **get_popup** **(** **)** const
  76. Returns the :ref:`Popup<class_popup>` node instance if one has been set already with :ref:`set_popup<class_TabContainer_set_popup>`.
  77. .. _class_TabContainer_get_previous_tab:
  78. - :ref:`int<class_int>` **get_previous_tab** **(** **)** const
  79. Returns the previously active tab index.
  80. .. _class_TabContainer_get_tab_control:
  81. - :ref:`Control<class_control>` **get_tab_control** **(** :ref:`int<class_int>` idx **)** const
  82. Returns the currently visible tab's :ref:`Control<class_control>` node.
  83. .. _class_TabContainer_get_tab_count:
  84. - :ref:`int<class_int>` **get_tab_count** **(** **)** const
  85. Returns the number of tabs.
  86. .. _class_TabContainer_get_tab_disabled:
  87. - :ref:`bool<class_bool>` **get_tab_disabled** **(** :ref:`int<class_int>` tab_idx **)** const
  88. Returns ``true`` if the tab at index ``tab_idx`` is disabled.
  89. .. _class_TabContainer_get_tab_icon:
  90. - :ref:`Texture<class_texture>` **get_tab_icon** **(** :ref:`int<class_int>` tab_idx **)** const
  91. Returns the :ref:`Texture<class_texture>` for the tab at index ``tab_idx`` or null if the tab has no :ref:`Texture<class_texture>`.
  92. .. _class_TabContainer_get_tab_title:
  93. - :ref:`String<class_string>` **get_tab_title** **(** :ref:`int<class_int>` tab_idx **)** const
  94. 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>`.
  95. .. _class_TabContainer_set_popup:
  96. - void **set_popup** **(** :ref:`Node<class_node>` popup **)**
  97. 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.
  98. .. _class_TabContainer_set_tab_disabled:
  99. - void **set_tab_disabled** **(** :ref:`int<class_int>` tab_idx, :ref:`bool<class_bool>` disabled **)**
  100. 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>`.
  101. .. _class_TabContainer_set_tab_icon:
  102. - void **set_tab_icon** **(** :ref:`int<class_int>` tab_idx, :ref:`Texture<class_texture>` icon **)**
  103. Sets an icon for the tab at index ``tab_idx``.
  104. .. _class_TabContainer_set_tab_title:
  105. - void **set_tab_title** **(** :ref:`int<class_int>` tab_idx, :ref:`String<class_string>` title **)**
  106. 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>`.