Tabs.xml 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Tabs" inherits="Control" version="3.2">
  3. <brief_description>
  4. Tabs control.
  5. </brief_description>
  6. <description>
  7. Simple tabs control, similar to [TabContainer] but is only in charge of drawing tabs, not interact with children.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="add_tab">
  13. <return type="void">
  14. </return>
  15. <argument index="0" name="title" type="String" default="&quot;&quot;">
  16. </argument>
  17. <argument index="1" name="icon" type="Texture" default="null">
  18. </argument>
  19. <description>
  20. Adds a new tab.
  21. </description>
  22. </method>
  23. <method name="ensure_tab_visible">
  24. <return type="void">
  25. </return>
  26. <argument index="0" name="idx" type="int">
  27. </argument>
  28. <description>
  29. Moves the scroll view to make the tab visible.
  30. </description>
  31. </method>
  32. <method name="get_offset_buttons_visible" qualifiers="const">
  33. <return type="bool">
  34. </return>
  35. <description>
  36. Returns [code]true[/code] if the offset buttons (the ones that appear when there's not enough space for all tabs) are visible.
  37. </description>
  38. </method>
  39. <method name="get_select_with_rmb" qualifiers="const">
  40. <return type="bool">
  41. </return>
  42. <description>
  43. Returns [code]true[/code] if select with right mouse button is enabled.
  44. </description>
  45. </method>
  46. <method name="get_tab_count" qualifiers="const">
  47. <return type="int">
  48. </return>
  49. <description>
  50. Returns the number of tabs.
  51. </description>
  52. </method>
  53. <method name="get_tab_disabled" qualifiers="const">
  54. <return type="bool">
  55. </return>
  56. <argument index="0" name="tab_idx" type="int">
  57. </argument>
  58. <description>
  59. Returns [code]true[/code] if the tab at index [code]tab_idx[/code] is disabled.
  60. </description>
  61. </method>
  62. <method name="get_tab_icon" qualifiers="const">
  63. <return type="Texture">
  64. </return>
  65. <argument index="0" name="tab_idx" type="int">
  66. </argument>
  67. <description>
  68. Returns the [Texture] for the tab at index [code]tab_idx[/code] or [code]null[/code] if the tab has no [Texture].
  69. </description>
  70. </method>
  71. <method name="get_tab_offset" qualifiers="const">
  72. <return type="int">
  73. </return>
  74. <description>
  75. Returns the number of hidden tabs offsetted to the left.
  76. </description>
  77. </method>
  78. <method name="get_tab_rect" qualifiers="const">
  79. <return type="Rect2">
  80. </return>
  81. <argument index="0" name="tab_idx" type="int">
  82. </argument>
  83. <description>
  84. Returns tab [Rect2] with local position and size.
  85. </description>
  86. </method>
  87. <method name="get_tab_title" qualifiers="const">
  88. <return type="String">
  89. </return>
  90. <argument index="0" name="tab_idx" type="int">
  91. </argument>
  92. <description>
  93. Returns the title of the tab at index [code]tab_idx[/code]. Tab titles default to the name of the indexed child node, but this can be overridden with [method set_tab_title].
  94. </description>
  95. </method>
  96. <method name="get_tabs_rearrange_group" qualifiers="const">
  97. <return type="int">
  98. </return>
  99. <description>
  100. Returns the [Tabs]' rearrange group ID.
  101. </description>
  102. </method>
  103. <method name="move_tab">
  104. <return type="void">
  105. </return>
  106. <argument index="0" name="from" type="int">
  107. </argument>
  108. <argument index="1" name="to" type="int">
  109. </argument>
  110. <description>
  111. Moves a tab from [code]from[/code] to [code]to[/code].
  112. </description>
  113. </method>
  114. <method name="remove_tab">
  115. <return type="void">
  116. </return>
  117. <argument index="0" name="tab_idx" type="int">
  118. </argument>
  119. <description>
  120. Removes the tab at index [code]tab_idx[/code].
  121. </description>
  122. </method>
  123. <method name="set_select_with_rmb">
  124. <return type="void">
  125. </return>
  126. <argument index="0" name="enabled" type="bool">
  127. </argument>
  128. <description>
  129. If [code]true[/code], enables selecting a tab with the right mouse button.
  130. </description>
  131. </method>
  132. <method name="set_tab_disabled">
  133. <return type="void">
  134. </return>
  135. <argument index="0" name="tab_idx" type="int">
  136. </argument>
  137. <argument index="1" name="disabled" type="bool">
  138. </argument>
  139. <description>
  140. If [code]disabled[/code] is [code]false[/code], hides the tab at index [code]tab_idx[/code].
  141. [b]Note:[/b] Its title text will remain unless it is also removed with [method set_tab_title].
  142. </description>
  143. </method>
  144. <method name="set_tab_icon">
  145. <return type="void">
  146. </return>
  147. <argument index="0" name="tab_idx" type="int">
  148. </argument>
  149. <argument index="1" name="icon" type="Texture">
  150. </argument>
  151. <description>
  152. Sets an [code]icon[/code] for the tab at index [code]tab_idx[/code].
  153. </description>
  154. </method>
  155. <method name="set_tab_title">
  156. <return type="void">
  157. </return>
  158. <argument index="0" name="tab_idx" type="int">
  159. </argument>
  160. <argument index="1" name="title" type="String">
  161. </argument>
  162. <description>
  163. Sets a [code]title[/code] for the tab at index [code]tab_idx[/code].
  164. </description>
  165. </method>
  166. <method name="set_tabs_rearrange_group">
  167. <return type="void">
  168. </return>
  169. <argument index="0" name="group_id" type="int">
  170. </argument>
  171. <description>
  172. Defines the rearrange group ID. Choose for each [Tabs] the same value to dragging tabs between [Tabs]. Enable drag with [code]set_drag_to_rearrange_enabled(true)[/code].
  173. </description>
  174. </method>
  175. </methods>
  176. <members>
  177. <member name="current_tab" type="int" setter="set_current_tab" getter="get_current_tab" default="0">
  178. Select tab at index [code]tab_idx[/code].
  179. </member>
  180. <member name="drag_to_rearrange_enabled" type="bool" setter="set_drag_to_rearrange_enabled" getter="get_drag_to_rearrange_enabled" default="false">
  181. If [code]true[/code], tabs can be rearranged with mouse drag.
  182. </member>
  183. <member name="scrolling_enabled" type="bool" setter="set_scrolling_enabled" getter="get_scrolling_enabled" default="true">
  184. if [code]true[/code], the mouse's scroll wheel cab be used to navigate the scroll view.
  185. </member>
  186. <member name="tab_align" type="int" setter="set_tab_align" getter="get_tab_align" enum="Tabs.TabAlign" default="1">
  187. The alignment of all tabs. See [enum TabAlign] for details.
  188. </member>
  189. <member name="tab_close_display_policy" type="int" setter="set_tab_close_display_policy" getter="get_tab_close_display_policy" enum="Tabs.CloseButtonDisplayPolicy" default="0">
  190. Sets when the close button will appear on the tabs. See [enum CloseButtonDisplayPolicy] for details.
  191. </member>
  192. </members>
  193. <signals>
  194. <signal name="reposition_active_tab_request">
  195. <argument index="0" name="idx_to" type="int">
  196. </argument>
  197. <description>
  198. Emitted when the active tab is rearranged via mouse drag. See [member drag_to_rearrange_enabled].
  199. </description>
  200. </signal>
  201. <signal name="right_button_pressed">
  202. <argument index="0" name="tab" type="int">
  203. </argument>
  204. <description>
  205. Emitted when a tab is right-clicked.
  206. </description>
  207. </signal>
  208. <signal name="tab_changed">
  209. <argument index="0" name="tab" type="int">
  210. </argument>
  211. <description>
  212. Emitted when switching to another tab.
  213. </description>
  214. </signal>
  215. <signal name="tab_clicked">
  216. <argument index="0" name="tab" type="int">
  217. </argument>
  218. <description>
  219. Emitted when a tab is clicked, even if it is the current tab.
  220. </description>
  221. </signal>
  222. <signal name="tab_close">
  223. <argument index="0" name="tab" type="int">
  224. </argument>
  225. <description>
  226. Emitted when a tab is closed.
  227. </description>
  228. </signal>
  229. <signal name="tab_hover">
  230. <argument index="0" name="tab" type="int">
  231. </argument>
  232. <description>
  233. Emitted when a tab is hovered by the mouse.
  234. </description>
  235. </signal>
  236. </signals>
  237. <constants>
  238. <constant name="ALIGN_LEFT" value="0" enum="TabAlign">
  239. Align the tabs to the left.
  240. </constant>
  241. <constant name="ALIGN_CENTER" value="1" enum="TabAlign">
  242. Align the tabs to the center.
  243. </constant>
  244. <constant name="ALIGN_RIGHT" value="2" enum="TabAlign">
  245. Align the tabs to the right.
  246. </constant>
  247. <constant name="ALIGN_MAX" value="3" enum="TabAlign">
  248. Represents the size of the [enum TabAlign] enum.
  249. </constant>
  250. <constant name="CLOSE_BUTTON_SHOW_NEVER" value="0" enum="CloseButtonDisplayPolicy">
  251. Never show the close buttons.
  252. </constant>
  253. <constant name="CLOSE_BUTTON_SHOW_ACTIVE_ONLY" value="1" enum="CloseButtonDisplayPolicy">
  254. Only show the close button on the currently active tab.
  255. </constant>
  256. <constant name="CLOSE_BUTTON_SHOW_ALWAYS" value="2" enum="CloseButtonDisplayPolicy">
  257. Show the close button on all tabs.
  258. </constant>
  259. <constant name="CLOSE_BUTTON_MAX" value="3" enum="CloseButtonDisplayPolicy">
  260. Represents the size of the [enum CloseButtonDisplayPolicy] enum.
  261. </constant>
  262. </constants>
  263. <theme_items>
  264. <theme_item name="button" type="StyleBox">
  265. </theme_item>
  266. <theme_item name="button_pressed" type="StyleBox">
  267. </theme_item>
  268. <theme_item name="close" type="Texture">
  269. </theme_item>
  270. <theme_item name="decrement" type="Texture">
  271. </theme_item>
  272. <theme_item name="decrement_highlight" type="Texture">
  273. </theme_item>
  274. <theme_item name="font" type="Font">
  275. </theme_item>
  276. <theme_item name="font_color_bg" type="Color" default="Color( 0.69, 0.69, 0.69, 1 )">
  277. </theme_item>
  278. <theme_item name="font_color_disabled" type="Color" default="Color( 0.9, 0.9, 0.9, 0.2 )">
  279. </theme_item>
  280. <theme_item name="font_color_fg" type="Color" default="Color( 0.94, 0.94, 0.94, 1 )">
  281. </theme_item>
  282. <theme_item name="hseparation" type="int" default="4">
  283. </theme_item>
  284. <theme_item name="increment" type="Texture">
  285. </theme_item>
  286. <theme_item name="increment_highlight" type="Texture">
  287. </theme_item>
  288. <theme_item name="label_valign_bg" type="int" default="2">
  289. </theme_item>
  290. <theme_item name="label_valign_fg" type="int" default="0">
  291. </theme_item>
  292. <theme_item name="panel" type="StyleBox">
  293. </theme_item>
  294. <theme_item name="tab_bg" type="StyleBox">
  295. </theme_item>
  296. <theme_item name="tab_disabled" type="StyleBox">
  297. </theme_item>
  298. <theme_item name="tab_fg" type="StyleBox">
  299. </theme_item>
  300. <theme_item name="top_margin" type="int" default="24">
  301. </theme_item>
  302. </theme_items>
  303. </class>