class_tabcontainer.rst 46 KB

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