class_tabs.rst 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Tabs.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Tabs:
  5. Tabs
  6. ====
  7. **Inherits:** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Tabs Control.
  12. Properties
  13. ----------
  14. +---------------------------------------------------------------------+---------------------------------------------------------------------------------+
  15. | :ref:`int<class_int>` | :ref:`current_tab<class_Tabs_property_current_tab>` |
  16. +---------------------------------------------------------------------+---------------------------------------------------------------------------------+
  17. | :ref:`bool<class_bool>` | :ref:`drag_to_rearrange_enabled<class_Tabs_property_drag_to_rearrange_enabled>` |
  18. +---------------------------------------------------------------------+---------------------------------------------------------------------------------+
  19. | :ref:`bool<class_bool>` | :ref:`scrolling_enabled<class_Tabs_property_scrolling_enabled>` |
  20. +---------------------------------------------------------------------+---------------------------------------------------------------------------------+
  21. | :ref:`TabAlign<enum_Tabs_TabAlign>` | :ref:`tab_align<class_Tabs_property_tab_align>` |
  22. +---------------------------------------------------------------------+---------------------------------------------------------------------------------+
  23. | :ref:`CloseButtonDisplayPolicy<enum_Tabs_CloseButtonDisplayPolicy>` | :ref:`tab_close_display_policy<class_Tabs_property_tab_close_display_policy>` |
  24. +---------------------------------------------------------------------+---------------------------------------------------------------------------------+
  25. Methods
  26. -------
  27. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`add_tab<class_Tabs_method_add_tab>` **(** :ref:`String<class_String>` title="", :ref:`Texture<class_Texture>` icon=null **)** |
  29. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`ensure_tab_visible<class_Tabs_method_ensure_tab_visible>` **(** :ref:`int<class_int>` idx **)** |
  31. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`bool<class_bool>` | :ref:`get_offset_buttons_visible<class_Tabs_method_get_offset_buttons_visible>` **(** **)** const |
  33. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`bool<class_bool>` | :ref:`get_select_with_rmb<class_Tabs_method_get_select_with_rmb>` **(** **)** const |
  35. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`int<class_int>` | :ref:`get_tab_count<class_Tabs_method_get_tab_count>` **(** **)** const |
  37. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`bool<class_bool>` | :ref:`get_tab_disabled<class_Tabs_method_get_tab_disabled>` **(** :ref:`int<class_int>` tab_idx **)** const |
  39. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`Texture<class_Texture>` | :ref:`get_tab_icon<class_Tabs_method_get_tab_icon>` **(** :ref:`int<class_int>` tab_idx **)** const |
  41. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`int<class_int>` | :ref:`get_tab_offset<class_Tabs_method_get_tab_offset>` **(** **)** const |
  43. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`Rect2<class_Rect2>` | :ref:`get_tab_rect<class_Tabs_method_get_tab_rect>` **(** :ref:`int<class_int>` tab_idx **)** const |
  45. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`String<class_String>` | :ref:`get_tab_title<class_Tabs_method_get_tab_title>` **(** :ref:`int<class_int>` tab_idx **)** const |
  47. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`int<class_int>` | :ref:`get_tabs_rearrange_group<class_Tabs_method_get_tabs_rearrange_group>` **(** **)** const |
  49. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  50. | void | :ref:`move_tab<class_Tabs_method_move_tab>` **(** :ref:`int<class_int>` from, :ref:`int<class_int>` to **)** |
  51. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  52. | void | :ref:`remove_tab<class_Tabs_method_remove_tab>` **(** :ref:`int<class_int>` tab_idx **)** |
  53. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  54. | void | :ref:`set_select_with_rmb<class_Tabs_method_set_select_with_rmb>` **(** :ref:`bool<class_bool>` enabled **)** |
  55. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  56. | void | :ref:`set_tab_disabled<class_Tabs_method_set_tab_disabled>` **(** :ref:`int<class_int>` tab_idx, :ref:`bool<class_bool>` disabled **)** |
  57. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  58. | void | :ref:`set_tab_icon<class_Tabs_method_set_tab_icon>` **(** :ref:`int<class_int>` tab_idx, :ref:`Texture<class_Texture>` icon **)** |
  59. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  60. | void | :ref:`set_tab_title<class_Tabs_method_set_tab_title>` **(** :ref:`int<class_int>` tab_idx, :ref:`String<class_String>` title **)** |
  61. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  62. | void | :ref:`set_tabs_rearrange_group<class_Tabs_method_set_tabs_rearrange_group>` **(** :ref:`int<class_int>` group_id **)** |
  63. +-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
  64. Theme Properties
  65. ----------------
  66. +---------------------------------+---------------------+
  67. | :ref:`StyleBox<class_StyleBox>` | button |
  68. +---------------------------------+---------------------+
  69. | :ref:`StyleBox<class_StyleBox>` | button_pressed |
  70. +---------------------------------+---------------------+
  71. | :ref:`Texture<class_Texture>` | close |
  72. +---------------------------------+---------------------+
  73. | :ref:`Texture<class_Texture>` | decrement |
  74. +---------------------------------+---------------------+
  75. | :ref:`Texture<class_Texture>` | decrement_highlight |
  76. +---------------------------------+---------------------+
  77. | :ref:`Font<class_Font>` | font |
  78. +---------------------------------+---------------------+
  79. | :ref:`Color<class_Color>` | font_color_bg |
  80. +---------------------------------+---------------------+
  81. | :ref:`Color<class_Color>` | font_color_disabled |
  82. +---------------------------------+---------------------+
  83. | :ref:`Color<class_Color>` | font_color_fg |
  84. +---------------------------------+---------------------+
  85. | :ref:`int<class_int>` | hseparation |
  86. +---------------------------------+---------------------+
  87. | :ref:`Texture<class_Texture>` | increment |
  88. +---------------------------------+---------------------+
  89. | :ref:`Texture<class_Texture>` | increment_highlight |
  90. +---------------------------------+---------------------+
  91. | :ref:`int<class_int>` | label_valign_bg |
  92. +---------------------------------+---------------------+
  93. | :ref:`int<class_int>` | label_valign_fg |
  94. +---------------------------------+---------------------+
  95. | :ref:`StyleBox<class_StyleBox>` | panel |
  96. +---------------------------------+---------------------+
  97. | :ref:`StyleBox<class_StyleBox>` | tab_bg |
  98. +---------------------------------+---------------------+
  99. | :ref:`StyleBox<class_StyleBox>` | tab_disabled |
  100. +---------------------------------+---------------------+
  101. | :ref:`StyleBox<class_StyleBox>` | tab_fg |
  102. +---------------------------------+---------------------+
  103. | :ref:`int<class_int>` | top_margin |
  104. +---------------------------------+---------------------+
  105. Signals
  106. -------
  107. .. _class_Tabs_signal_reposition_active_tab_request:
  108. - **reposition_active_tab_request** **(** :ref:`int<class_int>` idx_to **)**
  109. .. _class_Tabs_signal_right_button_pressed:
  110. - **right_button_pressed** **(** :ref:`int<class_int>` tab **)**
  111. .. _class_Tabs_signal_tab_changed:
  112. - **tab_changed** **(** :ref:`int<class_int>` tab **)**
  113. .. _class_Tabs_signal_tab_clicked:
  114. - **tab_clicked** **(** :ref:`int<class_int>` tab **)**
  115. .. _class_Tabs_signal_tab_close:
  116. - **tab_close** **(** :ref:`int<class_int>` tab **)**
  117. .. _class_Tabs_signal_tab_hover:
  118. - **tab_hover** **(** :ref:`int<class_int>` tab **)**
  119. Enumerations
  120. ------------
  121. .. _enum_Tabs_TabAlign:
  122. .. _class_Tabs_constant_ALIGN_LEFT:
  123. .. _class_Tabs_constant_ALIGN_CENTER:
  124. .. _class_Tabs_constant_ALIGN_RIGHT:
  125. .. _class_Tabs_constant_ALIGN_MAX:
  126. enum **TabAlign**:
  127. - **ALIGN_LEFT** = **0** --- Align the tabs to the left.
  128. - **ALIGN_CENTER** = **1** --- Align the tabs to the center.
  129. - **ALIGN_RIGHT** = **2** --- Align the tabs to the right.
  130. - **ALIGN_MAX** = **3**
  131. .. _enum_Tabs_CloseButtonDisplayPolicy:
  132. .. _class_Tabs_constant_CLOSE_BUTTON_SHOW_NEVER:
  133. .. _class_Tabs_constant_CLOSE_BUTTON_SHOW_ACTIVE_ONLY:
  134. .. _class_Tabs_constant_CLOSE_BUTTON_SHOW_ALWAYS:
  135. .. _class_Tabs_constant_CLOSE_BUTTON_MAX:
  136. enum **CloseButtonDisplayPolicy**:
  137. - **CLOSE_BUTTON_SHOW_NEVER** = **0**
  138. - **CLOSE_BUTTON_SHOW_ACTIVE_ONLY** = **1**
  139. - **CLOSE_BUTTON_SHOW_ALWAYS** = **2**
  140. - **CLOSE_BUTTON_MAX** = **3**
  141. Description
  142. -----------
  143. Simple tabs control, similar to :ref:`TabContainer<class_TabContainer>` but is only in charge of drawing tabs, not interact with children.
  144. Property Descriptions
  145. ---------------------
  146. .. _class_Tabs_property_current_tab:
  147. - :ref:`int<class_int>` **current_tab**
  148. +----------+------------------------+
  149. | *Setter* | set_current_tab(value) |
  150. +----------+------------------------+
  151. | *Getter* | get_current_tab() |
  152. +----------+------------------------+
  153. Select tab at index ``tab_idx``.
  154. .. _class_Tabs_property_drag_to_rearrange_enabled:
  155. - :ref:`bool<class_bool>` **drag_to_rearrange_enabled**
  156. +----------+--------------------------------------+
  157. | *Setter* | set_drag_to_rearrange_enabled(value) |
  158. +----------+--------------------------------------+
  159. | *Getter* | get_drag_to_rearrange_enabled() |
  160. +----------+--------------------------------------+
  161. If ``true``, tabs can be rearranged with mouse drag.
  162. .. _class_Tabs_property_scrolling_enabled:
  163. - :ref:`bool<class_bool>` **scrolling_enabled**
  164. +----------+------------------------------+
  165. | *Setter* | set_scrolling_enabled(value) |
  166. +----------+------------------------------+
  167. | *Getter* | get_scrolling_enabled() |
  168. +----------+------------------------------+
  169. .. _class_Tabs_property_tab_align:
  170. - :ref:`TabAlign<enum_Tabs_TabAlign>` **tab_align**
  171. +----------+----------------------+
  172. | *Setter* | set_tab_align(value) |
  173. +----------+----------------------+
  174. | *Getter* | get_tab_align() |
  175. +----------+----------------------+
  176. The alignment of all tabs. See enum ``TabAlign`` constants for details.
  177. .. _class_Tabs_property_tab_close_display_policy:
  178. - :ref:`CloseButtonDisplayPolicy<enum_Tabs_CloseButtonDisplayPolicy>` **tab_close_display_policy**
  179. +----------+-------------------------------------+
  180. | *Setter* | set_tab_close_display_policy(value) |
  181. +----------+-------------------------------------+
  182. | *Getter* | get_tab_close_display_policy() |
  183. +----------+-------------------------------------+
  184. Method Descriptions
  185. -------------------
  186. .. _class_Tabs_method_add_tab:
  187. - void **add_tab** **(** :ref:`String<class_String>` title="", :ref:`Texture<class_Texture>` icon=null **)**
  188. Adds a new tab.
  189. .. _class_Tabs_method_ensure_tab_visible:
  190. - void **ensure_tab_visible** **(** :ref:`int<class_int>` idx **)**
  191. Moves the Scroll view to make the tab visible.
  192. .. _class_Tabs_method_get_offset_buttons_visible:
  193. - :ref:`bool<class_bool>` **get_offset_buttons_visible** **(** **)** const
  194. .. _class_Tabs_method_get_select_with_rmb:
  195. - :ref:`bool<class_bool>` **get_select_with_rmb** **(** **)** const
  196. Returns ``true`` if select with right mouse button is enabled.
  197. .. _class_Tabs_method_get_tab_count:
  198. - :ref:`int<class_int>` **get_tab_count** **(** **)** const
  199. Returns the number of tabs.
  200. .. _class_Tabs_method_get_tab_disabled:
  201. - :ref:`bool<class_bool>` **get_tab_disabled** **(** :ref:`int<class_int>` tab_idx **)** const
  202. Returns ``true`` if the tab at index ``tab_idx`` is disabled.
  203. .. _class_Tabs_method_get_tab_icon:
  204. - :ref:`Texture<class_Texture>` **get_tab_icon** **(** :ref:`int<class_int>` tab_idx **)** const
  205. Returns the :ref:`Texture<class_Texture>` for the tab at index ``tab_idx`` or null if the tab has no :ref:`Texture<class_Texture>`.
  206. .. _class_Tabs_method_get_tab_offset:
  207. - :ref:`int<class_int>` **get_tab_offset** **(** **)** const
  208. .. _class_Tabs_method_get_tab_rect:
  209. - :ref:`Rect2<class_Rect2>` **get_tab_rect** **(** :ref:`int<class_int>` tab_idx **)** const
  210. Returns tab :ref:`Rect2<class_Rect2>` with local position and size.
  211. .. _class_Tabs_method_get_tab_title:
  212. - :ref:`String<class_String>` **get_tab_title** **(** :ref:`int<class_int>` tab_idx **)** const
  213. 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_Tabs_method_set_tab_title>`.
  214. .. _class_Tabs_method_get_tabs_rearrange_group:
  215. - :ref:`int<class_int>` **get_tabs_rearrange_group** **(** **)** const
  216. Returns the ``Tabs`` rearrange group id.
  217. .. _class_Tabs_method_move_tab:
  218. - void **move_tab** **(** :ref:`int<class_int>` from, :ref:`int<class_int>` to **)**
  219. Rearrange tab.
  220. .. _class_Tabs_method_remove_tab:
  221. - void **remove_tab** **(** :ref:`int<class_int>` tab_idx **)**
  222. Removes tab at index ``tab_idx``
  223. .. _class_Tabs_method_set_select_with_rmb:
  224. - void **set_select_with_rmb** **(** :ref:`bool<class_bool>` enabled **)**
  225. If ``true``, enables selecting a tab with right mouse button.
  226. .. _class_Tabs_method_set_tab_disabled:
  227. - void **set_tab_disabled** **(** :ref:`int<class_int>` tab_idx, :ref:`bool<class_bool>` disabled **)**
  228. If ``disabled`` is ``false``, hides the tab at index ``tab_idx``. Note that its title text will remain, unless also removed with :ref:`set_tab_title<class_Tabs_method_set_tab_title>`.
  229. .. _class_Tabs_method_set_tab_icon:
  230. - void **set_tab_icon** **(** :ref:`int<class_int>` tab_idx, :ref:`Texture<class_Texture>` icon **)**
  231. Sets an icon for the tab at index ``tab_idx``.
  232. .. _class_Tabs_method_set_tab_title:
  233. - void **set_tab_title** **(** :ref:`int<class_int>` tab_idx, :ref:`String<class_String>` title **)**
  234. Sets a title for the tab at index ``tab_idx``.
  235. .. _class_Tabs_method_set_tabs_rearrange_group:
  236. - void **set_tabs_rearrange_group** **(** :ref:`int<class_int>` group_id **)**
  237. Defines rearrange group id, choose for each ``Tabs`` the same value to enable tab drag between ``Tabs``. Enable drag with ``set_drag_to_rearrange_enabled(true)``.