class_treeitem.rst 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  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. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Control for a single item inside a :ref:`Tree<class_Tree>`.
  13. Properties
  14. ----------
  15. +-------------------------+-----------------------------------------------------------------------------+
  16. | :ref:`bool<class_bool>` | :ref:`collapsed<class_TreeItem_property_collapsed>` |
  17. +-------------------------+-----------------------------------------------------------------------------+
  18. | :ref:`int<class_int>` | :ref:`custom_minimum_height<class_TreeItem_property_custom_minimum_height>` |
  19. +-------------------------+-----------------------------------------------------------------------------+
  20. | :ref:`bool<class_bool>` | :ref:`disable_folding<class_TreeItem_property_disable_folding>` |
  21. +-------------------------+-----------------------------------------------------------------------------+
  22. Methods
  23. -------
  24. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | 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="" **)** |
  26. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`clear_custom_bg_color<class_TreeItem_method_clear_custom_bg_color>` **(** :ref:`int<class_int>` column **)** |
  28. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | void | :ref:`clear_custom_color<class_TreeItem_method_clear_custom_color>` **(** :ref:`int<class_int>` column **)** |
  30. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | void | :ref:`deselect<class_TreeItem_method_deselect>` **(** :ref:`int<class_int>` column **)** |
  32. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`erase_button<class_TreeItem_method_erase_button>` **(** :ref:`int<class_int>` column, :ref:`int<class_int>` button_idx **)** |
  34. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`Texture<class_Texture>` | :ref:`get_button<class_TreeItem_method_get_button>` **(** :ref:`int<class_int>` column, :ref:`int<class_int>` button_idx **)** const |
  36. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`int<class_int>` | :ref:`get_button_count<class_TreeItem_method_get_button_count>` **(** :ref:`int<class_int>` column **)** const |
  38. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`TreeCellMode<enum_TreeItem_TreeCellMode>` | :ref:`get_cell_mode<class_TreeItem_method_get_cell_mode>` **(** :ref:`int<class_int>` column **)** const |
  40. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_children<class_TreeItem_method_get_children>` **(** **)** |
  42. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`Color<class_Color>` | :ref:`get_custom_bg_color<class_TreeItem_method_get_custom_bg_color>` **(** :ref:`int<class_int>` column **)** const |
  44. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`bool<class_bool>` | :ref:`get_expand_right<class_TreeItem_method_get_expand_right>` **(** :ref:`int<class_int>` column **)** const |
  46. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`Texture<class_Texture>` | :ref:`get_icon<class_TreeItem_method_get_icon>` **(** :ref:`int<class_int>` column **)** const |
  48. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`int<class_int>` | :ref:`get_icon_max_width<class_TreeItem_method_get_icon_max_width>` **(** :ref:`int<class_int>` column **)** const |
  50. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`Rect2<class_Rect2>` | :ref:`get_icon_region<class_TreeItem_method_get_icon_region>` **(** :ref:`int<class_int>` column **)** const |
  52. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`Variant<class_Variant>` | :ref:`get_metadata<class_TreeItem_method_get_metadata>` **(** :ref:`int<class_int>` column **)** const |
  54. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_next<class_TreeItem_method_get_next>` **(** **)** |
  56. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_next_visible<class_TreeItem_method_get_next_visible>` **(** **)** |
  58. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_parent<class_TreeItem_method_get_parent>` **(** **)** |
  60. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_prev<class_TreeItem_method_get_prev>` **(** **)** |
  62. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_prev_visible<class_TreeItem_method_get_prev_visible>` **(** **)** |
  64. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | :ref:`float<class_float>` | :ref:`get_range<class_TreeItem_method_get_range>` **(** :ref:`int<class_int>` column **)** const |
  66. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | :ref:`Dictionary<class_Dictionary>` | :ref:`get_range_config<class_TreeItem_method_get_range_config>` **(** :ref:`int<class_int>` column **)** |
  68. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | :ref:`String<class_String>` | :ref:`get_text<class_TreeItem_method_get_text>` **(** :ref:`int<class_int>` column **)** const |
  70. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | :ref:`TextAlign<enum_TreeItem_TextAlign>` | :ref:`get_text_align<class_TreeItem_method_get_text_align>` **(** :ref:`int<class_int>` column **)** const |
  72. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | :ref:`String<class_String>` | :ref:`get_tooltip<class_TreeItem_method_get_tooltip>` **(** :ref:`int<class_int>` column **)** const |
  74. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | :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 |
  76. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | :ref:`bool<class_bool>` | :ref:`is_checked<class_TreeItem_method_is_checked>` **(** :ref:`int<class_int>` column **)** const |
  78. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | :ref:`bool<class_bool>` | :ref:`is_custom_set_as_button<class_TreeItem_method_is_custom_set_as_button>` **(** :ref:`int<class_int>` column **)** const |
  80. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | :ref:`bool<class_bool>` | :ref:`is_editable<class_TreeItem_method_is_editable>` **(** :ref:`int<class_int>` column **)** |
  82. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | :ref:`bool<class_bool>` | :ref:`is_selectable<class_TreeItem_method_is_selectable>` **(** :ref:`int<class_int>` column **)** const |
  84. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | :ref:`bool<class_bool>` | :ref:`is_selected<class_TreeItem_method_is_selected>` **(** :ref:`int<class_int>` column **)** |
  86. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | void | :ref:`move_to_bottom<class_TreeItem_method_move_to_bottom>` **(** **)** |
  88. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | void | :ref:`move_to_top<class_TreeItem_method_move_to_top>` **(** **)** |
  90. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | void | :ref:`remove_child<class_TreeItem_method_remove_child>` **(** :ref:`Object<class_Object>` child **)** |
  92. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | void | :ref:`select<class_TreeItem_method_select>` **(** :ref:`int<class_int>` column **)** |
  94. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | 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 **)** |
  96. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | void | :ref:`set_cell_mode<class_TreeItem_method_set_cell_mode>` **(** :ref:`int<class_int>` column, :ref:`TreeCellMode<enum_TreeItem_TreeCellMode>` mode **)** |
  98. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | void | :ref:`set_checked<class_TreeItem_method_set_checked>` **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` checked **)** |
  100. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | void | :ref:`set_custom_as_button<class_TreeItem_method_set_custom_as_button>` **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` enable **)** |
  102. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | 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 **)** |
  104. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | void | :ref:`set_custom_color<class_TreeItem_method_set_custom_color>` **(** :ref:`int<class_int>` column, :ref:`Color<class_Color>` color **)** |
  106. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. | 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 **)** |
  108. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  109. | void | :ref:`set_editable<class_TreeItem_method_set_editable>` **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` enabled **)** |
  110. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  111. | void | :ref:`set_expand_right<class_TreeItem_method_set_expand_right>` **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` enable **)** |
  112. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  113. | void | :ref:`set_icon<class_TreeItem_method_set_icon>` **(** :ref:`int<class_int>` column, :ref:`Texture<class_Texture>` texture **)** |
  114. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  115. | void | :ref:`set_icon_max_width<class_TreeItem_method_set_icon_max_width>` **(** :ref:`int<class_int>` column, :ref:`int<class_int>` width **)** |
  116. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  117. | void | :ref:`set_icon_region<class_TreeItem_method_set_icon_region>` **(** :ref:`int<class_int>` column, :ref:`Rect2<class_Rect2>` region **)** |
  118. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  119. | void | :ref:`set_metadata<class_TreeItem_method_set_metadata>` **(** :ref:`int<class_int>` column, :ref:`Variant<class_Variant>` meta **)** |
  120. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  121. | void | :ref:`set_range<class_TreeItem_method_set_range>` **(** :ref:`int<class_int>` column, :ref:`float<class_float>` value **)** |
  122. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  123. | 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 **)** |
  124. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  125. | void | :ref:`set_selectable<class_TreeItem_method_set_selectable>` **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` selectable **)** |
  126. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  127. | void | :ref:`set_text<class_TreeItem_method_set_text>` **(** :ref:`int<class_int>` column, :ref:`String<class_String>` text **)** |
  128. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  129. | void | :ref:`set_text_align<class_TreeItem_method_set_text_align>` **(** :ref:`int<class_int>` column, :ref:`TextAlign<enum_TreeItem_TextAlign>` text_align **)** |
  130. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  131. | void | :ref:`set_tooltip<class_TreeItem_method_set_tooltip>` **(** :ref:`int<class_int>` column, :ref:`String<class_String>` tooltip **)** |
  132. +-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  133. Enumerations
  134. ------------
  135. .. _enum_TreeItem_TreeCellMode:
  136. .. _class_TreeItem_constant_CELL_MODE_STRING:
  137. .. _class_TreeItem_constant_CELL_MODE_CHECK:
  138. .. _class_TreeItem_constant_CELL_MODE_RANGE:
  139. .. _class_TreeItem_constant_CELL_MODE_ICON:
  140. .. _class_TreeItem_constant_CELL_MODE_CUSTOM:
  141. enum **TreeCellMode**:
  142. - **CELL_MODE_STRING** = **0** --- Cell contains a string.
  143. - **CELL_MODE_CHECK** = **1** --- Cell can be checked.
  144. - **CELL_MODE_RANGE** = **2** --- Cell contains a range.
  145. - **CELL_MODE_ICON** = **3** --- Cell contains an icon.
  146. - **CELL_MODE_CUSTOM** = **4**
  147. ----
  148. .. _enum_TreeItem_TextAlign:
  149. .. _class_TreeItem_constant_ALIGN_LEFT:
  150. .. _class_TreeItem_constant_ALIGN_CENTER:
  151. .. _class_TreeItem_constant_ALIGN_RIGHT:
  152. enum **TextAlign**:
  153. - **ALIGN_LEFT** = **0** --- Align text to the left. See ``set_text_align()``.
  154. - **ALIGN_CENTER** = **1** --- Center text. See ``set_text_align()``.
  155. - **ALIGN_RIGHT** = **2** --- Align text to the right. See ``set_text_align()``.
  156. Description
  157. -----------
  158. Control for a single item inside a :ref:`Tree<class_Tree>`. May have child ``TreeItem``\ s and be styled as well as contain buttons.
  159. Property Descriptions
  160. ---------------------
  161. .. _class_TreeItem_property_collapsed:
  162. - :ref:`bool<class_bool>` **collapsed**
  163. +----------+----------------------+
  164. | *Setter* | set_collapsed(value) |
  165. +----------+----------------------+
  166. | *Getter* | is_collapsed() |
  167. +----------+----------------------+
  168. If ``true``, the TreeItem is collapsed.
  169. ----
  170. .. _class_TreeItem_property_custom_minimum_height:
  171. - :ref:`int<class_int>` **custom_minimum_height**
  172. +----------+----------------------------------+
  173. | *Setter* | set_custom_minimum_height(value) |
  174. +----------+----------------------------------+
  175. | *Getter* | get_custom_minimum_height() |
  176. +----------+----------------------------------+
  177. The custom minimum height.
  178. ----
  179. .. _class_TreeItem_property_disable_folding:
  180. - :ref:`bool<class_bool>` **disable_folding**
  181. +----------+----------------------------+
  182. | *Setter* | set_disable_folding(value) |
  183. +----------+----------------------------+
  184. | *Getter* | is_folding_disabled() |
  185. +----------+----------------------------+
  186. If ``true``, folding is disabled for this TreeItem.
  187. Method Descriptions
  188. -------------------
  189. .. _class_TreeItem_method_add_button:
  190. - 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="" **)**
  191. 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``.
  192. ----
  193. .. _class_TreeItem_method_clear_custom_bg_color:
  194. - void **clear_custom_bg_color** **(** :ref:`int<class_int>` column **)**
  195. Resets the background color for the given column to default.
  196. ----
  197. .. _class_TreeItem_method_clear_custom_color:
  198. - void **clear_custom_color** **(** :ref:`int<class_int>` column **)**
  199. Resets the color for the given column to default.
  200. ----
  201. .. _class_TreeItem_method_deselect:
  202. - void **deselect** **(** :ref:`int<class_int>` column **)**
  203. Deselects the given column.
  204. ----
  205. .. _class_TreeItem_method_erase_button:
  206. - void **erase_button** **(** :ref:`int<class_int>` column, :ref:`int<class_int>` button_idx **)**
  207. Removes the button at index ``button_idx`` in column ``column``.
  208. ----
  209. .. _class_TreeItem_method_get_button:
  210. - :ref:`Texture<class_Texture>` **get_button** **(** :ref:`int<class_int>` column, :ref:`int<class_int>` button_idx **)** const
  211. Returns the :ref:`Texture<class_Texture>` of the button at index ``button_idx`` in column ``column``.
  212. ----
  213. .. _class_TreeItem_method_get_button_count:
  214. - :ref:`int<class_int>` **get_button_count** **(** :ref:`int<class_int>` column **)** const
  215. 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.
  216. ----
  217. .. _class_TreeItem_method_get_cell_mode:
  218. - :ref:`TreeCellMode<enum_TreeItem_TreeCellMode>` **get_cell_mode** **(** :ref:`int<class_int>` column **)** const
  219. Returns the column's cell mode. See ``CELL_MODE_*`` constants.
  220. ----
  221. .. _class_TreeItem_method_get_children:
  222. - :ref:`TreeItem<class_TreeItem>` **get_children** **(** **)**
  223. Returns the TreeItem's child items.
  224. ----
  225. .. _class_TreeItem_method_get_custom_bg_color:
  226. - :ref:`Color<class_Color>` **get_custom_bg_color** **(** :ref:`int<class_int>` column **)** const
  227. Returns the custom background color of column ``column``.
  228. ----
  229. .. _class_TreeItem_method_get_expand_right:
  230. - :ref:`bool<class_bool>` **get_expand_right** **(** :ref:`int<class_int>` column **)** const
  231. Returns ``true`` if ``expand_right`` is set.
  232. ----
  233. .. _class_TreeItem_method_get_icon:
  234. - :ref:`Texture<class_Texture>` **get_icon** **(** :ref:`int<class_int>` column **)** const
  235. Returns the given column's icon :ref:`Texture<class_Texture>`. Error if no icon is set.
  236. ----
  237. .. _class_TreeItem_method_get_icon_max_width:
  238. - :ref:`int<class_int>` **get_icon_max_width** **(** :ref:`int<class_int>` column **)** const
  239. Returns the column's icon's maximum width.
  240. ----
  241. .. _class_TreeItem_method_get_icon_region:
  242. - :ref:`Rect2<class_Rect2>` **get_icon_region** **(** :ref:`int<class_int>` column **)** const
  243. Returns the icon :ref:`Texture<class_Texture>` region as :ref:`Rect2<class_Rect2>`.
  244. ----
  245. .. _class_TreeItem_method_get_metadata:
  246. - :ref:`Variant<class_Variant>` **get_metadata** **(** :ref:`int<class_int>` column **)** const
  247. ----
  248. .. _class_TreeItem_method_get_next:
  249. - :ref:`TreeItem<class_TreeItem>` **get_next** **(** **)**
  250. Returns the next TreeItem in the tree.
  251. ----
  252. .. _class_TreeItem_method_get_next_visible:
  253. - :ref:`TreeItem<class_TreeItem>` **get_next_visible** **(** **)**
  254. Returns the next visible TreeItem in the tree.
  255. ----
  256. .. _class_TreeItem_method_get_parent:
  257. - :ref:`TreeItem<class_TreeItem>` **get_parent** **(** **)**
  258. Returns the parent TreeItem.
  259. ----
  260. .. _class_TreeItem_method_get_prev:
  261. - :ref:`TreeItem<class_TreeItem>` **get_prev** **(** **)**
  262. Returns the previous TreeItem in the tree.
  263. ----
  264. .. _class_TreeItem_method_get_prev_visible:
  265. - :ref:`TreeItem<class_TreeItem>` **get_prev_visible** **(** **)**
  266. Returns the previous visible TreeItem in the tree.
  267. ----
  268. .. _class_TreeItem_method_get_range:
  269. - :ref:`float<class_float>` **get_range** **(** :ref:`int<class_int>` column **)** const
  270. ----
  271. .. _class_TreeItem_method_get_range_config:
  272. - :ref:`Dictionary<class_Dictionary>` **get_range_config** **(** :ref:`int<class_int>` column **)**
  273. ----
  274. .. _class_TreeItem_method_get_text:
  275. - :ref:`String<class_String>` **get_text** **(** :ref:`int<class_int>` column **)** const
  276. Returns the given column's text.
  277. ----
  278. .. _class_TreeItem_method_get_text_align:
  279. - :ref:`TextAlign<enum_TreeItem_TextAlign>` **get_text_align** **(** :ref:`int<class_int>` column **)** const
  280. Returns the given column's text alignment.
  281. ----
  282. .. _class_TreeItem_method_get_tooltip:
  283. - :ref:`String<class_String>` **get_tooltip** **(** :ref:`int<class_int>` column **)** const
  284. Returns the given column's tooltip.
  285. ----
  286. .. _class_TreeItem_method_is_button_disabled:
  287. - :ref:`bool<class_bool>` **is_button_disabled** **(** :ref:`int<class_int>` column, :ref:`int<class_int>` button_idx **)** const
  288. Returns ``true`` if the button at index ``button_idx`` for the given column is disabled.
  289. ----
  290. .. _class_TreeItem_method_is_checked:
  291. - :ref:`bool<class_bool>` **is_checked** **(** :ref:`int<class_int>` column **)** const
  292. Returns ``true`` if the given column is checked.
  293. ----
  294. .. _class_TreeItem_method_is_custom_set_as_button:
  295. - :ref:`bool<class_bool>` **is_custom_set_as_button** **(** :ref:`int<class_int>` column **)** const
  296. ----
  297. .. _class_TreeItem_method_is_editable:
  298. - :ref:`bool<class_bool>` **is_editable** **(** :ref:`int<class_int>` column **)**
  299. Returns ``true`` if column ``column`` is editable.
  300. ----
  301. .. _class_TreeItem_method_is_selectable:
  302. - :ref:`bool<class_bool>` **is_selectable** **(** :ref:`int<class_int>` column **)** const
  303. Returns ``true`` if column ``column`` is selectable.
  304. ----
  305. .. _class_TreeItem_method_is_selected:
  306. - :ref:`bool<class_bool>` **is_selected** **(** :ref:`int<class_int>` column **)**
  307. Returns ``true`` if column ``column`` is selected.
  308. ----
  309. .. _class_TreeItem_method_move_to_bottom:
  310. - void **move_to_bottom** **(** **)**
  311. Moves this TreeItem to the bottom in the :ref:`Tree<class_Tree>` hierarchy.
  312. ----
  313. .. _class_TreeItem_method_move_to_top:
  314. - void **move_to_top** **(** **)**
  315. Moves this TreeItem to the top in the :ref:`Tree<class_Tree>` hierarchy.
  316. ----
  317. .. _class_TreeItem_method_remove_child:
  318. - void **remove_child** **(** :ref:`Object<class_Object>` child **)**
  319. Removes the given child TreeItem.
  320. ----
  321. .. _class_TreeItem_method_select:
  322. - void **select** **(** :ref:`int<class_int>` column **)**
  323. Selects the column ``column``.
  324. ----
  325. .. _class_TreeItem_method_set_button:
  326. - void **set_button** **(** :ref:`int<class_int>` column, :ref:`int<class_int>` button_idx, :ref:`Texture<class_Texture>` button **)**
  327. Sets the given column's button :ref:`Texture<class_Texture>` at index ``button_idx`` to ``button``.
  328. ----
  329. .. _class_TreeItem_method_set_cell_mode:
  330. - void **set_cell_mode** **(** :ref:`int<class_int>` column, :ref:`TreeCellMode<enum_TreeItem_TreeCellMode>` mode **)**
  331. Sets the given column's cell mode to ``mode``. See ``CELL_MODE_*`` constants.
  332. ----
  333. .. _class_TreeItem_method_set_checked:
  334. - void **set_checked** **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` checked **)**
  335. If ``true``, the column ``column`` is checked.
  336. ----
  337. .. _class_TreeItem_method_set_custom_as_button:
  338. - void **set_custom_as_button** **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` enable **)**
  339. ----
  340. .. _class_TreeItem_method_set_custom_bg_color:
  341. - void **set_custom_bg_color** **(** :ref:`int<class_int>` column, :ref:`Color<class_Color>` color, :ref:`bool<class_bool>` just_outline=false **)**
  342. Sets the given column's custom background color and whether to just use it as an outline.
  343. ----
  344. .. _class_TreeItem_method_set_custom_color:
  345. - void **set_custom_color** **(** :ref:`int<class_int>` column, :ref:`Color<class_Color>` color **)**
  346. Sets the given column's custom color.
  347. ----
  348. .. _class_TreeItem_method_set_custom_draw:
  349. - void **set_custom_draw** **(** :ref:`int<class_int>` column, :ref:`Object<class_Object>` object, :ref:`String<class_String>` callback **)**
  350. Sets the given column's custom draw callback to ``callback`` method on ``object``.
  351. The ``callback`` should accept two arguments: the :ref:`TreeItem<class_TreeItem>` that is drawn and its position and size as a :ref:`Rect2<class_Rect2>`.
  352. ----
  353. .. _class_TreeItem_method_set_editable:
  354. - void **set_editable** **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` enabled **)**
  355. If ``true``, column ``column`` is editable.
  356. ----
  357. .. _class_TreeItem_method_set_expand_right:
  358. - void **set_expand_right** **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` enable **)**
  359. If ``true``, column ``column`` is expanded to the right.
  360. ----
  361. .. _class_TreeItem_method_set_icon:
  362. - void **set_icon** **(** :ref:`int<class_int>` column, :ref:`Texture<class_Texture>` texture **)**
  363. Sets the given column's icon :ref:`Texture<class_Texture>`.
  364. ----
  365. .. _class_TreeItem_method_set_icon_max_width:
  366. - void **set_icon_max_width** **(** :ref:`int<class_int>` column, :ref:`int<class_int>` width **)**
  367. Sets the given column's icon's maximum width.
  368. ----
  369. .. _class_TreeItem_method_set_icon_region:
  370. - void **set_icon_region** **(** :ref:`int<class_int>` column, :ref:`Rect2<class_Rect2>` region **)**
  371. Sets the given column's icon's texture region.
  372. ----
  373. .. _class_TreeItem_method_set_metadata:
  374. - void **set_metadata** **(** :ref:`int<class_int>` column, :ref:`Variant<class_Variant>` meta **)**
  375. ----
  376. .. _class_TreeItem_method_set_range:
  377. - void **set_range** **(** :ref:`int<class_int>` column, :ref:`float<class_float>` value **)**
  378. ----
  379. .. _class_TreeItem_method_set_range_config:
  380. - 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 **)**
  381. ----
  382. .. _class_TreeItem_method_set_selectable:
  383. - void **set_selectable** **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` selectable **)**
  384. If ``true``, the given column is selectable.
  385. ----
  386. .. _class_TreeItem_method_set_text:
  387. - void **set_text** **(** :ref:`int<class_int>` column, :ref:`String<class_String>` text **)**
  388. ----
  389. .. _class_TreeItem_method_set_text_align:
  390. - void **set_text_align** **(** :ref:`int<class_int>` column, :ref:`TextAlign<enum_TreeItem_TextAlign>` text_align **)**
  391. Sets the given column's text alignment. See ``ALIGN_*`` constants.
  392. ----
  393. .. _class_TreeItem_method_set_tooltip:
  394. - void **set_tooltip** **(** :ref:`int<class_int>` column, :ref:`String<class_String>` tooltip **)**
  395. Sets the given column's tooltip text.