class_treeitem.rst 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the TreeItem.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_TreeItem:
  6. TreeItem
  7. ========
  8. **Inherits:** :ref:`Object<class_Object>`
  9. Control for a single item inside a :ref:`Tree<class_Tree>`.
  10. Description
  11. -----------
  12. Control for a single item inside a :ref:`Tree<class_Tree>`. May have child ``TreeItem``\ s and be styled as well as contain buttons.
  13. You can remove a ``TreeItem`` by using :ref:`Object.free<class_Object_method_free>`.
  14. Properties
  15. ----------
  16. +-------------------------+-----------------------------------------------------------------------------+
  17. | :ref:`bool<class_bool>` | :ref:`collapsed<class_TreeItem_property_collapsed>` |
  18. +-------------------------+-----------------------------------------------------------------------------+
  19. | :ref:`int<class_int>` | :ref:`custom_minimum_height<class_TreeItem_property_custom_minimum_height>` |
  20. +-------------------------+-----------------------------------------------------------------------------+
  21. | :ref:`bool<class_bool>` | :ref:`disable_folding<class_TreeItem_property_disable_folding>` |
  22. +-------------------------+-----------------------------------------------------------------------------+
  23. Methods
  24. -------
  25. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | void | :ref:`add_button<class_TreeItem_method_add_button>` **(** :ref:`int<class_int>` column, :ref:`Texture<class_Texture>` button, :ref:`int<class_int>` button_idx=-1, :ref:`bool<class_bool>` disabled=false, :ref:`String<class_String>` tooltip="" **)** |
  27. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`Variant<class_Variant>` | :ref:`call_recursive<class_TreeItem_method_call_recursive>` **(** :ref:`String<class_String>` method, ... **)** |vararg| |
  29. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`clear_custom_bg_color<class_TreeItem_method_clear_custom_bg_color>` **(** :ref:`int<class_int>` column **)** |
  31. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | void | :ref:`clear_custom_color<class_TreeItem_method_clear_custom_color>` **(** :ref:`int<class_int>` column **)** |
  33. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | void | :ref:`deselect<class_TreeItem_method_deselect>` **(** :ref:`int<class_int>` column **)** |
  35. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | void | :ref:`erase_button<class_TreeItem_method_erase_button>` **(** :ref:`int<class_int>` column, :ref:`int<class_int>` button_idx **)** |
  37. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`Texture<class_Texture>` | :ref:`get_button<class_TreeItem_method_get_button>` **(** :ref:`int<class_int>` column, :ref:`int<class_int>` button_idx **)** |const| |
  39. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`int<class_int>` | :ref:`get_button_count<class_TreeItem_method_get_button_count>` **(** :ref:`int<class_int>` column **)** |const| |
  41. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`String<class_String>` | :ref:`get_button_tooltip<class_TreeItem_method_get_button_tooltip>` **(** :ref:`int<class_int>` column, :ref:`int<class_int>` button_idx **)** |const| |
  43. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`TreeCellMode<enum_TreeItem_TreeCellMode>` | :ref:`get_cell_mode<class_TreeItem_method_get_cell_mode>` **(** :ref:`int<class_int>` column **)** |const| |
  45. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_children<class_TreeItem_method_get_children>` **(** **)** |
  47. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`Color<class_Color>` | :ref:`get_custom_bg_color<class_TreeItem_method_get_custom_bg_color>` **(** :ref:`int<class_int>` column **)** |const| |
  49. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`Color<class_Color>` | :ref:`get_custom_color<class_TreeItem_method_get_custom_color>` **(** :ref:`int<class_int>` column **)** |const| |
  51. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`bool<class_bool>` | :ref:`get_expand_right<class_TreeItem_method_get_expand_right>` **(** :ref:`int<class_int>` column **)** |const| |
  53. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`Texture<class_Texture>` | :ref:`get_icon<class_TreeItem_method_get_icon>` **(** :ref:`int<class_int>` column **)** |const| |
  55. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`int<class_int>` | :ref:`get_icon_max_width<class_TreeItem_method_get_icon_max_width>` **(** :ref:`int<class_int>` column **)** |const| |
  57. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`Color<class_Color>` | :ref:`get_icon_modulate<class_TreeItem_method_get_icon_modulate>` **(** :ref:`int<class_int>` column **)** |const| |
  59. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`Rect2<class_Rect2>` | :ref:`get_icon_region<class_TreeItem_method_get_icon_region>` **(** :ref:`int<class_int>` column **)** |const| |
  61. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`Variant<class_Variant>` | :ref:`get_metadata<class_TreeItem_method_get_metadata>` **(** :ref:`int<class_int>` column **)** |const| |
  63. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_next<class_TreeItem_method_get_next>` **(** **)** |
  65. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_next_visible<class_TreeItem_method_get_next_visible>` **(** :ref:`bool<class_bool>` wrap=false **)** |
  67. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_parent<class_TreeItem_method_get_parent>` **(** **)** |
  69. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_prev<class_TreeItem_method_get_prev>` **(** **)** |
  71. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_prev_visible<class_TreeItem_method_get_prev_visible>` **(** :ref:`bool<class_bool>` wrap=false **)** |
  73. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :ref:`float<class_float>` | :ref:`get_range<class_TreeItem_method_get_range>` **(** :ref:`int<class_int>` column **)** |const| |
  75. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_range_config<class_TreeItem_method_get_range_config>` **(** :ref:`int<class_int>` column **)** |
  77. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | :ref:`String<class_String>` | :ref:`get_suffix<class_TreeItem_method_get_suffix>` **(** :ref:`int<class_int>` column **)** |const| |
  79. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | :ref:`String<class_String>` | :ref:`get_text<class_TreeItem_method_get_text>` **(** :ref:`int<class_int>` column **)** |const| |
  81. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | :ref:`TextAlign<enum_TreeItem_TextAlign>` | :ref:`get_text_align<class_TreeItem_method_get_text_align>` **(** :ref:`int<class_int>` column **)** |const| |
  83. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | :ref:`String<class_String>` | :ref:`get_tooltip<class_TreeItem_method_get_tooltip>` **(** :ref:`int<class_int>` column **)** |const| |
  85. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | :ref:`bool<class_bool>` | :ref:`is_button_disabled<class_TreeItem_method_is_button_disabled>` **(** :ref:`int<class_int>` column, :ref:`int<class_int>` button_idx **)** |const| |
  87. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | :ref:`bool<class_bool>` | :ref:`is_checked<class_TreeItem_method_is_checked>` **(** :ref:`int<class_int>` column **)** |const| |
  89. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | :ref:`bool<class_bool>` | :ref:`is_custom_set_as_button<class_TreeItem_method_is_custom_set_as_button>` **(** :ref:`int<class_int>` column **)** |const| |
  91. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | :ref:`bool<class_bool>` | :ref:`is_editable<class_TreeItem_method_is_editable>` **(** :ref:`int<class_int>` column **)** |
  93. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | :ref:`bool<class_bool>` | :ref:`is_selectable<class_TreeItem_method_is_selectable>` **(** :ref:`int<class_int>` column **)** |const| |
  95. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | :ref:`bool<class_bool>` | :ref:`is_selected<class_TreeItem_method_is_selected>` **(** :ref:`int<class_int>` column **)** |
  97. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | void | :ref:`move_to_bottom<class_TreeItem_method_move_to_bottom>` **(** **)** |
  99. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | void | :ref:`move_to_top<class_TreeItem_method_move_to_top>` **(** **)** |
  101. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | void | :ref:`remove_child<class_TreeItem_method_remove_child>` **(** :ref:`Object<class_Object>` child **)** |
  103. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | void | :ref:`select<class_TreeItem_method_select>` **(** :ref:`int<class_int>` column **)** |
  105. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | void | :ref:`set_button<class_TreeItem_method_set_button>` **(** :ref:`int<class_int>` column, :ref:`int<class_int>` button_idx, :ref:`Texture<class_Texture>` button **)** |
  107. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. | void | :ref:`set_button_disabled<class_TreeItem_method_set_button_disabled>` **(** :ref:`int<class_int>` column, :ref:`int<class_int>` button_idx, :ref:`bool<class_bool>` disabled **)** |
  109. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. | void | :ref:`set_cell_mode<class_TreeItem_method_set_cell_mode>` **(** :ref:`int<class_int>` column, :ref:`TreeCellMode<enum_TreeItem_TreeCellMode>` mode **)** |
  111. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. | void | :ref:`set_checked<class_TreeItem_method_set_checked>` **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` checked **)** |
  113. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | void | :ref:`set_custom_as_button<class_TreeItem_method_set_custom_as_button>` **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` enable **)** |
  115. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | void | :ref:`set_custom_bg_color<class_TreeItem_method_set_custom_bg_color>` **(** :ref:`int<class_int>` column, :ref:`Color<class_Color>` color, :ref:`bool<class_bool>` just_outline=false **)** |
  117. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | void | :ref:`set_custom_color<class_TreeItem_method_set_custom_color>` **(** :ref:`int<class_int>` column, :ref:`Color<class_Color>` color **)** |
  119. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | void | :ref:`set_custom_draw<class_TreeItem_method_set_custom_draw>` **(** :ref:`int<class_int>` column, :ref:`Object<class_Object>` object, :ref:`String<class_String>` callback **)** |
  121. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. | void | :ref:`set_editable<class_TreeItem_method_set_editable>` **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` enabled **)** |
  123. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  124. | void | :ref:`set_expand_right<class_TreeItem_method_set_expand_right>` **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` enable **)** |
  125. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  126. | void | :ref:`set_icon<class_TreeItem_method_set_icon>` **(** :ref:`int<class_int>` column, :ref:`Texture<class_Texture>` texture **)** |
  127. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  128. | void | :ref:`set_icon_max_width<class_TreeItem_method_set_icon_max_width>` **(** :ref:`int<class_int>` column, :ref:`int<class_int>` width **)** |
  129. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  130. | void | :ref:`set_icon_modulate<class_TreeItem_method_set_icon_modulate>` **(** :ref:`int<class_int>` column, :ref:`Color<class_Color>` modulate **)** |
  131. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  132. | void | :ref:`set_icon_region<class_TreeItem_method_set_icon_region>` **(** :ref:`int<class_int>` column, :ref:`Rect2<class_Rect2>` region **)** |
  133. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  134. | void | :ref:`set_metadata<class_TreeItem_method_set_metadata>` **(** :ref:`int<class_int>` column, :ref:`Variant<class_Variant>` meta **)** |
  135. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  136. | void | :ref:`set_range<class_TreeItem_method_set_range>` **(** :ref:`int<class_int>` column, :ref:`float<class_float>` value **)** |
  137. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  138. | void | :ref:`set_range_config<class_TreeItem_method_set_range_config>` **(** :ref:`int<class_int>` column, :ref:`float<class_float>` min, :ref:`float<class_float>` max, :ref:`float<class_float>` step, :ref:`bool<class_bool>` expr=false **)** |
  139. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  140. | void | :ref:`set_selectable<class_TreeItem_method_set_selectable>` **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` selectable **)** |
  141. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  142. | void | :ref:`set_suffix<class_TreeItem_method_set_suffix>` **(** :ref:`int<class_int>` column, :ref:`String<class_String>` text **)** |
  143. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  144. | void | :ref:`set_text<class_TreeItem_method_set_text>` **(** :ref:`int<class_int>` column, :ref:`String<class_String>` text **)** |
  145. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  146. | void | :ref:`set_text_align<class_TreeItem_method_set_text_align>` **(** :ref:`int<class_int>` column, :ref:`TextAlign<enum_TreeItem_TextAlign>` text_align **)** |
  147. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  148. | void | :ref:`set_tooltip<class_TreeItem_method_set_tooltip>` **(** :ref:`int<class_int>` column, :ref:`String<class_String>` tooltip **)** |
  149. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  150. Enumerations
  151. ------------
  152. .. _enum_TreeItem_TreeCellMode:
  153. .. _class_TreeItem_constant_CELL_MODE_STRING:
  154. .. _class_TreeItem_constant_CELL_MODE_CHECK:
  155. .. _class_TreeItem_constant_CELL_MODE_RANGE:
  156. .. _class_TreeItem_constant_CELL_MODE_ICON:
  157. .. _class_TreeItem_constant_CELL_MODE_CUSTOM:
  158. enum **TreeCellMode**:
  159. - **CELL_MODE_STRING** = **0** --- Cell contains a string.
  160. - **CELL_MODE_CHECK** = **1** --- Cell can be checked.
  161. - **CELL_MODE_RANGE** = **2** --- Cell contains a range.
  162. - **CELL_MODE_ICON** = **3** --- Cell contains an icon.
  163. - **CELL_MODE_CUSTOM** = **4**
  164. ----
  165. .. _enum_TreeItem_TextAlign:
  166. .. _class_TreeItem_constant_ALIGN_LEFT:
  167. .. _class_TreeItem_constant_ALIGN_CENTER:
  168. .. _class_TreeItem_constant_ALIGN_RIGHT:
  169. enum **TextAlign**:
  170. - **ALIGN_LEFT** = **0** --- Align text to the left. See ``set_text_align()``.
  171. - **ALIGN_CENTER** = **1** --- Center text. See ``set_text_align()``.
  172. - **ALIGN_RIGHT** = **2** --- Align text to the right. See ``set_text_align()``.
  173. Property Descriptions
  174. ---------------------
  175. .. _class_TreeItem_property_collapsed:
  176. - :ref:`bool<class_bool>` **collapsed**
  177. +----------+----------------------+
  178. | *Setter* | set_collapsed(value) |
  179. +----------+----------------------+
  180. | *Getter* | is_collapsed() |
  181. +----------+----------------------+
  182. If ``true``, the TreeItem is collapsed.
  183. ----
  184. .. _class_TreeItem_property_custom_minimum_height:
  185. - :ref:`int<class_int>` **custom_minimum_height**
  186. +----------+----------------------------------+
  187. | *Setter* | set_custom_minimum_height(value) |
  188. +----------+----------------------------------+
  189. | *Getter* | get_custom_minimum_height() |
  190. +----------+----------------------------------+
  191. The custom minimum height.
  192. ----
  193. .. _class_TreeItem_property_disable_folding:
  194. - :ref:`bool<class_bool>` **disable_folding**
  195. +----------+----------------------------+
  196. | *Setter* | set_disable_folding(value) |
  197. +----------+----------------------------+
  198. | *Getter* | is_folding_disabled() |
  199. +----------+----------------------------+
  200. If ``true``, folding is disabled for this TreeItem.
  201. Method Descriptions
  202. -------------------
  203. .. _class_TreeItem_method_add_button:
  204. - void **add_button** **(** :ref:`int<class_int>` column, :ref:`Texture<class_Texture>` button, :ref:`int<class_int>` button_idx=-1, :ref:`bool<class_bool>` disabled=false, :ref:`String<class_String>` tooltip="" **)**
  205. Adds a button with :ref:`Texture<class_Texture>` ``button`` at column ``column``. The ``button_idx`` index is used to identify the button when calling other methods. If not specified, the next available index is used, which may be retrieved by calling :ref:`get_button_count<class_TreeItem_method_get_button_count>` immediately after this method. Optionally, the button can be ``disabled`` and have a ``tooltip``.
  206. ----
  207. .. _class_TreeItem_method_call_recursive:
  208. - :ref:`Variant<class_Variant>` **call_recursive** **(** :ref:`String<class_String>` method, ... **)** |vararg|
  209. Calls the ``method`` on the actual TreeItem and its children recursively. Pass parameters as a comma separated list.
  210. ----
  211. .. _class_TreeItem_method_clear_custom_bg_color:
  212. - void **clear_custom_bg_color** **(** :ref:`int<class_int>` column **)**
  213. Resets the background color for the given column to default.
  214. ----
  215. .. _class_TreeItem_method_clear_custom_color:
  216. - void **clear_custom_color** **(** :ref:`int<class_int>` column **)**
  217. Resets the color for the given column to default.
  218. ----
  219. .. _class_TreeItem_method_deselect:
  220. - void **deselect** **(** :ref:`int<class_int>` column **)**
  221. Deselects the given column.
  222. ----
  223. .. _class_TreeItem_method_erase_button:
  224. - void **erase_button** **(** :ref:`int<class_int>` column, :ref:`int<class_int>` button_idx **)**
  225. Removes the button at index ``button_idx`` in column ``column``.
  226. ----
  227. .. _class_TreeItem_method_get_button:
  228. - :ref:`Texture<class_Texture>` **get_button** **(** :ref:`int<class_int>` column, :ref:`int<class_int>` button_idx **)** |const|
  229. Returns the :ref:`Texture<class_Texture>` of the button at index ``button_idx`` in column ``column``.
  230. ----
  231. .. _class_TreeItem_method_get_button_count:
  232. - :ref:`int<class_int>` **get_button_count** **(** :ref:`int<class_int>` column **)** |const|
  233. Returns the number of buttons in column ``column``. May be used to get the most recently added button's index, if no index was specified.
  234. ----
  235. .. _class_TreeItem_method_get_button_tooltip:
  236. - :ref:`String<class_String>` **get_button_tooltip** **(** :ref:`int<class_int>` column, :ref:`int<class_int>` button_idx **)** |const|
  237. Returns the tooltip string for the button at index ``button_idx`` in column ``column``.
  238. ----
  239. .. _class_TreeItem_method_get_cell_mode:
  240. - :ref:`TreeCellMode<enum_TreeItem_TreeCellMode>` **get_cell_mode** **(** :ref:`int<class_int>` column **)** |const|
  241. Returns the column's cell mode.
  242. ----
  243. .. _class_TreeItem_method_get_children:
  244. - :ref:`TreeItem<class_TreeItem>` **get_children** **(** **)**
  245. Returns the TreeItem's first child item or a null object if there is none.
  246. ----
  247. .. _class_TreeItem_method_get_custom_bg_color:
  248. - :ref:`Color<class_Color>` **get_custom_bg_color** **(** :ref:`int<class_int>` column **)** |const|
  249. Returns the custom background color of column ``column``.
  250. ----
  251. .. _class_TreeItem_method_get_custom_color:
  252. - :ref:`Color<class_Color>` **get_custom_color** **(** :ref:`int<class_int>` column **)** |const|
  253. Returns the custom color of column ``column``.
  254. ----
  255. .. _class_TreeItem_method_get_expand_right:
  256. - :ref:`bool<class_bool>` **get_expand_right** **(** :ref:`int<class_int>` column **)** |const|
  257. Returns ``true`` if ``expand_right`` is set.
  258. ----
  259. .. _class_TreeItem_method_get_icon:
  260. - :ref:`Texture<class_Texture>` **get_icon** **(** :ref:`int<class_int>` column **)** |const|
  261. Returns the given column's icon :ref:`Texture<class_Texture>`. Error if no icon is set.
  262. ----
  263. .. _class_TreeItem_method_get_icon_max_width:
  264. - :ref:`int<class_int>` **get_icon_max_width** **(** :ref:`int<class_int>` column **)** |const|
  265. Returns the column's icon's maximum width.
  266. ----
  267. .. _class_TreeItem_method_get_icon_modulate:
  268. - :ref:`Color<class_Color>` **get_icon_modulate** **(** :ref:`int<class_int>` column **)** |const|
  269. Returns the :ref:`Color<class_Color>` modulating the column's icon.
  270. ----
  271. .. _class_TreeItem_method_get_icon_region:
  272. - :ref:`Rect2<class_Rect2>` **get_icon_region** **(** :ref:`int<class_int>` column **)** |const|
  273. Returns the icon :ref:`Texture<class_Texture>` region as :ref:`Rect2<class_Rect2>`.
  274. ----
  275. .. _class_TreeItem_method_get_metadata:
  276. - :ref:`Variant<class_Variant>` **get_metadata** **(** :ref:`int<class_int>` column **)** |const|
  277. ----
  278. .. _class_TreeItem_method_get_next:
  279. - :ref:`TreeItem<class_TreeItem>` **get_next** **(** **)**
  280. Returns the next TreeItem in the tree or a null object if there is none.
  281. ----
  282. .. _class_TreeItem_method_get_next_visible:
  283. - :ref:`TreeItem<class_TreeItem>` **get_next_visible** **(** :ref:`bool<class_bool>` wrap=false **)**
  284. Returns the next visible TreeItem in the tree or a null object if there is none.
  285. If ``wrap`` is enabled, the method will wrap around to the first visible element in the tree when called on the last visible element, otherwise it returns ``null``.
  286. ----
  287. .. _class_TreeItem_method_get_parent:
  288. - :ref:`TreeItem<class_TreeItem>` **get_parent** **(** **)**
  289. Returns the parent TreeItem or a null object if there is none.
  290. ----
  291. .. _class_TreeItem_method_get_prev:
  292. - :ref:`TreeItem<class_TreeItem>` **get_prev** **(** **)**
  293. Returns the previous TreeItem in the tree or a null object if there is none.
  294. ----
  295. .. _class_TreeItem_method_get_prev_visible:
  296. - :ref:`TreeItem<class_TreeItem>` **get_prev_visible** **(** :ref:`bool<class_bool>` wrap=false **)**
  297. Returns the previous visible TreeItem in the tree or a null object if there is none.
  298. If ``wrap`` is enabled, the method will wrap around to the last visible element in the tree when called on the first visible element, otherwise it returns ``null``.
  299. ----
  300. .. _class_TreeItem_method_get_range:
  301. - :ref:`float<class_float>` **get_range** **(** :ref:`int<class_int>` column **)** |const|
  302. ----
  303. .. _class_TreeItem_method_get_range_config:
  304. - :ref:`Dictionary<class_Dictionary>` **get_range_config** **(** :ref:`int<class_int>` column **)**
  305. ----
  306. .. _class_TreeItem_method_get_suffix:
  307. - :ref:`String<class_String>` **get_suffix** **(** :ref:`int<class_int>` column **)** |const|
  308. ----
  309. .. _class_TreeItem_method_get_text:
  310. - :ref:`String<class_String>` **get_text** **(** :ref:`int<class_int>` column **)** |const|
  311. Returns the given column's text.
  312. ----
  313. .. _class_TreeItem_method_get_text_align:
  314. - :ref:`TextAlign<enum_TreeItem_TextAlign>` **get_text_align** **(** :ref:`int<class_int>` column **)** |const|
  315. Returns the given column's text alignment.
  316. ----
  317. .. _class_TreeItem_method_get_tooltip:
  318. - :ref:`String<class_String>` **get_tooltip** **(** :ref:`int<class_int>` column **)** |const|
  319. Returns the given column's tooltip.
  320. ----
  321. .. _class_TreeItem_method_is_button_disabled:
  322. - :ref:`bool<class_bool>` **is_button_disabled** **(** :ref:`int<class_int>` column, :ref:`int<class_int>` button_idx **)** |const|
  323. Returns ``true`` if the button at index ``button_idx`` for the given column is disabled.
  324. ----
  325. .. _class_TreeItem_method_is_checked:
  326. - :ref:`bool<class_bool>` **is_checked** **(** :ref:`int<class_int>` column **)** |const|
  327. Returns ``true`` if the given column is checked.
  328. ----
  329. .. _class_TreeItem_method_is_custom_set_as_button:
  330. - :ref:`bool<class_bool>` **is_custom_set_as_button** **(** :ref:`int<class_int>` column **)** |const|
  331. ----
  332. .. _class_TreeItem_method_is_editable:
  333. - :ref:`bool<class_bool>` **is_editable** **(** :ref:`int<class_int>` column **)**
  334. Returns ``true`` if column ``column`` is editable.
  335. ----
  336. .. _class_TreeItem_method_is_selectable:
  337. - :ref:`bool<class_bool>` **is_selectable** **(** :ref:`int<class_int>` column **)** |const|
  338. Returns ``true`` if column ``column`` is selectable.
  339. ----
  340. .. _class_TreeItem_method_is_selected:
  341. - :ref:`bool<class_bool>` **is_selected** **(** :ref:`int<class_int>` column **)**
  342. Returns ``true`` if column ``column`` is selected.
  343. ----
  344. .. _class_TreeItem_method_move_to_bottom:
  345. - void **move_to_bottom** **(** **)**
  346. Moves this TreeItem to the bottom in the :ref:`Tree<class_Tree>` hierarchy.
  347. ----
  348. .. _class_TreeItem_method_move_to_top:
  349. - void **move_to_top** **(** **)**
  350. Moves this TreeItem to the top in the :ref:`Tree<class_Tree>` hierarchy.
  351. ----
  352. .. _class_TreeItem_method_remove_child:
  353. - void **remove_child** **(** :ref:`Object<class_Object>` child **)**
  354. Removes the given child ``TreeItem`` and all its children from the :ref:`Tree<class_Tree>`. Note that it doesn't free the item from memory, so it can be reused later. To completely remove a ``TreeItem`` use :ref:`Object.free<class_Object_method_free>`.
  355. ----
  356. .. _class_TreeItem_method_select:
  357. - void **select** **(** :ref:`int<class_int>` column **)**
  358. Selects the column ``column``.
  359. ----
  360. .. _class_TreeItem_method_set_button:
  361. - void **set_button** **(** :ref:`int<class_int>` column, :ref:`int<class_int>` button_idx, :ref:`Texture<class_Texture>` button **)**
  362. Sets the given column's button :ref:`Texture<class_Texture>` at index ``button_idx`` to ``button``.
  363. ----
  364. .. _class_TreeItem_method_set_button_disabled:
  365. - void **set_button_disabled** **(** :ref:`int<class_int>` column, :ref:`int<class_int>` button_idx, :ref:`bool<class_bool>` disabled **)**
  366. If ``true``, disables the button at index ``button_idx`` in column ``column``.
  367. ----
  368. .. _class_TreeItem_method_set_cell_mode:
  369. - void **set_cell_mode** **(** :ref:`int<class_int>` column, :ref:`TreeCellMode<enum_TreeItem_TreeCellMode>` mode **)**
  370. Sets the given column's cell mode to ``mode``. See :ref:`TreeCellMode<enum_TreeItem_TreeCellMode>` constants.
  371. ----
  372. .. _class_TreeItem_method_set_checked:
  373. - void **set_checked** **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` checked **)**
  374. If ``true``, the column ``column`` is checked.
  375. ----
  376. .. _class_TreeItem_method_set_custom_as_button:
  377. - void **set_custom_as_button** **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` enable **)**
  378. ----
  379. .. _class_TreeItem_method_set_custom_bg_color:
  380. - void **set_custom_bg_color** **(** :ref:`int<class_int>` column, :ref:`Color<class_Color>` color, :ref:`bool<class_bool>` just_outline=false **)**
  381. Sets the given column's custom background color and whether to just use it as an outline.
  382. ----
  383. .. _class_TreeItem_method_set_custom_color:
  384. - void **set_custom_color** **(** :ref:`int<class_int>` column, :ref:`Color<class_Color>` color **)**
  385. Sets the given column's custom color.
  386. ----
  387. .. _class_TreeItem_method_set_custom_draw:
  388. - void **set_custom_draw** **(** :ref:`int<class_int>` column, :ref:`Object<class_Object>` object, :ref:`String<class_String>` callback **)**
  389. Sets the given column's custom draw callback to ``callback`` method on ``object``.
  390. The ``callback`` should accept two arguments: the ``TreeItem`` that is drawn and its position and size as a :ref:`Rect2<class_Rect2>`.
  391. ----
  392. .. _class_TreeItem_method_set_editable:
  393. - void **set_editable** **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` enabled **)**
  394. If ``true``, column ``column`` is editable.
  395. ----
  396. .. _class_TreeItem_method_set_expand_right:
  397. - void **set_expand_right** **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` enable **)**
  398. If ``true``, column ``column`` is expanded to the right.
  399. ----
  400. .. _class_TreeItem_method_set_icon:
  401. - void **set_icon** **(** :ref:`int<class_int>` column, :ref:`Texture<class_Texture>` texture **)**
  402. Sets the given column's icon :ref:`Texture<class_Texture>`.
  403. ----
  404. .. _class_TreeItem_method_set_icon_max_width:
  405. - void **set_icon_max_width** **(** :ref:`int<class_int>` column, :ref:`int<class_int>` width **)**
  406. Sets the given column's icon's maximum width.
  407. ----
  408. .. _class_TreeItem_method_set_icon_modulate:
  409. - void **set_icon_modulate** **(** :ref:`int<class_int>` column, :ref:`Color<class_Color>` modulate **)**
  410. Modulates the given column's icon with ``modulate``.
  411. ----
  412. .. _class_TreeItem_method_set_icon_region:
  413. - void **set_icon_region** **(** :ref:`int<class_int>` column, :ref:`Rect2<class_Rect2>` region **)**
  414. Sets the given column's icon's texture region.
  415. ----
  416. .. _class_TreeItem_method_set_metadata:
  417. - void **set_metadata** **(** :ref:`int<class_int>` column, :ref:`Variant<class_Variant>` meta **)**
  418. ----
  419. .. _class_TreeItem_method_set_range:
  420. - void **set_range** **(** :ref:`int<class_int>` column, :ref:`float<class_float>` value **)**
  421. ----
  422. .. _class_TreeItem_method_set_range_config:
  423. - void **set_range_config** **(** :ref:`int<class_int>` column, :ref:`float<class_float>` min, :ref:`float<class_float>` max, :ref:`float<class_float>` step, :ref:`bool<class_bool>` expr=false **)**
  424. ----
  425. .. _class_TreeItem_method_set_selectable:
  426. - void **set_selectable** **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` selectable **)**
  427. If ``true``, the given column is selectable.
  428. ----
  429. .. _class_TreeItem_method_set_suffix:
  430. - void **set_suffix** **(** :ref:`int<class_int>` column, :ref:`String<class_String>` text **)**
  431. ----
  432. .. _class_TreeItem_method_set_text:
  433. - void **set_text** **(** :ref:`int<class_int>` column, :ref:`String<class_String>` text **)**
  434. ----
  435. .. _class_TreeItem_method_set_text_align:
  436. - void **set_text_align** **(** :ref:`int<class_int>` column, :ref:`TextAlign<enum_TreeItem_TextAlign>` text_align **)**
  437. Sets the given column's text alignment. See :ref:`TextAlign<enum_TreeItem_TextAlign>` for possible values.
  438. ----
  439. .. _class_TreeItem_method_set_tooltip:
  440. - void **set_tooltip** **(** :ref:`int<class_int>` column, :ref:`String<class_String>` tooltip **)**
  441. Sets the given column's tooltip text.
  442. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  443. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  444. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`