class_tree.rst 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  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 Tree.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_Tree:
  6. Tree
  7. ====
  8. **Inherits:** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Control to show a tree of items.
  13. Properties
  14. ----------
  15. +-----------------------------------------+---------------------------------------------------------------+-------+
  16. | :ref:`bool<class_bool>` | :ref:`allow_reselect<class_Tree_property_allow_reselect>` | false |
  17. +-----------------------------------------+---------------------------------------------------------------+-------+
  18. | :ref:`bool<class_bool>` | :ref:`allow_rmb_select<class_Tree_property_allow_rmb_select>` | false |
  19. +-----------------------------------------+---------------------------------------------------------------+-------+
  20. | :ref:`int<class_int>` | :ref:`columns<class_Tree_property_columns>` | 1 |
  21. +-----------------------------------------+---------------------------------------------------------------+-------+
  22. | :ref:`int<class_int>` | :ref:`drop_mode_flags<class_Tree_property_drop_mode_flags>` | 0 |
  23. +-----------------------------------------+---------------------------------------------------------------+-------+
  24. | :ref:`bool<class_bool>` | :ref:`hide_folding<class_Tree_property_hide_folding>` | false |
  25. +-----------------------------------------+---------------------------------------------------------------+-------+
  26. | :ref:`bool<class_bool>` | :ref:`hide_root<class_Tree_property_hide_root>` | false |
  27. +-----------------------------------------+---------------------------------------------------------------+-------+
  28. | :ref:`SelectMode<enum_Tree_SelectMode>` | :ref:`select_mode<class_Tree_property_select_mode>` | 0 |
  29. +-----------------------------------------+---------------------------------------------------------------+-------+
  30. Methods
  31. -------
  32. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`bool<class_bool>` | :ref:`are_column_titles_visible<class_Tree_method_are_column_titles_visible>` **(** **)** const |
  34. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`clear<class_Tree_method_clear>` **(** **)** |
  36. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`TreeItem<class_TreeItem>` | :ref:`create_item<class_Tree_method_create_item>` **(** :ref:`Object<class_Object>` parent=null, :ref:`int<class_int>` idx=-1 **)** |
  38. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | void | :ref:`ensure_cursor_is_visible<class_Tree_method_ensure_cursor_is_visible>` **(** **)** |
  40. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`int<class_int>` | :ref:`get_column_at_position<class_Tree_method_get_column_at_position>` **(** :ref:`Vector2<class_Vector2>` position **)** const |
  42. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`String<class_String>` | :ref:`get_column_title<class_Tree_method_get_column_title>` **(** :ref:`int<class_int>` column **)** const |
  44. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`int<class_int>` | :ref:`get_column_width<class_Tree_method_get_column_width>` **(** :ref:`int<class_int>` column **)** const |
  46. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`Rect2<class_Rect2>` | :ref:`get_custom_popup_rect<class_Tree_method_get_custom_popup_rect>` **(** **)** const |
  48. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`int<class_int>` | :ref:`get_drop_section_at_position<class_Tree_method_get_drop_section_at_position>` **(** :ref:`Vector2<class_Vector2>` position **)** const |
  50. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_edited<class_Tree_method_get_edited>` **(** **)** const |
  52. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`int<class_int>` | :ref:`get_edited_column<class_Tree_method_get_edited_column>` **(** **)** const |
  54. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`Rect2<class_Rect2>` | :ref:`get_item_area_rect<class_Tree_method_get_item_area_rect>` **(** :ref:`Object<class_Object>` item, :ref:`int<class_int>` column=-1 **)** const |
  56. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_item_at_position<class_Tree_method_get_item_at_position>` **(** :ref:`Vector2<class_Vector2>` position **)** const |
  58. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_next_selected<class_Tree_method_get_next_selected>` **(** :ref:`Object<class_Object>` from **)** |
  60. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`int<class_int>` | :ref:`get_pressed_button<class_Tree_method_get_pressed_button>` **(** **)** const |
  62. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_root<class_Tree_method_get_root>` **(** **)** |
  64. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | :ref:`Vector2<class_Vector2>` | :ref:`get_scroll<class_Tree_method_get_scroll>` **(** **)** const |
  66. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_selected<class_Tree_method_get_selected>` **(** **)** const |
  68. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | :ref:`int<class_int>` | :ref:`get_selected_column<class_Tree_method_get_selected_column>` **(** **)** const |
  70. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | void | :ref:`set_column_expand<class_Tree_method_set_column_expand>` **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` expand **)** |
  72. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | void | :ref:`set_column_min_width<class_Tree_method_set_column_min_width>` **(** :ref:`int<class_int>` column, :ref:`int<class_int>` min_width **)** |
  74. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | void | :ref:`set_column_title<class_Tree_method_set_column_title>` **(** :ref:`int<class_int>` column, :ref:`String<class_String>` title **)** |
  76. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | void | :ref:`set_column_titles_visible<class_Tree_method_set_column_titles_visible>` **(** :ref:`bool<class_bool>` visible **)** |
  78. +---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+
  79. Theme Properties
  80. ----------------
  81. +---------------------------------+------------------------------+------------------------------+
  82. | :ref:`Texture<class_Texture>` | arrow | |
  83. +---------------------------------+------------------------------+------------------------------+
  84. | :ref:`Texture<class_Texture>` | arrow_collapsed | |
  85. +---------------------------------+------------------------------+------------------------------+
  86. | :ref:`StyleBox<class_StyleBox>` | bg | |
  87. +---------------------------------+------------------------------+------------------------------+
  88. | :ref:`StyleBox<class_StyleBox>` | bg_focus | |
  89. +---------------------------------+------------------------------+------------------------------+
  90. | :ref:`int<class_int>` | button_margin | 4 |
  91. +---------------------------------+------------------------------+------------------------------+
  92. | :ref:`StyleBox<class_StyleBox>` | button_pressed | |
  93. +---------------------------------+------------------------------+------------------------------+
  94. | :ref:`Texture<class_Texture>` | checked | |
  95. +---------------------------------+------------------------------+------------------------------+
  96. | :ref:`StyleBox<class_StyleBox>` | cursor | |
  97. +---------------------------------+------------------------------+------------------------------+
  98. | :ref:`Color<class_Color>` | cursor_color | Color( 0, 0, 0, 1 ) |
  99. +---------------------------------+------------------------------+------------------------------+
  100. | :ref:`StyleBox<class_StyleBox>` | cursor_unfocused | |
  101. +---------------------------------+------------------------------+------------------------------+
  102. | :ref:`StyleBox<class_StyleBox>` | custom_button | |
  103. +---------------------------------+------------------------------+------------------------------+
  104. | :ref:`Color<class_Color>` | custom_button_font_highlight | Color( 0.94, 0.94, 0.94, 1 ) |
  105. +---------------------------------+------------------------------+------------------------------+
  106. | :ref:`StyleBox<class_StyleBox>` | custom_button_hover | |
  107. +---------------------------------+------------------------------+------------------------------+
  108. | :ref:`StyleBox<class_StyleBox>` | custom_button_pressed | |
  109. +---------------------------------+------------------------------+------------------------------+
  110. | :ref:`int<class_int>` | draw_guides | 1 |
  111. +---------------------------------+------------------------------+------------------------------+
  112. | :ref:`int<class_int>` | draw_relationship_lines | 0 |
  113. +---------------------------------+------------------------------+------------------------------+
  114. | :ref:`Color<class_Color>` | drop_position_color | Color( 1, 0.3, 0.2, 1 ) |
  115. +---------------------------------+------------------------------+------------------------------+
  116. | :ref:`Font<class_Font>` | font | |
  117. +---------------------------------+------------------------------+------------------------------+
  118. | :ref:`Color<class_Color>` | font_color | Color( 0.69, 0.69, 0.69, 1 ) |
  119. +---------------------------------+------------------------------+------------------------------+
  120. | :ref:`Color<class_Color>` | font_color_selected | Color( 1, 1, 1, 1 ) |
  121. +---------------------------------+------------------------------+------------------------------+
  122. | :ref:`Color<class_Color>` | guide_color | Color( 0, 0, 0, 0.1 ) |
  123. +---------------------------------+------------------------------+------------------------------+
  124. | :ref:`int<class_int>` | guide_width | 2 |
  125. +---------------------------------+------------------------------+------------------------------+
  126. | :ref:`int<class_int>` | hseparation | 4 |
  127. +---------------------------------+------------------------------+------------------------------+
  128. | :ref:`int<class_int>` | item_margin | 12 |
  129. +---------------------------------+------------------------------+------------------------------+
  130. | :ref:`Color<class_Color>` | relationship_line_color | Color( 0.27, 0.27, 0.27, 1 ) |
  131. +---------------------------------+------------------------------+------------------------------+
  132. | :ref:`int<class_int>` | scroll_border | 4 |
  133. +---------------------------------+------------------------------+------------------------------+
  134. | :ref:`int<class_int>` | scroll_speed | 12 |
  135. +---------------------------------+------------------------------+------------------------------+
  136. | :ref:`Texture<class_Texture>` | select_arrow | |
  137. +---------------------------------+------------------------------+------------------------------+
  138. | :ref:`StyleBox<class_StyleBox>` | selected | |
  139. +---------------------------------+------------------------------+------------------------------+
  140. | :ref:`StyleBox<class_StyleBox>` | selected_focus | |
  141. +---------------------------------+------------------------------+------------------------------+
  142. | :ref:`Color<class_Color>` | selection_color | Color( 0.1, 0.1, 1, 0.8 ) |
  143. +---------------------------------+------------------------------+------------------------------+
  144. | :ref:`Color<class_Color>` | title_button_color | Color( 0.88, 0.88, 0.88, 1 ) |
  145. +---------------------------------+------------------------------+------------------------------+
  146. | :ref:`Font<class_Font>` | title_button_font | |
  147. +---------------------------------+------------------------------+------------------------------+
  148. | :ref:`StyleBox<class_StyleBox>` | title_button_hover | |
  149. +---------------------------------+------------------------------+------------------------------+
  150. | :ref:`StyleBox<class_StyleBox>` | title_button_normal | |
  151. +---------------------------------+------------------------------+------------------------------+
  152. | :ref:`StyleBox<class_StyleBox>` | title_button_pressed | |
  153. +---------------------------------+------------------------------+------------------------------+
  154. | :ref:`Texture<class_Texture>` | unchecked | |
  155. +---------------------------------+------------------------------+------------------------------+
  156. | :ref:`Texture<class_Texture>` | updown | |
  157. +---------------------------------+------------------------------+------------------------------+
  158. | :ref:`int<class_int>` | vseparation | 4 |
  159. +---------------------------------+------------------------------+------------------------------+
  160. Signals
  161. -------
  162. .. _class_Tree_signal_button_pressed:
  163. - **button_pressed** **(** :ref:`TreeItem<class_TreeItem>` item, :ref:`int<class_int>` column, :ref:`int<class_int>` id **)**
  164. Emitted when a button on the tree was pressed (see :ref:`TreeItem.add_button<class_TreeItem_method_add_button>`).
  165. .. _class_Tree_signal_cell_selected:
  166. - **cell_selected** **(** **)**
  167. Emitted when a cell is selected.
  168. .. _class_Tree_signal_column_title_pressed:
  169. - **column_title_pressed** **(** :ref:`int<class_int>` column **)**
  170. Emitted when a column's title is pressed.
  171. .. _class_Tree_signal_custom_popup_edited:
  172. - **custom_popup_edited** **(** :ref:`bool<class_bool>` arrow_clicked **)**
  173. Emitted when a cell with the :ref:`TreeItem.CELL_MODE_CUSTOM<class_TreeItem_constant_CELL_MODE_CUSTOM>` is clicked to be edited.
  174. .. _class_Tree_signal_empty_rmb:
  175. - **empty_rmb** **(** :ref:`Vector2<class_Vector2>` position **)**
  176. .. _class_Tree_signal_empty_tree_rmb_selected:
  177. - **empty_tree_rmb_selected** **(** :ref:`Vector2<class_Vector2>` position **)**
  178. Emitted when the right mouse button is pressed if right mouse button selection is active and the tree is empty.
  179. .. _class_Tree_signal_item_activated:
  180. - **item_activated** **(** **)**
  181. Emitted when an item's label is double-clicked.
  182. .. _class_Tree_signal_item_collapsed:
  183. - **item_collapsed** **(** :ref:`TreeItem<class_TreeItem>` item **)**
  184. Emitted when an item is collapsed by a click on the folding arrow.
  185. .. _class_Tree_signal_item_custom_button_pressed:
  186. - **item_custom_button_pressed** **(** **)**
  187. .. _class_Tree_signal_item_double_clicked:
  188. - **item_double_clicked** **(** **)**
  189. Emitted when an item's icon is double-clicked.
  190. .. _class_Tree_signal_item_edited:
  191. - **item_edited** **(** **)**
  192. Emitted when an item is edited.
  193. .. _class_Tree_signal_item_rmb_edited:
  194. - **item_rmb_edited** **(** **)**
  195. Emitted when an item is edited using the right mouse button.
  196. .. _class_Tree_signal_item_rmb_selected:
  197. - **item_rmb_selected** **(** :ref:`Vector2<class_Vector2>` position **)**
  198. Emitted when an item is selected with the right mouse button.
  199. .. _class_Tree_signal_item_selected:
  200. - **item_selected** **(** **)**
  201. Emitted when an item is selected.
  202. .. _class_Tree_signal_multi_selected:
  203. - **multi_selected** **(** :ref:`TreeItem<class_TreeItem>` item, :ref:`int<class_int>` column, :ref:`bool<class_bool>` selected **)**
  204. Emitted instead of ``item_selected`` if ``select_mode`` is :ref:`SELECT_MULTI<class_Tree_constant_SELECT_MULTI>`.
  205. .. _class_Tree_signal_nothing_selected:
  206. - **nothing_selected** **(** **)**
  207. Enumerations
  208. ------------
  209. .. _enum_Tree_SelectMode:
  210. .. _class_Tree_constant_SELECT_SINGLE:
  211. .. _class_Tree_constant_SELECT_ROW:
  212. .. _class_Tree_constant_SELECT_MULTI:
  213. enum **SelectMode**:
  214. - **SELECT_SINGLE** = **0** --- Allows selection of a single item at a time.
  215. - **SELECT_ROW** = **1**
  216. - **SELECT_MULTI** = **2** --- Allows selection of multiple items at the same time.
  217. .. _enum_Tree_DropModeFlags:
  218. .. _class_Tree_constant_DROP_MODE_DISABLED:
  219. .. _class_Tree_constant_DROP_MODE_ON_ITEM:
  220. .. _class_Tree_constant_DROP_MODE_INBETWEEN:
  221. enum **DropModeFlags**:
  222. - **DROP_MODE_DISABLED** = **0**
  223. - **DROP_MODE_ON_ITEM** = **1**
  224. - **DROP_MODE_INBETWEEN** = **2**
  225. Description
  226. -----------
  227. This shows a tree of items that can be selected, expanded and collapsed. The tree can have multiple columns with custom controls like text editing, buttons and popups. It can be useful for structured displays and interactions.
  228. Trees are built via code, using :ref:`TreeItem<class_TreeItem>` objects to create the structure. They have a single root but multiple roots can be simulated if a dummy hidden root is added.
  229. ::
  230. func _ready():
  231. var tree = Tree.new()
  232. var root = tree.create_item()
  233. tree.set_hide_root(true)
  234. var child1 = tree.create_item(root)
  235. var child2 = tree.create_item(root)
  236. var subchild1 = tree.create_item(child1)
  237. subchild1.set_text(0, "Subchild1")
  238. Property Descriptions
  239. ---------------------
  240. .. _class_Tree_property_allow_reselect:
  241. - :ref:`bool<class_bool>` **allow_reselect**
  242. +-----------+---------------------------+
  243. | *Default* | false |
  244. +-----------+---------------------------+
  245. | *Setter* | set_allow_reselect(value) |
  246. +-----------+---------------------------+
  247. | *Getter* | get_allow_reselect() |
  248. +-----------+---------------------------+
  249. If ``true``, the currently selected cell may be selected again.
  250. .. _class_Tree_property_allow_rmb_select:
  251. - :ref:`bool<class_bool>` **allow_rmb_select**
  252. +-----------+-----------------------------+
  253. | *Default* | false |
  254. +-----------+-----------------------------+
  255. | *Setter* | set_allow_rmb_select(value) |
  256. +-----------+-----------------------------+
  257. | *Getter* | get_allow_rmb_select() |
  258. +-----------+-----------------------------+
  259. If ``true``, a right mouse button click can select items.
  260. .. _class_Tree_property_columns:
  261. - :ref:`int<class_int>` **columns**
  262. +-----------+--------------------+
  263. | *Default* | 1 |
  264. +-----------+--------------------+
  265. | *Setter* | set_columns(value) |
  266. +-----------+--------------------+
  267. | *Getter* | get_columns() |
  268. +-----------+--------------------+
  269. The number of columns.
  270. .. _class_Tree_property_drop_mode_flags:
  271. - :ref:`int<class_int>` **drop_mode_flags**
  272. +-----------+----------------------------+
  273. | *Default* | 0 |
  274. +-----------+----------------------------+
  275. | *Setter* | set_drop_mode_flags(value) |
  276. +-----------+----------------------------+
  277. | *Getter* | get_drop_mode_flags() |
  278. +-----------+----------------------------+
  279. The drop mode as an OR combination of flags. See ``DROP_MODE_*`` constants. Once dropping is done, reverts to :ref:`DROP_MODE_DISABLED<class_Tree_constant_DROP_MODE_DISABLED>`. Setting this during :ref:`Control.can_drop_data<class_Control_method_can_drop_data>` is recommended.
  280. .. _class_Tree_property_hide_folding:
  281. - :ref:`bool<class_bool>` **hide_folding**
  282. +-----------+-------------------------+
  283. | *Default* | false |
  284. +-----------+-------------------------+
  285. | *Setter* | set_hide_folding(value) |
  286. +-----------+-------------------------+
  287. | *Getter* | is_folding_hidden() |
  288. +-----------+-------------------------+
  289. If ``true``, the folding arrow is hidden.
  290. .. _class_Tree_property_hide_root:
  291. - :ref:`bool<class_bool>` **hide_root**
  292. +-----------+----------------------+
  293. | *Default* | false |
  294. +-----------+----------------------+
  295. | *Setter* | set_hide_root(value) |
  296. +-----------+----------------------+
  297. | *Getter* | is_root_hidden() |
  298. +-----------+----------------------+
  299. If ``true``, the tree's root is hidden.
  300. .. _class_Tree_property_select_mode:
  301. - :ref:`SelectMode<enum_Tree_SelectMode>` **select_mode**
  302. +-----------+------------------------+
  303. | *Default* | 0 |
  304. +-----------+------------------------+
  305. | *Setter* | set_select_mode(value) |
  306. +-----------+------------------------+
  307. | *Getter* | get_select_mode() |
  308. +-----------+------------------------+
  309. Allows single or multiple selection. See the ``SELECT_*`` constants.
  310. Method Descriptions
  311. -------------------
  312. .. _class_Tree_method_are_column_titles_visible:
  313. - :ref:`bool<class_bool>` **are_column_titles_visible** **(** **)** const
  314. Returns ``true`` if the column titles are being shown.
  315. .. _class_Tree_method_clear:
  316. - void **clear** **(** **)**
  317. Clears the tree. This removes all items.
  318. .. _class_Tree_method_create_item:
  319. - :ref:`TreeItem<class_TreeItem>` **create_item** **(** :ref:`Object<class_Object>` parent=null, :ref:`int<class_int>` idx=-1 **)**
  320. Create an item in the tree and add it as the last child of ``parent``. If ``parent`` is ``null``, it will be added as the root's last child, or it'll be the the root itself if the tree is empty.
  321. .. _class_Tree_method_ensure_cursor_is_visible:
  322. - void **ensure_cursor_is_visible** **(** **)**
  323. Makes the currently selected item visible. This will scroll the tree to make sure the selected item is visible.
  324. .. _class_Tree_method_get_column_at_position:
  325. - :ref:`int<class_int>` **get_column_at_position** **(** :ref:`Vector2<class_Vector2>` position **)** const
  326. Returns the column index under the given point.
  327. .. _class_Tree_method_get_column_title:
  328. - :ref:`String<class_String>` **get_column_title** **(** :ref:`int<class_int>` column **)** const
  329. Returns the column's title.
  330. .. _class_Tree_method_get_column_width:
  331. - :ref:`int<class_int>` **get_column_width** **(** :ref:`int<class_int>` column **)** const
  332. Returns the column's width in pixels.
  333. .. _class_Tree_method_get_custom_popup_rect:
  334. - :ref:`Rect2<class_Rect2>` **get_custom_popup_rect** **(** **)** const
  335. Returns the rectangle for custom popups. Helper to create custom cell controls that display a popup. See :ref:`TreeItem.set_cell_mode<class_TreeItem_method_set_cell_mode>`.
  336. .. _class_Tree_method_get_drop_section_at_position:
  337. - :ref:`int<class_int>` **get_drop_section_at_position** **(** :ref:`Vector2<class_Vector2>` position **)** const
  338. If :ref:`drop_mode_flags<class_Tree_property_drop_mode_flags>` includes :ref:`DROP_MODE_INBETWEEN<class_Tree_constant_DROP_MODE_INBETWEEN>`, returns -1 if ``position`` is the upper part of a tree item at that position, 1 for the lower part, and additionally 0 for the middle part if :ref:`drop_mode_flags<class_Tree_property_drop_mode_flags>` includes :ref:`DROP_MODE_ON_ITEM<class_Tree_constant_DROP_MODE_ON_ITEM>`.
  339. Otherwise, returns 0. If there are no tree items at ``position``, returns -100.
  340. .. _class_Tree_method_get_edited:
  341. - :ref:`TreeItem<class_TreeItem>` **get_edited** **(** **)** const
  342. Returns the currently edited item. This is only available for custom cell mode.
  343. .. _class_Tree_method_get_edited_column:
  344. - :ref:`int<class_int>` **get_edited_column** **(** **)** const
  345. Returns the column for the currently edited item. This is only available for custom cell mode.
  346. .. _class_Tree_method_get_item_area_rect:
  347. - :ref:`Rect2<class_Rect2>` **get_item_area_rect** **(** :ref:`Object<class_Object>` item, :ref:`int<class_int>` column=-1 **)** const
  348. Returns the rectangle area for the specified item. If column is specified, only get the position and size of that column, otherwise get the rectangle containing all columns.
  349. .. _class_Tree_method_get_item_at_position:
  350. - :ref:`TreeItem<class_TreeItem>` **get_item_at_position** **(** :ref:`Vector2<class_Vector2>` position **)** const
  351. Returns the tree item at the specified position (relative to the tree origin position).
  352. .. _class_Tree_method_get_next_selected:
  353. - :ref:`TreeItem<class_TreeItem>` **get_next_selected** **(** :ref:`Object<class_Object>` from **)**
  354. Returns the next selected item after the given one.
  355. .. _class_Tree_method_get_pressed_button:
  356. - :ref:`int<class_int>` **get_pressed_button** **(** **)** const
  357. Returns the last pressed button's index.
  358. .. _class_Tree_method_get_root:
  359. - :ref:`TreeItem<class_TreeItem>` **get_root** **(** **)**
  360. Returns the tree's root item.
  361. .. _class_Tree_method_get_scroll:
  362. - :ref:`Vector2<class_Vector2>` **get_scroll** **(** **)** const
  363. Returns the current scrolling position.
  364. .. _class_Tree_method_get_selected:
  365. - :ref:`TreeItem<class_TreeItem>` **get_selected** **(** **)** const
  366. Returns the currently selected item.
  367. .. _class_Tree_method_get_selected_column:
  368. - :ref:`int<class_int>` **get_selected_column** **(** **)** const
  369. Returns the current selection's column.
  370. .. _class_Tree_method_set_column_expand:
  371. - void **set_column_expand** **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` expand **)**
  372. If ``true``, the column will have the "Expand" flag of :ref:`Control<class_Control>`. Columns that have the "Expand" flag will use their "min_width" in a similar fashion to :ref:`Control.size_flags_stretch_ratio<class_Control_property_size_flags_stretch_ratio>`.
  373. .. _class_Tree_method_set_column_min_width:
  374. - void **set_column_min_width** **(** :ref:`int<class_int>` column, :ref:`int<class_int>` min_width **)**
  375. Sets the minimum width of a column. Columns that have the "Expand" flag will use their "min_width" in a similar fashion to :ref:`Control.size_flags_stretch_ratio<class_Control_property_size_flags_stretch_ratio>`.
  376. .. _class_Tree_method_set_column_title:
  377. - void **set_column_title** **(** :ref:`int<class_int>` column, :ref:`String<class_String>` title **)**
  378. Sets the title of a column.
  379. .. _class_Tree_method_set_column_titles_visible:
  380. - void **set_column_titles_visible** **(** :ref:`bool<class_bool>` visible **)**
  381. If ``true``, column titles are visible.