class_tabs.rst 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  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_fg |
  100. +---------------------------------+---------------------+
  101. | :ref:`int<class_int>` | top_margin |
  102. +---------------------------------+---------------------+
  103. Signals
  104. -------
  105. .. _class_Tabs_signal_reposition_active_tab_request:
  106. - **reposition_active_tab_request** **(** :ref:`int<class_int>` idx_to **)**
  107. .. _class_Tabs_signal_right_button_pressed:
  108. - **right_button_pressed** **(** :ref:`int<class_int>` tab **)**
  109. .. _class_Tabs_signal_tab_changed:
  110. - **tab_changed** **(** :ref:`int<class_int>` tab **)**
  111. .. _class_Tabs_signal_tab_clicked:
  112. - **tab_clicked** **(** :ref:`int<class_int>` tab **)**
  113. .. _class_Tabs_signal_tab_close:
  114. - **tab_close** **(** :ref:`int<class_int>` tab **)**
  115. .. _class_Tabs_signal_tab_hover:
  116. - **tab_hover** **(** :ref:`int<class_int>` tab **)**
  117. Enumerations
  118. ------------
  119. .. _enum_Tabs_TabAlign:
  120. .. _class_Tabs_constant_ALIGN_LEFT:
  121. .. _class_Tabs_constant_ALIGN_CENTER:
  122. .. _class_Tabs_constant_ALIGN_RIGHT:
  123. .. _class_Tabs_constant_ALIGN_MAX:
  124. enum **TabAlign**:
  125. - **ALIGN_LEFT** = **0** --- Align the tabs to the left.
  126. - **ALIGN_CENTER** = **1** --- Align the tabs to the center.
  127. - **ALIGN_RIGHT** = **2** --- Align the tabs to the right.
  128. - **ALIGN_MAX** = **3**
  129. .. _enum_Tabs_CloseButtonDisplayPolicy:
  130. .. _class_Tabs_constant_CLOSE_BUTTON_SHOW_NEVER:
  131. .. _class_Tabs_constant_CLOSE_BUTTON_SHOW_ACTIVE_ONLY:
  132. .. _class_Tabs_constant_CLOSE_BUTTON_SHOW_ALWAYS:
  133. .. _class_Tabs_constant_CLOSE_BUTTON_MAX:
  134. enum **CloseButtonDisplayPolicy**:
  135. - **CLOSE_BUTTON_SHOW_NEVER** = **0**
  136. - **CLOSE_BUTTON_SHOW_ACTIVE_ONLY** = **1**
  137. - **CLOSE_BUTTON_SHOW_ALWAYS** = **2**
  138. - **CLOSE_BUTTON_MAX** = **3**
  139. Description
  140. -----------
  141. Simple tabs control, similar to :ref:`TabContainer<class_TabContainer>` but is only in charge of drawing tabs, not interact with children.
  142. Property Descriptions
  143. ---------------------
  144. .. _class_Tabs_property_current_tab:
  145. - :ref:`int<class_int>` **current_tab**
  146. +----------+------------------------+
  147. | *Setter* | set_current_tab(value) |
  148. +----------+------------------------+
  149. | *Getter* | get_current_tab() |
  150. +----------+------------------------+
  151. Select tab at index ``tab_idx``.
  152. .. _class_Tabs_property_drag_to_rearrange_enabled:
  153. - :ref:`bool<class_bool>` **drag_to_rearrange_enabled**
  154. +----------+--------------------------------------+
  155. | *Setter* | set_drag_to_rearrange_enabled(value) |
  156. +----------+--------------------------------------+
  157. | *Getter* | get_drag_to_rearrange_enabled() |
  158. +----------+--------------------------------------+
  159. If ``true``, tabs can be rearranged with mouse drag.
  160. .. _class_Tabs_property_scrolling_enabled:
  161. - :ref:`bool<class_bool>` **scrolling_enabled**
  162. +----------+------------------------------+
  163. | *Setter* | set_scrolling_enabled(value) |
  164. +----------+------------------------------+
  165. | *Getter* | get_scrolling_enabled() |
  166. +----------+------------------------------+
  167. .. _class_Tabs_property_tab_align:
  168. - :ref:`TabAlign<enum_Tabs_TabAlign>` **tab_align**
  169. +----------+----------------------+
  170. | *Setter* | set_tab_align(value) |
  171. +----------+----------------------+
  172. | *Getter* | get_tab_align() |
  173. +----------+----------------------+
  174. The alignment of all tabs. See enum ``TabAlign`` constants for details.
  175. .. _class_Tabs_property_tab_close_display_policy:
  176. - :ref:`CloseButtonDisplayPolicy<enum_Tabs_CloseButtonDisplayPolicy>` **tab_close_display_policy**
  177. +----------+-------------------------------------+
  178. | *Setter* | set_tab_close_display_policy(value) |
  179. +----------+-------------------------------------+
  180. | *Getter* | get_tab_close_display_policy() |
  181. +----------+-------------------------------------+
  182. Method Descriptions
  183. -------------------
  184. .. _class_Tabs_method_add_tab:
  185. - void **add_tab** **(** :ref:`String<class_String>` title="", :ref:`Texture<class_Texture>` icon=null **)**
  186. Adds a new tab.
  187. .. _class_Tabs_method_ensure_tab_visible:
  188. - void **ensure_tab_visible** **(** :ref:`int<class_int>` idx **)**
  189. Moves the Scroll view to make the tab visible.
  190. .. _class_Tabs_method_get_offset_buttons_visible:
  191. - :ref:`bool<class_bool>` **get_offset_buttons_visible** **(** **)** const
  192. .. _class_Tabs_method_get_select_with_rmb:
  193. - :ref:`bool<class_bool>` **get_select_with_rmb** **(** **)** const
  194. Returns ``true`` if select with right mouse button is enabled.
  195. .. _class_Tabs_method_get_tab_count:
  196. - :ref:`int<class_int>` **get_tab_count** **(** **)** const
  197. Returns the number of tabs.
  198. .. _class_Tabs_method_get_tab_disabled:
  199. - :ref:`bool<class_bool>` **get_tab_disabled** **(** :ref:`int<class_int>` tab_idx **)** const
  200. Returns ``true`` if the tab at index ``tab_idx`` is disabled.
  201. .. _class_Tabs_method_get_tab_icon:
  202. - :ref:`Texture<class_Texture>` **get_tab_icon** **(** :ref:`int<class_int>` tab_idx **)** const
  203. Returns the :ref:`Texture<class_Texture>` for the tab at index ``tab_idx`` or null if the tab has no :ref:`Texture<class_Texture>`.
  204. .. _class_Tabs_method_get_tab_offset:
  205. - :ref:`int<class_int>` **get_tab_offset** **(** **)** const
  206. .. _class_Tabs_method_get_tab_rect:
  207. - :ref:`Rect2<class_Rect2>` **get_tab_rect** **(** :ref:`int<class_int>` tab_idx **)** const
  208. Returns tab :ref:`Rect2<class_Rect2>` with local position and size.
  209. .. _class_Tabs_method_get_tab_title:
  210. - :ref:`String<class_String>` **get_tab_title** **(** :ref:`int<class_int>` tab_idx **)** const
  211. 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>`.
  212. .. _class_Tabs_method_get_tabs_rearrange_group:
  213. - :ref:`int<class_int>` **get_tabs_rearrange_group** **(** **)** const
  214. Returns the ``Tabs`` rearrange group id.
  215. .. _class_Tabs_method_move_tab:
  216. - void **move_tab** **(** :ref:`int<class_int>` from, :ref:`int<class_int>` to **)**
  217. Rearrange tab.
  218. .. _class_Tabs_method_remove_tab:
  219. - void **remove_tab** **(** :ref:`int<class_int>` tab_idx **)**
  220. Removes tab at index ``tab_idx``
  221. .. _class_Tabs_method_set_select_with_rmb:
  222. - void **set_select_with_rmb** **(** :ref:`bool<class_bool>` enabled **)**
  223. If ``true``, enables selecting a tab with right mouse button.
  224. .. _class_Tabs_method_set_tab_disabled:
  225. - void **set_tab_disabled** **(** :ref:`int<class_int>` tab_idx, :ref:`bool<class_bool>` disabled **)**
  226. 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>`.
  227. .. _class_Tabs_method_set_tab_icon:
  228. - void **set_tab_icon** **(** :ref:`int<class_int>` tab_idx, :ref:`Texture<class_Texture>` icon **)**
  229. Sets an icon for the tab at index ``tab_idx``.
  230. .. _class_Tabs_method_set_tab_title:
  231. - void **set_tab_title** **(** :ref:`int<class_int>` tab_idx, :ref:`String<class_String>` title **)**
  232. Sets a title for the tab at index ``tab_idx``.
  233. .. _class_Tabs_method_set_tabs_rearrange_group:
  234. - void **set_tabs_rearrange_group** **(** :ref:`int<class_int>` group_id **)**
  235. 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)``.