class_tabcontainer.rst 37 KB

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