TabContainer.xml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="TabContainer" inherits="Container" category="Core" version="3.1">
  3. <brief_description>
  4. Tabbed Container.
  5. </brief_description>
  6. <description>
  7. Sets the active tab's [code]visible[/code] property to the value [code]true[/code]. Sets all other children's to [code]false[/code].
  8. Ignores non-[Control] children.
  9. Individual tabs are always visible unless you use [method set_tab_disabled] and [method set_tab_title] to hide it.
  10. To hide only a tab's content, nest the content inside a child [Control], so it receives the [code]TabContainer[/code]'s visibility setting instead.
  11. </description>
  12. <tutorials>
  13. </tutorials>
  14. <demos>
  15. </demos>
  16. <methods>
  17. <method name="get_current_tab_control" qualifiers="const">
  18. <return type="Control">
  19. </return>
  20. <description>
  21. Returns the child [Control] node located at the active tab index.
  22. </description>
  23. </method>
  24. <method name="get_popup" qualifiers="const">
  25. <return type="Popup">
  26. </return>
  27. <description>
  28. Returns the [Popup] node instance if one has been set already with [method set_popup].
  29. </description>
  30. </method>
  31. <method name="get_previous_tab" qualifiers="const">
  32. <return type="int">
  33. </return>
  34. <description>
  35. Returns the previously active tab index.
  36. </description>
  37. </method>
  38. <method name="get_tab_control" qualifiers="const">
  39. <return type="Control">
  40. </return>
  41. <argument index="0" name="idx" type="int">
  42. </argument>
  43. <description>
  44. Returns the currently visible tab's [Control] node.
  45. </description>
  46. </method>
  47. <method name="get_tab_count" qualifiers="const">
  48. <return type="int">
  49. </return>
  50. <description>
  51. Returns the number of tabs.
  52. </description>
  53. </method>
  54. <method name="get_tab_disabled" qualifiers="const">
  55. <return type="bool">
  56. </return>
  57. <argument index="0" name="tab_idx" type="int">
  58. </argument>
  59. <description>
  60. Returns [code]true[/code] if the tab at index [code]tab_idx[/code] is disabled.
  61. </description>
  62. </method>
  63. <method name="get_tab_icon" qualifiers="const">
  64. <return type="Texture">
  65. </return>
  66. <argument index="0" name="tab_idx" type="int">
  67. </argument>
  68. <description>
  69. Returns the [Texture] for the tab at index [code]tab_idx[/code] or null if the tab has no [Texture].
  70. </description>
  71. </method>
  72. <method name="get_tab_title" qualifiers="const">
  73. <return type="String">
  74. </return>
  75. <argument index="0" name="tab_idx" type="int">
  76. </argument>
  77. <description>
  78. 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].
  79. </description>
  80. </method>
  81. <method name="get_tabs_rearrange_group" qualifiers="const">
  82. <return type="int">
  83. </return>
  84. <description>
  85. Returns the [code]TabContainer[/code] rearrange group id.
  86. </description>
  87. </method>
  88. <method name="set_popup">
  89. <return type="void">
  90. </return>
  91. <argument index="0" name="popup" type="Node">
  92. </argument>
  93. <description>
  94. If set on a [Popup] node instance, a popup menu icon appears in the top-right corner of the [code]TabContainer[/code]. Clicking it will expand the [Popup] node.
  95. </description>
  96. </method>
  97. <method name="set_tab_disabled">
  98. <return type="void">
  99. </return>
  100. <argument index="0" name="tab_idx" type="int">
  101. </argument>
  102. <argument index="1" name="disabled" type="bool">
  103. </argument>
  104. <description>
  105. If [code]disabled[/code] is false, hides the tab at index [code]tab_idx[/code]. Note that its title text will remain, unless also removed with [method set_tab_title].
  106. </description>
  107. </method>
  108. <method name="set_tab_icon">
  109. <return type="void">
  110. </return>
  111. <argument index="0" name="tab_idx" type="int">
  112. </argument>
  113. <argument index="1" name="icon" type="Texture">
  114. </argument>
  115. <description>
  116. Sets an icon for the tab at index [code]tab_idx[/code].
  117. </description>
  118. </method>
  119. <method name="set_tab_title">
  120. <return type="void">
  121. </return>
  122. <argument index="0" name="tab_idx" type="int">
  123. </argument>
  124. <argument index="1" name="title" type="String">
  125. </argument>
  126. <description>
  127. Sets a title for 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].
  128. </description>
  129. </method>
  130. <method name="set_tabs_rearrange_group">
  131. <return type="void">
  132. </return>
  133. <argument index="0" name="group_id" type="int">
  134. </argument>
  135. <description>
  136. Defines rearrange group id, choose for each [code]TabContainer[/code] the same value to enable tab drag between [code]TabContainer[/code]. Enable drag with [code]set_drag_to_rearrange_enabled(true)[/code].
  137. </description>
  138. </method>
  139. </methods>
  140. <members>
  141. <member name="current_tab" type="int" setter="set_current_tab" getter="get_current_tab">
  142. The current tab index. When set, this index's [Control] node's [code]visible[/code] property is set to [code]true[/code] and all others are set to [code]false[/code].
  143. </member>
  144. <member name="drag_to_rearrange_enabled" type="bool" setter="set_drag_to_rearrange_enabled" getter="get_drag_to_rearrange_enabled">
  145. If [code]true[/code], tabs can be rearranged with mouse drag.
  146. </member>
  147. <member name="tab_align" type="int" setter="set_tab_align" getter="get_tab_align" enum="TabContainer.TabAlign">
  148. The alignment of all tabs in the tab container. See the [code]ALIGN_*[/code] constants for details.
  149. </member>
  150. <member name="tabs_visible" type="bool" setter="set_tabs_visible" getter="are_tabs_visible">
  151. If [code]true[/code], tabs are visible. If [code]false[/code], tabs' content and titles are hidden. Default value: [code]true[/code].
  152. </member>
  153. </members>
  154. <signals>
  155. <signal name="pre_popup_pressed">
  156. <description>
  157. Emitted when the [code]TabContainer[/code]'s [Popup] button is clicked. See [method set_popup] for details.
  158. </description>
  159. </signal>
  160. <signal name="tab_changed">
  161. <argument index="0" name="tab" type="int">
  162. </argument>
  163. <description>
  164. Emitted when switching to another tab.
  165. </description>
  166. </signal>
  167. <signal name="tab_selected">
  168. <argument index="0" name="tab" type="int">
  169. </argument>
  170. <description>
  171. Emitted when a tab is selected, even if it is the current tab.
  172. </description>
  173. </signal>
  174. </signals>
  175. <constants>
  176. <constant name="ALIGN_LEFT" value="0" enum="TabAlign">
  177. Align the tabs to the left.
  178. </constant>
  179. <constant name="ALIGN_CENTER" value="1" enum="TabAlign">
  180. Align the tabs to the center.
  181. </constant>
  182. <constant name="ALIGN_RIGHT" value="2" enum="TabAlign">
  183. Align the tabs to the right.
  184. </constant>
  185. </constants>
  186. <theme_items>
  187. <theme_item name="decrement" type="Texture">
  188. </theme_item>
  189. <theme_item name="decrement_highlight" type="Texture">
  190. </theme_item>
  191. <theme_item name="font" type="Font">
  192. </theme_item>
  193. <theme_item name="font_color_bg" type="Color">
  194. </theme_item>
  195. <theme_item name="font_color_disabled" type="Color">
  196. </theme_item>
  197. <theme_item name="font_color_fg" type="Color">
  198. </theme_item>
  199. <theme_item name="hseparation" type="int">
  200. </theme_item>
  201. <theme_item name="increment" type="Texture">
  202. </theme_item>
  203. <theme_item name="increment_highlight" type="Texture">
  204. </theme_item>
  205. <theme_item name="label_valign_bg" type="int">
  206. </theme_item>
  207. <theme_item name="label_valign_fg" type="int">
  208. </theme_item>
  209. <theme_item name="menu" type="Texture">
  210. </theme_item>
  211. <theme_item name="menu_highlight" type="Texture">
  212. </theme_item>
  213. <theme_item name="panel" type="StyleBox">
  214. </theme_item>
  215. <theme_item name="side_margin" type="int">
  216. </theme_item>
  217. <theme_item name="tab_bg" type="StyleBox">
  218. </theme_item>
  219. <theme_item name="tab_fg" type="StyleBox">
  220. </theme_item>
  221. <theme_item name="top_margin" type="int">
  222. </theme_item>
  223. </theme_items>
  224. </class>