2
0

class_tabs.rst 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  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_current_tab>` |
  16. +---------------------------------------------------------------------+------------------------------------------------------------------------+
  17. | :ref:`bool<class_bool>` | :ref:`drag_to_rearrange_enabled<class_Tabs_drag_to_rearrange_enabled>` |
  18. +---------------------------------------------------------------------+------------------------------------------------------------------------+
  19. | :ref:`bool<class_bool>` | :ref:`scrolling_enabled<class_Tabs_scrolling_enabled>` |
  20. +---------------------------------------------------------------------+------------------------------------------------------------------------+
  21. | :ref:`TabAlign<enum_Tabs_TabAlign>` | :ref:`tab_align<class_Tabs_tab_align>` |
  22. +---------------------------------------------------------------------+------------------------------------------------------------------------+
  23. | :ref:`CloseButtonDisplayPolicy<enum_Tabs_CloseButtonDisplayPolicy>` | :ref:`tab_close_display_policy<class_Tabs_tab_close_display_policy>` |
  24. +---------------------------------------------------------------------+------------------------------------------------------------------------+
  25. Methods
  26. -------
  27. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`add_tab<class_Tabs_add_tab>` **(** :ref:`String<class_String>` title="", :ref:`Texture<class_Texture>` icon=null **)** |
  29. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`ensure_tab_visible<class_Tabs_ensure_tab_visible>` **(** :ref:`int<class_int>` idx **)** |
  31. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`bool<class_bool>` | :ref:`get_offset_buttons_visible<class_Tabs_get_offset_buttons_visible>` **(** **)** const |
  33. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`bool<class_bool>` | :ref:`get_select_with_rmb<class_Tabs_get_select_with_rmb>` **(** **)** const |
  35. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`int<class_int>` | :ref:`get_tab_count<class_Tabs_get_tab_count>` **(** **)** const |
  37. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`bool<class_bool>` | :ref:`get_tab_disabled<class_Tabs_get_tab_disabled>` **(** :ref:`int<class_int>` tab_idx **)** const |
  39. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`Texture<class_Texture>` | :ref:`get_tab_icon<class_Tabs_get_tab_icon>` **(** :ref:`int<class_int>` tab_idx **)** const |
  41. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`int<class_int>` | :ref:`get_tab_offset<class_Tabs_get_tab_offset>` **(** **)** const |
  43. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`Rect2<class_Rect2>` | :ref:`get_tab_rect<class_Tabs_get_tab_rect>` **(** :ref:`int<class_int>` tab_idx **)** const |
  45. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`String<class_String>` | :ref:`get_tab_title<class_Tabs_get_tab_title>` **(** :ref:`int<class_int>` tab_idx **)** const |
  47. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`int<class_int>` | :ref:`get_tabs_rearrange_group<class_Tabs_get_tabs_rearrange_group>` **(** **)** const |
  49. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  50. | void | :ref:`move_tab<class_Tabs_move_tab>` **(** :ref:`int<class_int>` from, :ref:`int<class_int>` to **)** |
  51. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  52. | void | :ref:`remove_tab<class_Tabs_remove_tab>` **(** :ref:`int<class_int>` tab_idx **)** |
  53. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  54. | void | :ref:`set_select_with_rmb<class_Tabs_set_select_with_rmb>` **(** :ref:`bool<class_bool>` enabled **)** |
  55. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  56. | void | :ref:`set_tab_disabled<class_Tabs_set_tab_disabled>` **(** :ref:`int<class_int>` tab_idx, :ref:`bool<class_bool>` disabled **)** |
  57. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  58. | void | :ref:`set_tab_icon<class_Tabs_set_tab_icon>` **(** :ref:`int<class_int>` tab_idx, :ref:`Texture<class_Texture>` icon **)** |
  59. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  60. | void | :ref:`set_tab_title<class_Tabs_set_tab_title>` **(** :ref:`int<class_int>` tab_idx, :ref:`String<class_String>` title **)** |
  61. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  62. | void | :ref:`set_tabs_rearrange_group<class_Tabs_set_tabs_rearrange_group>` **(** :ref:`int<class_int>` group_id **)** |
  63. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------+
  64. Theme Properties
  65. ----------------
  66. +---------------------------------+------------------------------------------------------------+
  67. | :ref:`StyleBox<class_StyleBox>` | :ref:`button<class_Tabs_button>` |
  68. +---------------------------------+------------------------------------------------------------+
  69. | :ref:`StyleBox<class_StyleBox>` | :ref:`button_pressed<class_Tabs_button_pressed>` |
  70. +---------------------------------+------------------------------------------------------------+
  71. | :ref:`Texture<class_Texture>` | :ref:`close<class_Tabs_close>` |
  72. +---------------------------------+------------------------------------------------------------+
  73. | :ref:`Texture<class_Texture>` | :ref:`decrement<class_Tabs_decrement>` |
  74. +---------------------------------+------------------------------------------------------------+
  75. | :ref:`Texture<class_Texture>` | :ref:`decrement_highlight<class_Tabs_decrement_highlight>` |
  76. +---------------------------------+------------------------------------------------------------+
  77. | :ref:`Font<class_Font>` | :ref:`font<class_Tabs_font>` |
  78. +---------------------------------+------------------------------------------------------------+
  79. | :ref:`Color<class_Color>` | :ref:`font_color_bg<class_Tabs_font_color_bg>` |
  80. +---------------------------------+------------------------------------------------------------+
  81. | :ref:`Color<class_Color>` | :ref:`font_color_disabled<class_Tabs_font_color_disabled>` |
  82. +---------------------------------+------------------------------------------------------------+
  83. | :ref:`Color<class_Color>` | :ref:`font_color_fg<class_Tabs_font_color_fg>` |
  84. +---------------------------------+------------------------------------------------------------+
  85. | :ref:`int<class_int>` | :ref:`hseparation<class_Tabs_hseparation>` |
  86. +---------------------------------+------------------------------------------------------------+
  87. | :ref:`Texture<class_Texture>` | :ref:`increment<class_Tabs_increment>` |
  88. +---------------------------------+------------------------------------------------------------+
  89. | :ref:`Texture<class_Texture>` | :ref:`increment_highlight<class_Tabs_increment_highlight>` |
  90. +---------------------------------+------------------------------------------------------------+
  91. | :ref:`int<class_int>` | :ref:`label_valign_bg<class_Tabs_label_valign_bg>` |
  92. +---------------------------------+------------------------------------------------------------+
  93. | :ref:`int<class_int>` | :ref:`label_valign_fg<class_Tabs_label_valign_fg>` |
  94. +---------------------------------+------------------------------------------------------------+
  95. | :ref:`StyleBox<class_StyleBox>` | :ref:`panel<class_Tabs_panel>` |
  96. +---------------------------------+------------------------------------------------------------+
  97. | :ref:`StyleBox<class_StyleBox>` | :ref:`tab_bg<class_Tabs_tab_bg>` |
  98. +---------------------------------+------------------------------------------------------------+
  99. | :ref:`StyleBox<class_StyleBox>` | :ref:`tab_fg<class_Tabs_tab_fg>` |
  100. +---------------------------------+------------------------------------------------------------+
  101. | :ref:`int<class_int>` | :ref:`top_margin<class_Tabs_top_margin>` |
  102. +---------------------------------+------------------------------------------------------------+
  103. Signals
  104. -------
  105. .. _class_Tabs_reposition_active_tab_request:
  106. - **reposition_active_tab_request** **(** :ref:`int<class_int>` idx_to **)**
  107. .. _class_Tabs_right_button_pressed:
  108. - **right_button_pressed** **(** :ref:`int<class_int>` tab **)**
  109. .. _class_Tabs_tab_changed:
  110. - **tab_changed** **(** :ref:`int<class_int>` tab **)**
  111. .. _class_Tabs_tab_clicked:
  112. - **tab_clicked** **(** :ref:`int<class_int>` tab **)**
  113. .. _class_Tabs_tab_close:
  114. - **tab_close** **(** :ref:`int<class_int>` tab **)**
  115. .. _class_Tabs_tab_hover:
  116. - **tab_hover** **(** :ref:`int<class_int>` tab **)**
  117. Enumerations
  118. ------------
  119. .. _enum_Tabs_TabAlign:
  120. enum **TabAlign**:
  121. - **ALIGN_LEFT** = **0** --- Align the tabs to the left.
  122. - **ALIGN_CENTER** = **1** --- Align the tabs to the center.
  123. - **ALIGN_RIGHT** = **2** --- Align the tabs to the right.
  124. - **ALIGN_MAX** = **3**
  125. .. _enum_Tabs_CloseButtonDisplayPolicy:
  126. enum **CloseButtonDisplayPolicy**:
  127. - **CLOSE_BUTTON_SHOW_NEVER** = **0**
  128. - **CLOSE_BUTTON_SHOW_ACTIVE_ONLY** = **1**
  129. - **CLOSE_BUTTON_SHOW_ALWAYS** = **2**
  130. - **CLOSE_BUTTON_MAX** = **3**
  131. Description
  132. -----------
  133. Simple tabs control, similar to :ref:`TabContainer<class_TabContainer>` but is only in charge of drawing tabs, not interact with children.
  134. Property Descriptions
  135. ---------------------
  136. .. _class_Tabs_current_tab:
  137. - :ref:`int<class_int>` **current_tab**
  138. +----------+------------------------+
  139. | *Setter* | set_current_tab(value) |
  140. +----------+------------------------+
  141. | *Getter* | get_current_tab() |
  142. +----------+------------------------+
  143. Select tab at index ``tab_idx``.
  144. .. _class_Tabs_drag_to_rearrange_enabled:
  145. - :ref:`bool<class_bool>` **drag_to_rearrange_enabled**
  146. +----------+--------------------------------------+
  147. | *Setter* | set_drag_to_rearrange_enabled(value) |
  148. +----------+--------------------------------------+
  149. | *Getter* | get_drag_to_rearrange_enabled() |
  150. +----------+--------------------------------------+
  151. If ``true``, tabs can be rearranged with mouse drag.
  152. .. _class_Tabs_scrolling_enabled:
  153. - :ref:`bool<class_bool>` **scrolling_enabled**
  154. +----------+------------------------------+
  155. | *Setter* | set_scrolling_enabled(value) |
  156. +----------+------------------------------+
  157. | *Getter* | get_scrolling_enabled() |
  158. +----------+------------------------------+
  159. .. _class_Tabs_tab_align:
  160. - :ref:`TabAlign<enum_Tabs_TabAlign>` **tab_align**
  161. +----------+----------------------+
  162. | *Setter* | set_tab_align(value) |
  163. +----------+----------------------+
  164. | *Getter* | get_tab_align() |
  165. +----------+----------------------+
  166. The alignment of all tabs. See enum ``TabAlign`` constants for details.
  167. .. _class_Tabs_tab_close_display_policy:
  168. - :ref:`CloseButtonDisplayPolicy<enum_Tabs_CloseButtonDisplayPolicy>` **tab_close_display_policy**
  169. +----------+-------------------------------------+
  170. | *Setter* | set_tab_close_display_policy(value) |
  171. +----------+-------------------------------------+
  172. | *Getter* | get_tab_close_display_policy() |
  173. +----------+-------------------------------------+
  174. Method Descriptions
  175. -------------------
  176. .. _class_Tabs_add_tab:
  177. - void **add_tab** **(** :ref:`String<class_String>` title="", :ref:`Texture<class_Texture>` icon=null **)**
  178. Adds a new tab.
  179. .. _class_Tabs_ensure_tab_visible:
  180. - void **ensure_tab_visible** **(** :ref:`int<class_int>` idx **)**
  181. Moves the Scroll view to make the tab visible.
  182. .. _class_Tabs_get_offset_buttons_visible:
  183. - :ref:`bool<class_bool>` **get_offset_buttons_visible** **(** **)** const
  184. .. _class_Tabs_get_select_with_rmb:
  185. - :ref:`bool<class_bool>` **get_select_with_rmb** **(** **)** const
  186. Returns ``true`` if select with right mouse button is enabled.
  187. .. _class_Tabs_get_tab_count:
  188. - :ref:`int<class_int>` **get_tab_count** **(** **)** const
  189. Returns the number of tabs.
  190. .. _class_Tabs_get_tab_disabled:
  191. - :ref:`bool<class_bool>` **get_tab_disabled** **(** :ref:`int<class_int>` tab_idx **)** const
  192. Returns ``true`` if the tab at index ``tab_idx`` is disabled.
  193. .. _class_Tabs_get_tab_icon:
  194. - :ref:`Texture<class_Texture>` **get_tab_icon** **(** :ref:`int<class_int>` tab_idx **)** const
  195. Returns the :ref:`Texture<class_Texture>` for the tab at index ``tab_idx`` or null if the tab has no :ref:`Texture<class_Texture>`.
  196. .. _class_Tabs_get_tab_offset:
  197. - :ref:`int<class_int>` **get_tab_offset** **(** **)** const
  198. .. _class_Tabs_get_tab_rect:
  199. - :ref:`Rect2<class_Rect2>` **get_tab_rect** **(** :ref:`int<class_int>` tab_idx **)** const
  200. Returns tab :ref:`Rect2<class_Rect2>` with local position and size.
  201. .. _class_Tabs_get_tab_title:
  202. - :ref:`String<class_String>` **get_tab_title** **(** :ref:`int<class_int>` tab_idx **)** const
  203. 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_set_tab_title>`.
  204. .. _class_Tabs_get_tabs_rearrange_group:
  205. - :ref:`int<class_int>` **get_tabs_rearrange_group** **(** **)** const
  206. Returns the ``Tabs`` rearrange group id.
  207. .. _class_Tabs_move_tab:
  208. - void **move_tab** **(** :ref:`int<class_int>` from, :ref:`int<class_int>` to **)**
  209. Rearrange tab.
  210. .. _class_Tabs_remove_tab:
  211. - void **remove_tab** **(** :ref:`int<class_int>` tab_idx **)**
  212. Removes tab at index ``tab_idx``
  213. .. _class_Tabs_set_select_with_rmb:
  214. - void **set_select_with_rmb** **(** :ref:`bool<class_bool>` enabled **)**
  215. If ``true``, enables selecting a tab with right mouse button.
  216. .. _class_Tabs_set_tab_disabled:
  217. - void **set_tab_disabled** **(** :ref:`int<class_int>` tab_idx, :ref:`bool<class_bool>` disabled **)**
  218. 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_set_tab_title>`.
  219. .. _class_Tabs_set_tab_icon:
  220. - void **set_tab_icon** **(** :ref:`int<class_int>` tab_idx, :ref:`Texture<class_Texture>` icon **)**
  221. Sets an icon for the tab at index ``tab_idx``.
  222. .. _class_Tabs_set_tab_title:
  223. - void **set_tab_title** **(** :ref:`int<class_int>` tab_idx, :ref:`String<class_String>` title **)**
  224. Sets a title for the tab at index ``tab_idx``.
  225. .. _class_Tabs_set_tabs_rearrange_group:
  226. - void **set_tabs_rearrange_group** **(** :ref:`int<class_int>` group_id **)**
  227. 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)``.