class_tabcontainer.rst 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965
  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.1/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.1/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:`Variant<class_Variant>` | :ref:`get_tab_metadata<class_TabContainer_method_get_tab_metadata>` **(** :ref:`int<class_int>` tab_idx **)** |const| |
  67. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`String<class_String>` | :ref:`get_tab_title<class_TabContainer_method_get_tab_title>` **(** :ref:`int<class_int>` tab_idx **)** |const| |
  69. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`bool<class_bool>` | :ref:`is_tab_disabled<class_TabContainer_method_is_tab_disabled>` **(** :ref:`int<class_int>` tab_idx **)** |const| |
  71. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :ref:`bool<class_bool>` | :ref:`is_tab_hidden<class_TabContainer_method_is_tab_hidden>` **(** :ref:`int<class_int>` tab_idx **)** |const| |
  73. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | void | :ref:`set_popup<class_TabContainer_method_set_popup>` **(** :ref:`Node<class_Node>` popup **)** |
  75. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | void | :ref:`set_tab_button_icon<class_TabContainer_method_set_tab_button_icon>` **(** :ref:`int<class_int>` tab_idx, :ref:`Texture2D<class_Texture2D>` icon **)** |
  77. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | void | :ref:`set_tab_disabled<class_TabContainer_method_set_tab_disabled>` **(** :ref:`int<class_int>` tab_idx, :ref:`bool<class_bool>` disabled **)** |
  79. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | void | :ref:`set_tab_hidden<class_TabContainer_method_set_tab_hidden>` **(** :ref:`int<class_int>` tab_idx, :ref:`bool<class_bool>` hidden **)** |
  81. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | void | :ref:`set_tab_icon<class_TabContainer_method_set_tab_icon>` **(** :ref:`int<class_int>` tab_idx, :ref:`Texture2D<class_Texture2D>` icon **)** |
  83. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | void | :ref:`set_tab_metadata<class_TabContainer_method_set_tab_metadata>` **(** :ref:`int<class_int>` tab_idx, :ref:`Variant<class_Variant>` metadata **)** |
  85. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | void | :ref:`set_tab_title<class_TabContainer_method_set_tab_title>` **(** :ref:`int<class_int>` tab_idx, :ref:`String<class_String>` title **)** |
  87. +-----------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. .. rst-class:: classref-reftable-group
  89. Theme Properties
  90. ----------------
  91. .. table::
  92. :widths: auto
  93. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  94. | :ref:`Color<class_Color>` | :ref:`drop_mark_color<class_TabContainer_theme_color_drop_mark_color>` | ``Color(1, 1, 1, 1)`` |
  95. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  96. | :ref:`Color<class_Color>` | :ref:`font_disabled_color<class_TabContainer_theme_color_font_disabled_color>` | ``Color(0.875, 0.875, 0.875, 0.5)`` |
  97. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  98. | :ref:`Color<class_Color>` | :ref:`font_hovered_color<class_TabContainer_theme_color_font_hovered_color>` | ``Color(0.95, 0.95, 0.95, 1)`` |
  99. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  100. | :ref:`Color<class_Color>` | :ref:`font_outline_color<class_TabContainer_theme_color_font_outline_color>` | ``Color(1, 1, 1, 1)`` |
  101. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  102. | :ref:`Color<class_Color>` | :ref:`font_selected_color<class_TabContainer_theme_color_font_selected_color>` | ``Color(0.95, 0.95, 0.95, 1)`` |
  103. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  104. | :ref:`Color<class_Color>` | :ref:`font_unselected_color<class_TabContainer_theme_color_font_unselected_color>` | ``Color(0.7, 0.7, 0.7, 1)`` |
  105. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  106. | :ref:`int<class_int>` | :ref:`icon_max_width<class_TabContainer_theme_constant_icon_max_width>` | ``0`` |
  107. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  108. | :ref:`int<class_int>` | :ref:`icon_separation<class_TabContainer_theme_constant_icon_separation>` | ``4`` |
  109. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  110. | :ref:`int<class_int>` | :ref:`outline_size<class_TabContainer_theme_constant_outline_size>` | ``0`` |
  111. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  112. | :ref:`int<class_int>` | :ref:`side_margin<class_TabContainer_theme_constant_side_margin>` | ``8`` |
  113. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  114. | :ref:`Font<class_Font>` | :ref:`font<class_TabContainer_theme_font_font>` | |
  115. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  116. | :ref:`int<class_int>` | :ref:`font_size<class_TabContainer_theme_font_size_font_size>` | |
  117. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  118. | :ref:`Texture2D<class_Texture2D>` | :ref:`decrement<class_TabContainer_theme_icon_decrement>` | |
  119. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  120. | :ref:`Texture2D<class_Texture2D>` | :ref:`decrement_highlight<class_TabContainer_theme_icon_decrement_highlight>` | |
  121. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  122. | :ref:`Texture2D<class_Texture2D>` | :ref:`drop_mark<class_TabContainer_theme_icon_drop_mark>` | |
  123. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  124. | :ref:`Texture2D<class_Texture2D>` | :ref:`increment<class_TabContainer_theme_icon_increment>` | |
  125. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  126. | :ref:`Texture2D<class_Texture2D>` | :ref:`increment_highlight<class_TabContainer_theme_icon_increment_highlight>` | |
  127. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  128. | :ref:`Texture2D<class_Texture2D>` | :ref:`menu<class_TabContainer_theme_icon_menu>` | |
  129. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  130. | :ref:`Texture2D<class_Texture2D>` | :ref:`menu_highlight<class_TabContainer_theme_icon_menu_highlight>` | |
  131. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  132. | :ref:`StyleBox<class_StyleBox>` | :ref:`panel<class_TabContainer_theme_style_panel>` | |
  133. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  134. | :ref:`StyleBox<class_StyleBox>` | :ref:`tab_disabled<class_TabContainer_theme_style_tab_disabled>` | |
  135. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  136. | :ref:`StyleBox<class_StyleBox>` | :ref:`tab_hovered<class_TabContainer_theme_style_tab_hovered>` | |
  137. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  138. | :ref:`StyleBox<class_StyleBox>` | :ref:`tab_selected<class_TabContainer_theme_style_tab_selected>` | |
  139. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  140. | :ref:`StyleBox<class_StyleBox>` | :ref:`tab_unselected<class_TabContainer_theme_style_tab_unselected>` | |
  141. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  142. | :ref:`StyleBox<class_StyleBox>` | :ref:`tabbar_background<class_TabContainer_theme_style_tabbar_background>` | |
  143. +-----------------------------------+------------------------------------------------------------------------------------+-------------------------------------+
  144. .. rst-class:: classref-section-separator
  145. ----
  146. .. rst-class:: classref-descriptions-group
  147. Signals
  148. -------
  149. .. _class_TabContainer_signal_active_tab_rearranged:
  150. .. rst-class:: classref-signal
  151. **active_tab_rearranged** **(** :ref:`int<class_int>` idx_to **)**
  152. Emitted when the active tab is rearranged via mouse drag. See :ref:`drag_to_rearrange_enabled<class_TabContainer_property_drag_to_rearrange_enabled>`.
  153. .. rst-class:: classref-item-separator
  154. ----
  155. .. _class_TabContainer_signal_pre_popup_pressed:
  156. .. rst-class:: classref-signal
  157. **pre_popup_pressed** **(** **)**
  158. Emitted when the **TabContainer**'s :ref:`Popup<class_Popup>` button is clicked. See :ref:`set_popup<class_TabContainer_method_set_popup>` for details.
  159. .. rst-class:: classref-item-separator
  160. ----
  161. .. _class_TabContainer_signal_tab_button_pressed:
  162. .. rst-class:: classref-signal
  163. **tab_button_pressed** **(** :ref:`int<class_int>` tab **)**
  164. Emitted when the user clicks on the button icon on this tab.
  165. .. rst-class:: classref-item-separator
  166. ----
  167. .. _class_TabContainer_signal_tab_changed:
  168. .. rst-class:: classref-signal
  169. **tab_changed** **(** :ref:`int<class_int>` tab **)**
  170. Emitted when switching to another tab.
  171. .. rst-class:: classref-item-separator
  172. ----
  173. .. _class_TabContainer_signal_tab_clicked:
  174. .. rst-class:: classref-signal
  175. **tab_clicked** **(** :ref:`int<class_int>` tab **)**
  176. Emitted when a tab is clicked, even if it is the current tab.
  177. .. rst-class:: classref-item-separator
  178. ----
  179. .. _class_TabContainer_signal_tab_hovered:
  180. .. rst-class:: classref-signal
  181. **tab_hovered** **(** :ref:`int<class_int>` tab **)**
  182. Emitted when a tab is hovered by the mouse.
  183. .. rst-class:: classref-item-separator
  184. ----
  185. .. _class_TabContainer_signal_tab_selected:
  186. .. rst-class:: classref-signal
  187. **tab_selected** **(** :ref:`int<class_int>` tab **)**
  188. Emitted when a tab is selected, even if it is the current tab.
  189. .. rst-class:: classref-section-separator
  190. ----
  191. .. rst-class:: classref-descriptions-group
  192. Property Descriptions
  193. ---------------------
  194. .. _class_TabContainer_property_all_tabs_in_front:
  195. .. rst-class:: classref-property
  196. :ref:`bool<class_bool>` **all_tabs_in_front** = ``false``
  197. .. rst-class:: classref-property-setget
  198. - void **set_all_tabs_in_front** **(** :ref:`bool<class_bool>` value **)**
  199. - :ref:`bool<class_bool>` **is_all_tabs_in_front** **(** **)**
  200. If ``true``, all tabs are drawn in front of the panel. If ``false``, inactive tabs are drawn behind the panel.
  201. .. rst-class:: classref-item-separator
  202. ----
  203. .. _class_TabContainer_property_clip_tabs:
  204. .. rst-class:: classref-property
  205. :ref:`bool<class_bool>` **clip_tabs** = ``true``
  206. .. rst-class:: classref-property-setget
  207. - void **set_clip_tabs** **(** :ref:`bool<class_bool>` value **)**
  208. - :ref:`bool<class_bool>` **get_clip_tabs** **(** **)**
  209. 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.
  210. .. rst-class:: classref-item-separator
  211. ----
  212. .. _class_TabContainer_property_current_tab:
  213. .. rst-class:: classref-property
  214. :ref:`int<class_int>` **current_tab** = ``0``
  215. .. rst-class:: classref-property-setget
  216. - void **set_current_tab** **(** :ref:`int<class_int>` value **)**
  217. - :ref:`int<class_int>` **get_current_tab** **(** **)**
  218. 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``.
  219. .. rst-class:: classref-item-separator
  220. ----
  221. .. _class_TabContainer_property_drag_to_rearrange_enabled:
  222. .. rst-class:: classref-property
  223. :ref:`bool<class_bool>` **drag_to_rearrange_enabled** = ``false``
  224. .. rst-class:: classref-property-setget
  225. - void **set_drag_to_rearrange_enabled** **(** :ref:`bool<class_bool>` value **)**
  226. - :ref:`bool<class_bool>` **get_drag_to_rearrange_enabled** **(** **)**
  227. If ``true``, tabs can be rearranged with mouse drag.
  228. .. rst-class:: classref-item-separator
  229. ----
  230. .. _class_TabContainer_property_tab_alignment:
  231. .. rst-class:: classref-property
  232. :ref:`AlignmentMode<enum_TabBar_AlignmentMode>` **tab_alignment** = ``0``
  233. .. rst-class:: classref-property-setget
  234. - void **set_tab_alignment** **(** :ref:`AlignmentMode<enum_TabBar_AlignmentMode>` value **)**
  235. - :ref:`AlignmentMode<enum_TabBar_AlignmentMode>` **get_tab_alignment** **(** **)**
  236. Sets the position at which tabs will be placed. See :ref:`AlignmentMode<enum_TabBar_AlignmentMode>` for details.
  237. .. rst-class:: classref-item-separator
  238. ----
  239. .. _class_TabContainer_property_tabs_rearrange_group:
  240. .. rst-class:: classref-property
  241. :ref:`int<class_int>` **tabs_rearrange_group** = ``-1``
  242. .. rst-class:: classref-property-setget
  243. - void **set_tabs_rearrange_group** **(** :ref:`int<class_int>` value **)**
  244. - :ref:`int<class_int>` **get_tabs_rearrange_group** **(** **)**
  245. **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>`.
  246. Setting this to ``-1`` will disable rearranging between **TabContainer**\ s.
  247. .. rst-class:: classref-item-separator
  248. ----
  249. .. _class_TabContainer_property_tabs_visible:
  250. .. rst-class:: classref-property
  251. :ref:`bool<class_bool>` **tabs_visible** = ``true``
  252. .. rst-class:: classref-property-setget
  253. - void **set_tabs_visible** **(** :ref:`bool<class_bool>` value **)**
  254. - :ref:`bool<class_bool>` **are_tabs_visible** **(** **)**
  255. If ``true``, tabs are visible. If ``false``, tabs' content and titles are hidden.
  256. .. rst-class:: classref-item-separator
  257. ----
  258. .. _class_TabContainer_property_use_hidden_tabs_for_min_size:
  259. .. rst-class:: classref-property
  260. :ref:`bool<class_bool>` **use_hidden_tabs_for_min_size** = ``false``
  261. .. rst-class:: classref-property-setget
  262. - void **set_use_hidden_tabs_for_min_size** **(** :ref:`bool<class_bool>` value **)**
  263. - :ref:`bool<class_bool>` **get_use_hidden_tabs_for_min_size** **(** **)**
  264. If ``true``, child :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.
  265. .. rst-class:: classref-section-separator
  266. ----
  267. .. rst-class:: classref-descriptions-group
  268. Method Descriptions
  269. -------------------
  270. .. _class_TabContainer_method_get_current_tab_control:
  271. .. rst-class:: classref-method
  272. :ref:`Control<class_Control>` **get_current_tab_control** **(** **)** |const|
  273. Returns the child :ref:`Control<class_Control>` node located at the active tab index.
  274. .. rst-class:: classref-item-separator
  275. ----
  276. .. _class_TabContainer_method_get_popup:
  277. .. rst-class:: classref-method
  278. :ref:`Popup<class_Popup>` **get_popup** **(** **)** |const|
  279. Returns the :ref:`Popup<class_Popup>` node instance if one has been set already with :ref:`set_popup<class_TabContainer_method_set_popup>`.
  280. \ **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.
  281. .. rst-class:: classref-item-separator
  282. ----
  283. .. _class_TabContainer_method_get_previous_tab:
  284. .. rst-class:: classref-method
  285. :ref:`int<class_int>` **get_previous_tab** **(** **)** |const|
  286. Returns the previously active tab index.
  287. .. rst-class:: classref-item-separator
  288. ----
  289. .. _class_TabContainer_method_get_tab_button_icon:
  290. .. rst-class:: classref-method
  291. :ref:`Texture2D<class_Texture2D>` **get_tab_button_icon** **(** :ref:`int<class_int>` tab_idx **)** |const|
  292. Returns the button icon from the tab at index ``tab_idx``.
  293. .. rst-class:: classref-item-separator
  294. ----
  295. .. _class_TabContainer_method_get_tab_control:
  296. .. rst-class:: classref-method
  297. :ref:`Control<class_Control>` **get_tab_control** **(** :ref:`int<class_int>` tab_idx **)** |const|
  298. Returns the :ref:`Control<class_Control>` node from the tab at index ``tab_idx``.
  299. .. rst-class:: classref-item-separator
  300. ----
  301. .. _class_TabContainer_method_get_tab_count:
  302. .. rst-class:: classref-method
  303. :ref:`int<class_int>` **get_tab_count** **(** **)** |const|
  304. Returns the number of tabs.
  305. .. rst-class:: classref-item-separator
  306. ----
  307. .. _class_TabContainer_method_get_tab_icon:
  308. .. rst-class:: classref-method
  309. :ref:`Texture2D<class_Texture2D>` **get_tab_icon** **(** :ref:`int<class_int>` tab_idx **)** |const|
  310. Returns the :ref:`Texture2D<class_Texture2D>` for the tab at index ``tab_idx`` or ``null`` if the tab has no :ref:`Texture2D<class_Texture2D>`.
  311. .. rst-class:: classref-item-separator
  312. ----
  313. .. _class_TabContainer_method_get_tab_idx_at_point:
  314. .. rst-class:: classref-method
  315. :ref:`int<class_int>` **get_tab_idx_at_point** **(** :ref:`Vector2<class_Vector2>` point **)** |const|
  316. 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.
  317. .. rst-class:: classref-item-separator
  318. ----
  319. .. _class_TabContainer_method_get_tab_idx_from_control:
  320. .. rst-class:: classref-method
  321. :ref:`int<class_int>` **get_tab_idx_from_control** **(** :ref:`Control<class_Control>` control **)** |const|
  322. Returns the index of the tab tied to the given ``control``. The control must be a child of the **TabContainer**.
  323. .. rst-class:: classref-item-separator
  324. ----
  325. .. _class_TabContainer_method_get_tab_metadata:
  326. .. rst-class:: classref-method
  327. :ref:`Variant<class_Variant>` **get_tab_metadata** **(** :ref:`int<class_int>` tab_idx **)** |const|
  328. Returns the metadata value set to the tab at index ``tab_idx`` using :ref:`set_tab_metadata<class_TabContainer_method_set_tab_metadata>`. If no metadata was previously set, returns ``null`` by default.
  329. .. rst-class:: classref-item-separator
  330. ----
  331. .. _class_TabContainer_method_get_tab_title:
  332. .. rst-class:: classref-method
  333. :ref:`String<class_String>` **get_tab_title** **(** :ref:`int<class_int>` tab_idx **)** |const|
  334. 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>`.
  335. .. rst-class:: classref-item-separator
  336. ----
  337. .. _class_TabContainer_method_is_tab_disabled:
  338. .. rst-class:: classref-method
  339. :ref:`bool<class_bool>` **is_tab_disabled** **(** :ref:`int<class_int>` tab_idx **)** |const|
  340. Returns ``true`` if the tab at index ``tab_idx`` is disabled.
  341. .. rst-class:: classref-item-separator
  342. ----
  343. .. _class_TabContainer_method_is_tab_hidden:
  344. .. rst-class:: classref-method
  345. :ref:`bool<class_bool>` **is_tab_hidden** **(** :ref:`int<class_int>` tab_idx **)** |const|
  346. Returns ``true`` if the tab at index ``tab_idx`` is hidden.
  347. .. rst-class:: classref-item-separator
  348. ----
  349. .. _class_TabContainer_method_set_popup:
  350. .. rst-class:: classref-method
  351. void **set_popup** **(** :ref:`Node<class_Node>` popup **)**
  352. 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.
  353. .. rst-class:: classref-item-separator
  354. ----
  355. .. _class_TabContainer_method_set_tab_button_icon:
  356. .. rst-class:: classref-method
  357. void **set_tab_button_icon** **(** :ref:`int<class_int>` tab_idx, :ref:`Texture2D<class_Texture2D>` icon **)**
  358. Sets the button icon from the tab at index ``tab_idx``.
  359. .. rst-class:: classref-item-separator
  360. ----
  361. .. _class_TabContainer_method_set_tab_disabled:
  362. .. rst-class:: classref-method
  363. void **set_tab_disabled** **(** :ref:`int<class_int>` tab_idx, :ref:`bool<class_bool>` disabled **)**
  364. If ``disabled`` is ``true``, disables the tab at index ``tab_idx``, making it non-interactable.
  365. .. rst-class:: classref-item-separator
  366. ----
  367. .. _class_TabContainer_method_set_tab_hidden:
  368. .. rst-class:: classref-method
  369. void **set_tab_hidden** **(** :ref:`int<class_int>` tab_idx, :ref:`bool<class_bool>` hidden **)**
  370. If ``hidden`` is ``true``, hides the tab at index ``tab_idx``, making it disappear from the tab area.
  371. .. rst-class:: classref-item-separator
  372. ----
  373. .. _class_TabContainer_method_set_tab_icon:
  374. .. rst-class:: classref-method
  375. void **set_tab_icon** **(** :ref:`int<class_int>` tab_idx, :ref:`Texture2D<class_Texture2D>` icon **)**
  376. Sets an icon for the tab at index ``tab_idx``.
  377. .. rst-class:: classref-item-separator
  378. ----
  379. .. _class_TabContainer_method_set_tab_metadata:
  380. .. rst-class:: classref-method
  381. void **set_tab_metadata** **(** :ref:`int<class_int>` tab_idx, :ref:`Variant<class_Variant>` metadata **)**
  382. Sets the metadata value for the tab at index ``tab_idx``, which can be retrieved later using :ref:`get_tab_metadata<class_TabContainer_method_get_tab_metadata>`.
  383. .. rst-class:: classref-item-separator
  384. ----
  385. .. _class_TabContainer_method_set_tab_title:
  386. .. rst-class:: classref-method
  387. void **set_tab_title** **(** :ref:`int<class_int>` tab_idx, :ref:`String<class_String>` title **)**
  388. 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.
  389. .. rst-class:: classref-section-separator
  390. ----
  391. .. rst-class:: classref-descriptions-group
  392. Theme Property Descriptions
  393. ---------------------------
  394. .. _class_TabContainer_theme_color_drop_mark_color:
  395. .. rst-class:: classref-themeproperty
  396. :ref:`Color<class_Color>` **drop_mark_color** = ``Color(1, 1, 1, 1)``
  397. Modulation color for the :ref:`drop_mark<class_TabContainer_theme_icon_drop_mark>` icon.
  398. .. rst-class:: classref-item-separator
  399. ----
  400. .. _class_TabContainer_theme_color_font_disabled_color:
  401. .. rst-class:: classref-themeproperty
  402. :ref:`Color<class_Color>` **font_disabled_color** = ``Color(0.875, 0.875, 0.875, 0.5)``
  403. Font color of disabled tabs.
  404. .. rst-class:: classref-item-separator
  405. ----
  406. .. _class_TabContainer_theme_color_font_hovered_color:
  407. .. rst-class:: classref-themeproperty
  408. :ref:`Color<class_Color>` **font_hovered_color** = ``Color(0.95, 0.95, 0.95, 1)``
  409. Font color of the currently hovered tab.
  410. .. rst-class:: classref-item-separator
  411. ----
  412. .. _class_TabContainer_theme_color_font_outline_color:
  413. .. rst-class:: classref-themeproperty
  414. :ref:`Color<class_Color>` **font_outline_color** = ``Color(1, 1, 1, 1)``
  415. The tint of text outline of the tab name.
  416. .. rst-class:: classref-item-separator
  417. ----
  418. .. _class_TabContainer_theme_color_font_selected_color:
  419. .. rst-class:: classref-themeproperty
  420. :ref:`Color<class_Color>` **font_selected_color** = ``Color(0.95, 0.95, 0.95, 1)``
  421. Font color of the currently selected tab.
  422. .. rst-class:: classref-item-separator
  423. ----
  424. .. _class_TabContainer_theme_color_font_unselected_color:
  425. .. rst-class:: classref-themeproperty
  426. :ref:`Color<class_Color>` **font_unselected_color** = ``Color(0.7, 0.7, 0.7, 1)``
  427. Font color of the other, unselected tabs.
  428. .. rst-class:: classref-item-separator
  429. ----
  430. .. _class_TabContainer_theme_constant_icon_max_width:
  431. .. rst-class:: classref-themeproperty
  432. :ref:`int<class_int>` **icon_max_width** = ``0``
  433. The maximum allowed width of the tab's icon. This limit is applied on top of the default size of the icon, but before the value set with :ref:`TabBar.set_tab_icon_max_width<class_TabBar_method_set_tab_icon_max_width>`. The height is adjusted according to the icon's ratio.
  434. .. rst-class:: classref-item-separator
  435. ----
  436. .. _class_TabContainer_theme_constant_icon_separation:
  437. .. rst-class:: classref-themeproperty
  438. :ref:`int<class_int>` **icon_separation** = ``4``
  439. Space between tab's name and its icon.
  440. .. rst-class:: classref-item-separator
  441. ----
  442. .. _class_TabContainer_theme_constant_outline_size:
  443. .. rst-class:: classref-themeproperty
  444. :ref:`int<class_int>` **outline_size** = ``0``
  445. The size of the tab text outline.
  446. \ **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.
  447. .. rst-class:: classref-item-separator
  448. ----
  449. .. _class_TabContainer_theme_constant_side_margin:
  450. .. rst-class:: classref-themeproperty
  451. :ref:`int<class_int>` **side_margin** = ``8``
  452. The space at the left or right edges of the tab bar, accordingly with the current :ref:`tab_alignment<class_TabContainer_property_tab_alignment>`.
  453. 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>`.
  454. .. rst-class:: classref-item-separator
  455. ----
  456. .. _class_TabContainer_theme_font_font:
  457. .. rst-class:: classref-themeproperty
  458. :ref:`Font<class_Font>` **font**
  459. The font used to draw tab names.
  460. .. rst-class:: classref-item-separator
  461. ----
  462. .. _class_TabContainer_theme_font_size_font_size:
  463. .. rst-class:: classref-themeproperty
  464. :ref:`int<class_int>` **font_size**
  465. Font size of the tab names.
  466. .. rst-class:: classref-item-separator
  467. ----
  468. .. _class_TabContainer_theme_icon_decrement:
  469. .. rst-class:: classref-themeproperty
  470. :ref:`Texture2D<class_Texture2D>` **decrement**
  471. 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.
  472. .. rst-class:: classref-item-separator
  473. ----
  474. .. _class_TabContainer_theme_icon_decrement_highlight:
  475. .. rst-class:: classref-themeproperty
  476. :ref:`Texture2D<class_Texture2D>` **decrement_highlight**
  477. 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.
  478. .. rst-class:: classref-item-separator
  479. ----
  480. .. _class_TabContainer_theme_icon_drop_mark:
  481. .. rst-class:: classref-themeproperty
  482. :ref:`Texture2D<class_Texture2D>` **drop_mark**
  483. 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>`).
  484. .. rst-class:: classref-item-separator
  485. ----
  486. .. _class_TabContainer_theme_icon_increment:
  487. .. rst-class:: classref-themeproperty
  488. :ref:`Texture2D<class_Texture2D>` **increment**
  489. 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.
  490. .. rst-class:: classref-item-separator
  491. ----
  492. .. _class_TabContainer_theme_icon_increment_highlight:
  493. .. rst-class:: classref-themeproperty
  494. :ref:`Texture2D<class_Texture2D>` **increment_highlight**
  495. 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.
  496. .. rst-class:: classref-item-separator
  497. ----
  498. .. _class_TabContainer_theme_icon_menu:
  499. .. rst-class:: classref-themeproperty
  500. :ref:`Texture2D<class_Texture2D>` **menu**
  501. The icon for the menu button (see :ref:`set_popup<class_TabContainer_method_set_popup>`).
  502. .. rst-class:: classref-item-separator
  503. ----
  504. .. _class_TabContainer_theme_icon_menu_highlight:
  505. .. rst-class:: classref-themeproperty
  506. :ref:`Texture2D<class_Texture2D>` **menu_highlight**
  507. The icon for the menu button (see :ref:`set_popup<class_TabContainer_method_set_popup>`) when it's being hovered with the cursor.
  508. .. rst-class:: classref-item-separator
  509. ----
  510. .. _class_TabContainer_theme_style_panel:
  511. .. rst-class:: classref-themeproperty
  512. :ref:`StyleBox<class_StyleBox>` **panel**
  513. The style for the background fill.
  514. .. rst-class:: classref-item-separator
  515. ----
  516. .. _class_TabContainer_theme_style_tab_disabled:
  517. .. rst-class:: classref-themeproperty
  518. :ref:`StyleBox<class_StyleBox>` **tab_disabled**
  519. The style of disabled tabs.
  520. .. rst-class:: classref-item-separator
  521. ----
  522. .. _class_TabContainer_theme_style_tab_hovered:
  523. .. rst-class:: classref-themeproperty
  524. :ref:`StyleBox<class_StyleBox>` **tab_hovered**
  525. The style of the currently hovered tab.
  526. \ **Note:** This style will be drawn with the same width as :ref:`tab_unselected<class_TabContainer_theme_style_tab_unselected>` at minimum.
  527. .. rst-class:: classref-item-separator
  528. ----
  529. .. _class_TabContainer_theme_style_tab_selected:
  530. .. rst-class:: classref-themeproperty
  531. :ref:`StyleBox<class_StyleBox>` **tab_selected**
  532. The style of the currently selected tab.
  533. .. rst-class:: classref-item-separator
  534. ----
  535. .. _class_TabContainer_theme_style_tab_unselected:
  536. .. rst-class:: classref-themeproperty
  537. :ref:`StyleBox<class_StyleBox>` **tab_unselected**
  538. The style of the other, unselected tabs.
  539. .. rst-class:: classref-item-separator
  540. ----
  541. .. _class_TabContainer_theme_style_tabbar_background:
  542. .. rst-class:: classref-themeproperty
  543. :ref:`StyleBox<class_StyleBox>` **tabbar_background**
  544. The style for the background fill of the :ref:`TabBar<class_TabBar>` area.
  545. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  546. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  547. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  548. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  549. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  550. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  551. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`