class_tabcontainer.rst 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/4.0/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.0/doc/classes/TabContainer.xml.
  6. .. _class_TabContainer:
  7. TabContainer
  8. ============
  9. **Inherits:** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. A container that creates a tab for each child control, displaying only the active tab's control.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Arranges child controls into a tabbed view, creating a tab for each one. The active tab's corresponding control is made visible, while all other child controls are hidden. Ignores non-control children.
  15. \ **Note:** The drawing of the clickable tabs is handled by this node; :ref:`TabBar<class_TabBar>` is not needed.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - :doc:`Using Containers <../tutorials/ui/gui_containers>`
  20. .. rst-class:: classref-reftable-group
  21. Properties
  22. ----------
  23. .. table::
  24. :widths: auto
  25. +-------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  26. | :ref:`bool<class_bool>` | :ref:`all_tabs_in_front<class_TabContainer_property_all_tabs_in_front>` | ``false`` |
  27. +-------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  28. | :ref:`bool<class_bool>` | :ref:`clip_tabs<class_TabContainer_property_clip_tabs>` | ``true`` |
  29. +-------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  30. | :ref:`int<class_int>` | :ref:`current_tab<class_TabContainer_property_current_tab>` | ``0`` |
  31. +-------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  32. | :ref:`bool<class_bool>` | :ref:`drag_to_rearrange_enabled<class_TabContainer_property_drag_to_rearrange_enabled>` | ``false`` |
  33. +-------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  34. | :ref:`AlignmentMode<enum_TabBar_AlignmentMode>` | :ref:`tab_alignment<class_TabContainer_property_tab_alignment>` | ``0`` |
  35. +-------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  36. | :ref:`int<class_int>` | :ref:`tabs_rearrange_group<class_TabContainer_property_tabs_rearrange_group>` | ``-1`` |
  37. +-------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  38. | :ref:`bool<class_bool>` | :ref:`tabs_visible<class_TabContainer_property_tabs_visible>` | ``true`` |
  39. +-------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  40. | :ref:`bool<class_bool>` | :ref:`use_hidden_tabs_for_min_size<class_TabContainer_property_use_hidden_tabs_for_min_size>` | ``false`` |
  41. +-------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+
  42. .. rst-class:: classref-reftable-group
  43. Methods
  44. -------
  45. .. table::
  46. :widths: auto
  47. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`Control<class_Control>` | :ref:`get_current_tab_control<class_TabContainer_method_get_current_tab_control>` **(** **)** |const| |
  49. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`Popup<class_Popup>` | :ref:`get_popup<class_TabContainer_method_get_popup>` **(** **)** |const| |
  51. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`int<class_int>` | :ref:`get_previous_tab<class_TabContainer_method_get_previous_tab>` **(** **)** |const| |
  53. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`Texture2D<class_Texture2D>` | :ref:`get_tab_button_icon<class_TabContainer_method_get_tab_button_icon>` **(** :ref:`int<class_int>` tab_idx **)** |const| |
  55. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`Control<class_Control>` | :ref:`get_tab_control<class_TabContainer_method_get_tab_control>` **(** :ref:`int<class_int>` tab_idx **)** |const| |
  57. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`int<class_int>` | :ref:`get_tab_count<class_TabContainer_method_get_tab_count>` **(** **)** |const| |
  59. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`Texture2D<class_Texture2D>` | :ref:`get_tab_icon<class_TabContainer_method_get_tab_icon>` **(** :ref:`int<class_int>` tab_idx **)** |const| |
  61. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`int<class_int>` | :ref:`get_tab_idx_at_point<class_TabContainer_method_get_tab_idx_at_point>` **(** :ref:`Vector2<class_Vector2>` point **)** |const| |
  63. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | :ref:`int<class_int>` | :ref:`get_tab_idx_from_control<class_TabContainer_method_get_tab_idx_from_control>` **(** :ref:`Control<class_Control>` control **)** |const| |
  65. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`String<class_String>` | :ref:`get_tab_title<class_TabContainer_method_get_tab_title>` **(** :ref:`int<class_int>` tab_idx **)** |const| |
  67. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`bool<class_bool>` | :ref:`is_tab_disabled<class_TabContainer_method_is_tab_disabled>` **(** :ref:`int<class_int>` tab_idx **)** |const| |
  69. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`bool<class_bool>` | :ref:`is_tab_hidden<class_TabContainer_method_is_tab_hidden>` **(** :ref:`int<class_int>` tab_idx **)** |const| |
  71. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | void | :ref:`set_popup<class_TabContainer_method_set_popup>` **(** :ref:`Node<class_Node>` popup **)** |
  73. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | void | :ref:`set_tab_button_icon<class_TabContainer_method_set_tab_button_icon>` **(** :ref:`int<class_int>` tab_idx, :ref:`Texture2D<class_Texture2D>` icon **)** |
  75. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | void | :ref:`set_tab_disabled<class_TabContainer_method_set_tab_disabled>` **(** :ref:`int<class_int>` tab_idx, :ref:`bool<class_bool>` disabled **)** |
  77. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | void | :ref:`set_tab_hidden<class_TabContainer_method_set_tab_hidden>` **(** :ref:`int<class_int>` tab_idx, :ref:`bool<class_bool>` hidden **)** |
  79. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | void | :ref:`set_tab_icon<class_TabContainer_method_set_tab_icon>` **(** :ref:`int<class_int>` tab_idx, :ref:`Texture2D<class_Texture2D>` icon **)** |
  81. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | void | :ref:`set_tab_title<class_TabContainer_method_set_tab_title>` **(** :ref:`int<class_int>` tab_idx, :ref:`String<class_String>` title **)** |
  83. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. .. rst-class:: classref-reftable-group
  85. Theme Properties
  86. ----------------
  87. .. table::
  88. :widths: auto
  89. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  90. | :ref:`Color<class_Color>` | :ref:`drop_mark_color<class_TabContainer_theme_color_drop_mark_color>` | ``Color(1, 1, 1, 1)`` |
  91. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  92. | :ref:`Color<class_Color>` | :ref:`font_disabled_color<class_TabContainer_theme_color_font_disabled_color>` | ``Color(0.875, 0.875, 0.875, 0.5)`` |
  93. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  94. | :ref:`Color<class_Color>` | :ref:`font_outline_color<class_TabContainer_theme_color_font_outline_color>` | ``Color(1, 1, 1, 1)`` |
  95. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  96. | :ref:`Color<class_Color>` | :ref:`font_selected_color<class_TabContainer_theme_color_font_selected_color>` | ``Color(0.95, 0.95, 0.95, 1)`` |
  97. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  98. | :ref:`Color<class_Color>` | :ref:`font_unselected_color<class_TabContainer_theme_color_font_unselected_color>` | ``Color(0.7, 0.7, 0.7, 1)`` |
  99. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  100. | :ref:`int<class_int>` | :ref:`icon_separation<class_TabContainer_theme_constant_icon_separation>` | ``4`` |
  101. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  102. | :ref:`int<class_int>` | :ref:`outline_size<class_TabContainer_theme_constant_outline_size>` | ``0`` |
  103. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  104. | :ref:`int<class_int>` | :ref:`side_margin<class_TabContainer_theme_constant_side_margin>` | ``8`` |
  105. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  106. | :ref:`Font<class_Font>` | :ref:`font<class_TabContainer_theme_font_font>` | |
  107. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  108. | :ref:`int<class_int>` | :ref:`font_size<class_TabContainer_theme_font_size_font_size>` | |
  109. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  110. | :ref:`Texture2D<class_Texture2D>` | :ref:`decrement<class_TabContainer_theme_icon_decrement>` | |
  111. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  112. | :ref:`Texture2D<class_Texture2D>` | :ref:`decrement_highlight<class_TabContainer_theme_icon_decrement_highlight>` | |
  113. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  114. | :ref:`Texture2D<class_Texture2D>` | :ref:`drop_mark<class_TabContainer_theme_icon_drop_mark>` | |
  115. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  116. | :ref:`Texture2D<class_Texture2D>` | :ref:`increment<class_TabContainer_theme_icon_increment>` | |
  117. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  118. | :ref:`Texture2D<class_Texture2D>` | :ref:`increment_highlight<class_TabContainer_theme_icon_increment_highlight>` | |
  119. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  120. | :ref:`Texture2D<class_Texture2D>` | :ref:`menu<class_TabContainer_theme_icon_menu>` | |
  121. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  122. | :ref:`Texture2D<class_Texture2D>` | :ref:`menu_highlight<class_TabContainer_theme_icon_menu_highlight>` | |
  123. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  124. | :ref:`StyleBox<class_StyleBox>` | :ref:`panel<class_TabContainer_theme_style_panel>` | |
  125. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  126. | :ref:`StyleBox<class_StyleBox>` | :ref:`tab_disabled<class_TabContainer_theme_style_tab_disabled>` | |
  127. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  128. | :ref:`StyleBox<class_StyleBox>` | :ref:`tab_selected<class_TabContainer_theme_style_tab_selected>` | |
  129. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  130. | :ref:`StyleBox<class_StyleBox>` | :ref:`tab_unselected<class_TabContainer_theme_style_tab_unselected>` | |
  131. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  132. | :ref:`StyleBox<class_StyleBox>` | :ref:`tabbar_background<class_TabContainer_theme_style_tabbar_background>` | |
  133. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  134. .. rst-class:: classref-section-separator
  135. ----
  136. .. rst-class:: classref-descriptions-group
  137. Signals
  138. -------
  139. .. _class_TabContainer_signal_pre_popup_pressed:
  140. .. rst-class:: classref-signal
  141. **pre_popup_pressed** **(** **)**
  142. Emitted when the **TabContainer**'s :ref:`Popup<class_Popup>` button is clicked. See :ref:`set_popup<class_TabContainer_method_set_popup>` for details.
  143. .. rst-class:: classref-item-separator
  144. ----
  145. .. _class_TabContainer_signal_tab_button_pressed:
  146. .. rst-class:: classref-signal
  147. **tab_button_pressed** **(** :ref:`int<class_int>` tab **)**
  148. Emitted when the user clicks on the button icon on this tab.
  149. .. rst-class:: classref-item-separator
  150. ----
  151. .. _class_TabContainer_signal_tab_changed:
  152. .. rst-class:: classref-signal
  153. **tab_changed** **(** :ref:`int<class_int>` tab **)**
  154. Emitted when switching to another tab.
  155. .. rst-class:: classref-item-separator
  156. ----
  157. .. _class_TabContainer_signal_tab_selected:
  158. .. rst-class:: classref-signal
  159. **tab_selected** **(** :ref:`int<class_int>` tab **)**
  160. Emitted when a tab is selected, even if it is the current tab.
  161. .. rst-class:: classref-section-separator
  162. ----
  163. .. rst-class:: classref-descriptions-group
  164. Property Descriptions
  165. ---------------------
  166. .. _class_TabContainer_property_all_tabs_in_front:
  167. .. rst-class:: classref-property
  168. :ref:`bool<class_bool>` **all_tabs_in_front** = ``false``
  169. .. rst-class:: classref-property-setget
  170. - void **set_all_tabs_in_front** **(** :ref:`bool<class_bool>` value **)**
  171. - :ref:`bool<class_bool>` **is_all_tabs_in_front** **(** **)**
  172. If ``true``, all tabs are drawn in front of the panel. If ``false``, inactive tabs are drawn behind the panel.
  173. .. rst-class:: classref-item-separator
  174. ----
  175. .. _class_TabContainer_property_clip_tabs:
  176. .. rst-class:: classref-property
  177. :ref:`bool<class_bool>` **clip_tabs** = ``true``
  178. .. rst-class:: classref-property-setget
  179. - void **set_clip_tabs** **(** :ref:`bool<class_bool>` value **)**
  180. - :ref:`bool<class_bool>` **get_clip_tabs** **(** **)**
  181. If ``true``, tabs overflowing this node's width will be hidden, displaying two navigation buttons instead. Otherwise, this node's minimum size is updated so that all tabs are visible.
  182. .. rst-class:: classref-item-separator
  183. ----
  184. .. _class_TabContainer_property_current_tab:
  185. .. rst-class:: classref-property
  186. :ref:`int<class_int>` **current_tab** = ``0``
  187. .. rst-class:: classref-property-setget
  188. - void **set_current_tab** **(** :ref:`int<class_int>` value **)**
  189. - :ref:`int<class_int>` **get_current_tab** **(** **)**
  190. 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``.
  191. .. rst-class:: classref-item-separator
  192. ----
  193. .. _class_TabContainer_property_drag_to_rearrange_enabled:
  194. .. rst-class:: classref-property
  195. :ref:`bool<class_bool>` **drag_to_rearrange_enabled** = ``false``
  196. .. rst-class:: classref-property-setget
  197. - void **set_drag_to_rearrange_enabled** **(** :ref:`bool<class_bool>` value **)**
  198. - :ref:`bool<class_bool>` **get_drag_to_rearrange_enabled** **(** **)**
  199. If ``true``, tabs can be rearranged with mouse drag.
  200. .. rst-class:: classref-item-separator
  201. ----
  202. .. _class_TabContainer_property_tab_alignment:
  203. .. rst-class:: classref-property
  204. :ref:`AlignmentMode<enum_TabBar_AlignmentMode>` **tab_alignment** = ``0``
  205. .. rst-class:: classref-property-setget
  206. - void **set_tab_alignment** **(** :ref:`AlignmentMode<enum_TabBar_AlignmentMode>` value **)**
  207. - :ref:`AlignmentMode<enum_TabBar_AlignmentMode>` **get_tab_alignment** **(** **)**
  208. Sets the position at which tabs will be placed. See :ref:`AlignmentMode<enum_TabBar_AlignmentMode>` for details.
  209. .. rst-class:: classref-item-separator
  210. ----
  211. .. _class_TabContainer_property_tabs_rearrange_group:
  212. .. rst-class:: classref-property
  213. :ref:`int<class_int>` **tabs_rearrange_group** = ``-1``
  214. .. rst-class:: classref-property-setget
  215. - void **set_tabs_rearrange_group** **(** :ref:`int<class_int>` value **)**
  216. - :ref:`int<class_int>` **get_tabs_rearrange_group** **(** **)**
  217. **TabContainer**\ s with the same rearrange group ID will allow dragging the tabs between them. Enable drag with :ref:`drag_to_rearrange_enabled<class_TabContainer_property_drag_to_rearrange_enabled>`.
  218. Setting this to ``-1`` will disable rearranging between **TabContainer**\ s.
  219. .. rst-class:: classref-item-separator
  220. ----
  221. .. _class_TabContainer_property_tabs_visible:
  222. .. rst-class:: classref-property
  223. :ref:`bool<class_bool>` **tabs_visible** = ``true``
  224. .. rst-class:: classref-property-setget
  225. - void **set_tabs_visible** **(** :ref:`bool<class_bool>` value **)**
  226. - :ref:`bool<class_bool>` **are_tabs_visible** **(** **)**
  227. If ``true``, tabs are visible. If ``false``, tabs' content and titles are hidden.
  228. .. rst-class:: classref-item-separator
  229. ----
  230. .. _class_TabContainer_property_use_hidden_tabs_for_min_size:
  231. .. rst-class:: classref-property
  232. :ref:`bool<class_bool>` **use_hidden_tabs_for_min_size** = ``false``
  233. .. rst-class:: classref-property-setget
  234. - void **set_use_hidden_tabs_for_min_size** **(** :ref:`bool<class_bool>` value **)**
  235. - :ref:`bool<class_bool>` **get_use_hidden_tabs_for_min_size** **(** **)**
  236. If ``true``, children :ref:`Control<class_Control>` nodes that are hidden have their minimum size take into account in the total, instead of only the currently visible one.
  237. .. rst-class:: classref-section-separator
  238. ----
  239. .. rst-class:: classref-descriptions-group
  240. Method Descriptions
  241. -------------------
  242. .. _class_TabContainer_method_get_current_tab_control:
  243. .. rst-class:: classref-method
  244. :ref:`Control<class_Control>` **get_current_tab_control** **(** **)** |const|
  245. Returns the child :ref:`Control<class_Control>` node located at the active tab index.
  246. .. rst-class:: classref-item-separator
  247. ----
  248. .. _class_TabContainer_method_get_popup:
  249. .. rst-class:: classref-method
  250. :ref:`Popup<class_Popup>` **get_popup** **(** **)** |const|
  251. Returns the :ref:`Popup<class_Popup>` node instance if one has been set already with :ref:`set_popup<class_TabContainer_method_set_popup>`.
  252. \ **Warning:** This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their :ref:`Window.visible<class_Window_property_visible>` property.
  253. .. rst-class:: classref-item-separator
  254. ----
  255. .. _class_TabContainer_method_get_previous_tab:
  256. .. rst-class:: classref-method
  257. :ref:`int<class_int>` **get_previous_tab** **(** **)** |const|
  258. Returns the previously active tab index.
  259. .. rst-class:: classref-item-separator
  260. ----
  261. .. _class_TabContainer_method_get_tab_button_icon:
  262. .. rst-class:: classref-method
  263. :ref:`Texture2D<class_Texture2D>` **get_tab_button_icon** **(** :ref:`int<class_int>` tab_idx **)** |const|
  264. Returns the button icon from the tab at index ``tab_idx``.
  265. .. rst-class:: classref-item-separator
  266. ----
  267. .. _class_TabContainer_method_get_tab_control:
  268. .. rst-class:: classref-method
  269. :ref:`Control<class_Control>` **get_tab_control** **(** :ref:`int<class_int>` tab_idx **)** |const|
  270. Returns the :ref:`Control<class_Control>` node from the tab at index ``tab_idx``.
  271. .. rst-class:: classref-item-separator
  272. ----
  273. .. _class_TabContainer_method_get_tab_count:
  274. .. rst-class:: classref-method
  275. :ref:`int<class_int>` **get_tab_count** **(** **)** |const|
  276. Returns the number of tabs.
  277. .. rst-class:: classref-item-separator
  278. ----
  279. .. _class_TabContainer_method_get_tab_icon:
  280. .. rst-class:: classref-method
  281. :ref:`Texture2D<class_Texture2D>` **get_tab_icon** **(** :ref:`int<class_int>` tab_idx **)** |const|
  282. Returns the :ref:`Texture2D<class_Texture2D>` for the tab at index ``tab_idx`` or ``null`` if the tab has no :ref:`Texture2D<class_Texture2D>`.
  283. .. rst-class:: classref-item-separator
  284. ----
  285. .. _class_TabContainer_method_get_tab_idx_at_point:
  286. .. rst-class:: classref-method
  287. :ref:`int<class_int>` **get_tab_idx_at_point** **(** :ref:`Vector2<class_Vector2>` point **)** |const|
  288. Returns the index of the tab at local coordinates ``point``. Returns ``-1`` if the point is outside the control boundaries or if there's no tab at the queried position.
  289. .. rst-class:: classref-item-separator
  290. ----
  291. .. _class_TabContainer_method_get_tab_idx_from_control:
  292. .. rst-class:: classref-method
  293. :ref:`int<class_int>` **get_tab_idx_from_control** **(** :ref:`Control<class_Control>` control **)** |const|
  294. Returns the index of the tab tied to the given ``control``. The control must be a child of the **TabContainer**.
  295. .. rst-class:: classref-item-separator
  296. ----
  297. .. _class_TabContainer_method_get_tab_title:
  298. .. rst-class:: classref-method
  299. :ref:`String<class_String>` **get_tab_title** **(** :ref:`int<class_int>` tab_idx **)** |const|
  300. 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_set_tab_title>`.
  301. .. rst-class:: classref-item-separator
  302. ----
  303. .. _class_TabContainer_method_is_tab_disabled:
  304. .. rst-class:: classref-method
  305. :ref:`bool<class_bool>` **is_tab_disabled** **(** :ref:`int<class_int>` tab_idx **)** |const|
  306. Returns ``true`` if the tab at index ``tab_idx`` is disabled.
  307. .. rst-class:: classref-item-separator
  308. ----
  309. .. _class_TabContainer_method_is_tab_hidden:
  310. .. rst-class:: classref-method
  311. :ref:`bool<class_bool>` **is_tab_hidden** **(** :ref:`int<class_int>` tab_idx **)** |const|
  312. Returns ``true`` if the tab at index ``tab_idx`` is hidden.
  313. .. rst-class:: classref-item-separator
  314. ----
  315. .. _class_TabContainer_method_set_popup:
  316. .. rst-class:: classref-method
  317. void **set_popup** **(** :ref:`Node<class_Node>` popup **)**
  318. If set on a :ref:`Popup<class_Popup>` node instance, a popup menu icon appears in the top-right corner of the **TabContainer** (setting it to ``null`` will make it go away). Clicking it will expand the :ref:`Popup<class_Popup>` node.
  319. .. rst-class:: classref-item-separator
  320. ----
  321. .. _class_TabContainer_method_set_tab_button_icon:
  322. .. rst-class:: classref-method
  323. void **set_tab_button_icon** **(** :ref:`int<class_int>` tab_idx, :ref:`Texture2D<class_Texture2D>` icon **)**
  324. Sets the button icon from the tab at index ``tab_idx``.
  325. .. rst-class:: classref-item-separator
  326. ----
  327. .. _class_TabContainer_method_set_tab_disabled:
  328. .. rst-class:: classref-method
  329. void **set_tab_disabled** **(** :ref:`int<class_int>` tab_idx, :ref:`bool<class_bool>` disabled **)**
  330. If ``disabled`` is ``true``, disables the tab at index ``tab_idx``, making it non-interactable.
  331. .. rst-class:: classref-item-separator
  332. ----
  333. .. _class_TabContainer_method_set_tab_hidden:
  334. .. rst-class:: classref-method
  335. void **set_tab_hidden** **(** :ref:`int<class_int>` tab_idx, :ref:`bool<class_bool>` hidden **)**
  336. If ``hidden`` is ``true``, hides the tab at index ``tab_idx``, making it disappear from the tab area.
  337. .. rst-class:: classref-item-separator
  338. ----
  339. .. _class_TabContainer_method_set_tab_icon:
  340. .. rst-class:: classref-method
  341. void **set_tab_icon** **(** :ref:`int<class_int>` tab_idx, :ref:`Texture2D<class_Texture2D>` icon **)**
  342. Sets an icon for the tab at index ``tab_idx``.
  343. .. rst-class:: classref-item-separator
  344. ----
  345. .. _class_TabContainer_method_set_tab_title:
  346. .. rst-class:: classref-method
  347. void **set_tab_title** **(** :ref:`int<class_int>` tab_idx, :ref:`String<class_String>` title **)**
  348. Sets a custom title for the tab at index ``tab_idx`` (tab titles default to the name of the indexed child node). Set it back to the child's name to make the tab default to it again.
  349. .. rst-class:: classref-section-separator
  350. ----
  351. .. rst-class:: classref-descriptions-group
  352. Theme Property Descriptions
  353. ---------------------------
  354. .. _class_TabContainer_theme_color_drop_mark_color:
  355. .. rst-class:: classref-themeproperty
  356. :ref:`Color<class_Color>` **drop_mark_color** = ``Color(1, 1, 1, 1)``
  357. Modulation color for the :ref:`drop_mark<class_TabContainer_theme_icon_drop_mark>` icon.
  358. .. rst-class:: classref-item-separator
  359. ----
  360. .. _class_TabContainer_theme_color_font_disabled_color:
  361. .. rst-class:: classref-themeproperty
  362. :ref:`Color<class_Color>` **font_disabled_color** = ``Color(0.875, 0.875, 0.875, 0.5)``
  363. Font color of disabled tabs.
  364. .. rst-class:: classref-item-separator
  365. ----
  366. .. _class_TabContainer_theme_color_font_outline_color:
  367. .. rst-class:: classref-themeproperty
  368. :ref:`Color<class_Color>` **font_outline_color** = ``Color(1, 1, 1, 1)``
  369. The tint of text outline of the tab name.
  370. .. rst-class:: classref-item-separator
  371. ----
  372. .. _class_TabContainer_theme_color_font_selected_color:
  373. .. rst-class:: classref-themeproperty
  374. :ref:`Color<class_Color>` **font_selected_color** = ``Color(0.95, 0.95, 0.95, 1)``
  375. Font color of the currently selected tab.
  376. .. rst-class:: classref-item-separator
  377. ----
  378. .. _class_TabContainer_theme_color_font_unselected_color:
  379. .. rst-class:: classref-themeproperty
  380. :ref:`Color<class_Color>` **font_unselected_color** = ``Color(0.7, 0.7, 0.7, 1)``
  381. Font color of the other, unselected tabs.
  382. .. rst-class:: classref-item-separator
  383. ----
  384. .. _class_TabContainer_theme_constant_icon_separation:
  385. .. rst-class:: classref-themeproperty
  386. :ref:`int<class_int>` **icon_separation** = ``4``
  387. Space between tab's name and its icon.
  388. .. rst-class:: classref-item-separator
  389. ----
  390. .. _class_TabContainer_theme_constant_outline_size:
  391. .. rst-class:: classref-themeproperty
  392. :ref:`int<class_int>` **outline_size** = ``0``
  393. The size of the tab text outline.
  394. \ **Note:** If using a font with :ref:`FontFile.multichannel_signed_distance_field<class_FontFile_property_multichannel_signed_distance_field>` enabled, its :ref:`FontFile.msdf_pixel_range<class_FontFile_property_msdf_pixel_range>` must be set to at least *twice* the value of :ref:`outline_size<class_TabContainer_theme_constant_outline_size>` for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended.
  395. .. rst-class:: classref-item-separator
  396. ----
  397. .. _class_TabContainer_theme_constant_side_margin:
  398. .. rst-class:: classref-themeproperty
  399. :ref:`int<class_int>` **side_margin** = ``8``
  400. The space at the left or right edges of the tab bar, accordingly with the current :ref:`tab_alignment<class_TabContainer_property_tab_alignment>`.
  401. The margin is ignored with :ref:`TabBar.ALIGNMENT_RIGHT<class_TabBar_constant_ALIGNMENT_RIGHT>` if the tabs are clipped (see :ref:`clip_tabs<class_TabContainer_property_clip_tabs>`) or a popup has been set (see :ref:`set_popup<class_TabContainer_method_set_popup>`). The margin is always ignored with :ref:`TabBar.ALIGNMENT_CENTER<class_TabBar_constant_ALIGNMENT_CENTER>`.
  402. .. rst-class:: classref-item-separator
  403. ----
  404. .. _class_TabContainer_theme_font_font:
  405. .. rst-class:: classref-themeproperty
  406. :ref:`Font<class_Font>` **font**
  407. The font used to draw tab names.
  408. .. rst-class:: classref-item-separator
  409. ----
  410. .. _class_TabContainer_theme_font_size_font_size:
  411. .. rst-class:: classref-themeproperty
  412. :ref:`int<class_int>` **font_size**
  413. Font size of the tab names.
  414. .. rst-class:: classref-item-separator
  415. ----
  416. .. _class_TabContainer_theme_icon_decrement:
  417. .. rst-class:: classref-themeproperty
  418. :ref:`Texture2D<class_Texture2D>` **decrement**
  419. Icon for the left arrow button that appears when there are too many tabs to fit in the container width. When the button is disabled (i.e. the first tab is visible), it appears semi-transparent.
  420. .. rst-class:: classref-item-separator
  421. ----
  422. .. _class_TabContainer_theme_icon_decrement_highlight:
  423. .. rst-class:: classref-themeproperty
  424. :ref:`Texture2D<class_Texture2D>` **decrement_highlight**
  425. Icon for the left arrow button that appears when there are too many tabs to fit in the container width. Used when the button is being hovered with the cursor.
  426. .. rst-class:: classref-item-separator
  427. ----
  428. .. _class_TabContainer_theme_icon_drop_mark:
  429. .. rst-class:: classref-themeproperty
  430. :ref:`Texture2D<class_Texture2D>` **drop_mark**
  431. Icon shown to indicate where a dragged tab is gonna be dropped (see :ref:`drag_to_rearrange_enabled<class_TabContainer_property_drag_to_rearrange_enabled>`).
  432. .. rst-class:: classref-item-separator
  433. ----
  434. .. _class_TabContainer_theme_icon_increment:
  435. .. rst-class:: classref-themeproperty
  436. :ref:`Texture2D<class_Texture2D>` **increment**
  437. Icon for the right arrow button that appears when there are too many tabs to fit in the container width. When the button is disabled (i.e. the last tab is visible) it appears semi-transparent.
  438. .. rst-class:: classref-item-separator
  439. ----
  440. .. _class_TabContainer_theme_icon_increment_highlight:
  441. .. rst-class:: classref-themeproperty
  442. :ref:`Texture2D<class_Texture2D>` **increment_highlight**
  443. Icon for the right arrow button that appears when there are too many tabs to fit in the container width. Used when the button is being hovered with the cursor.
  444. .. rst-class:: classref-item-separator
  445. ----
  446. .. _class_TabContainer_theme_icon_menu:
  447. .. rst-class:: classref-themeproperty
  448. :ref:`Texture2D<class_Texture2D>` **menu**
  449. The icon for the menu button (see :ref:`set_popup<class_TabContainer_method_set_popup>`).
  450. .. rst-class:: classref-item-separator
  451. ----
  452. .. _class_TabContainer_theme_icon_menu_highlight:
  453. .. rst-class:: classref-themeproperty
  454. :ref:`Texture2D<class_Texture2D>` **menu_highlight**
  455. The icon for the menu button (see :ref:`set_popup<class_TabContainer_method_set_popup>`) when it's being hovered with the cursor.
  456. .. rst-class:: classref-item-separator
  457. ----
  458. .. _class_TabContainer_theme_style_panel:
  459. .. rst-class:: classref-themeproperty
  460. :ref:`StyleBox<class_StyleBox>` **panel**
  461. The style for the background fill.
  462. .. rst-class:: classref-item-separator
  463. ----
  464. .. _class_TabContainer_theme_style_tab_disabled:
  465. .. rst-class:: classref-themeproperty
  466. :ref:`StyleBox<class_StyleBox>` **tab_disabled**
  467. The style of disabled tabs.
  468. .. rst-class:: classref-item-separator
  469. ----
  470. .. _class_TabContainer_theme_style_tab_selected:
  471. .. rst-class:: classref-themeproperty
  472. :ref:`StyleBox<class_StyleBox>` **tab_selected**
  473. The style of the currently selected tab.
  474. .. rst-class:: classref-item-separator
  475. ----
  476. .. _class_TabContainer_theme_style_tab_unselected:
  477. .. rst-class:: classref-themeproperty
  478. :ref:`StyleBox<class_StyleBox>` **tab_unselected**
  479. The style of the other, unselected tabs.
  480. .. rst-class:: classref-item-separator
  481. ----
  482. .. _class_TabContainer_theme_style_tabbar_background:
  483. .. rst-class:: classref-themeproperty
  484. :ref:`StyleBox<class_StyleBox>` **tabbar_background**
  485. The style for the background fill of the :ref:`TabBar<class_TabBar>` area.
  486. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  487. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  488. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  489. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  490. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  491. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`