class_tree.rst 58 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.5/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.5/doc/classes/Tree.xml.
  6. .. _class_Tree:
  7. Tree
  8. ====
  9. **Inherits:** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Control to show a tree of items.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. 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.
  15. 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.
  16. ::
  17. func _ready():
  18. var tree = Tree.new()
  19. var root = tree.create_item()
  20. tree.set_hide_root(true)
  21. var child1 = tree.create_item(root)
  22. var child2 = tree.create_item(root)
  23. var subchild1 = tree.create_item(child1)
  24. subchild1.set_text(0, "Subchild1")
  25. To iterate over all the :ref:`TreeItem<class_TreeItem>` objects in a **Tree** object, use :ref:`TreeItem.get_next<class_TreeItem_method_get_next>` and :ref:`TreeItem.get_children<class_TreeItem_method_get_children>` after getting the root through :ref:`get_root<class_Tree_method_get_root>`. You can use :ref:`Object.free<class_Object_method_free>` on a :ref:`TreeItem<class_TreeItem>` to remove it from the **Tree**.
  26. \ **Incremental search:** Like :ref:`ItemList<class_ItemList>` and :ref:`PopupMenu<class_PopupMenu>`, **Tree** supports searching within the list while the control is focused. Press a key that matches the first letter of an item's name to select the first item starting with the given letter. After that point, there are two ways to perform incremental search: 1) Press the same key again before the timeout duration to select the next item starting with the same letter. 2) Press letter keys that match the rest of the word before the timeout duration to match to select the item in question directly. Both of these actions will be reset to the beginning of the list if the timeout duration has passed since the last keystroke was registered. You can adjust the timeout duration by changing :ref:`ProjectSettings.gui/timers/incremental_search_max_interval_msec<class_ProjectSettings_property_gui/timers/incremental_search_max_interval_msec>`.
  27. .. rst-class:: classref-reftable-group
  28. Properties
  29. ----------
  30. .. table::
  31. :widths: auto
  32. +------------------------------------------+-------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  33. | :ref:`bool<class_bool>` | :ref:`allow_reselect<class_Tree_property_allow_reselect>` | ``false`` |
  34. +------------------------------------------+-------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  35. | :ref:`bool<class_bool>` | :ref:`allow_rmb_select<class_Tree_property_allow_rmb_select>` | ``false`` |
  36. +------------------------------------------+-------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  37. | :ref:`bool<class_bool>` | :ref:`column_titles_visible<class_Tree_property_column_titles_visible>` | ``false`` |
  38. +------------------------------------------+-------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  39. | :ref:`int<class_int>` | :ref:`columns<class_Tree_property_columns>` | ``1`` |
  40. +------------------------------------------+-------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  41. | :ref:`int<class_int>` | :ref:`drop_mode_flags<class_Tree_property_drop_mode_flags>` | ``0`` |
  42. +------------------------------------------+-------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  43. | :ref:`FocusMode<enum_Control_FocusMode>` | focus_mode | ``2`` (overrides :ref:`Control<class_Control_property_focus_mode>`) |
  44. +------------------------------------------+-------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  45. | :ref:`bool<class_bool>` | :ref:`hide_folding<class_Tree_property_hide_folding>` | ``false`` |
  46. +------------------------------------------+-------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  47. | :ref:`bool<class_bool>` | :ref:`hide_root<class_Tree_property_hide_root>` | ``false`` |
  48. +------------------------------------------+-------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  49. | :ref:`bool<class_bool>` | rect_clip_content | ``true`` (overrides :ref:`Control<class_Control_property_rect_clip_content>`) |
  50. +------------------------------------------+-------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  51. | :ref:`SelectMode<enum_Tree_SelectMode>` | :ref:`select_mode<class_Tree_property_select_mode>` | ``0`` |
  52. +------------------------------------------+-------------------------------------------------------------------------+-------------------------------------------------------------------------------+
  53. .. rst-class:: classref-reftable-group
  54. Methods
  55. -------
  56. .. table::
  57. :widths: auto
  58. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | void | :ref:`clear<class_Tree_method_clear>` **(** **)** |
  60. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`TreeItem<class_TreeItem>` | :ref:`create_item<class_Tree_method_create_item>` **(** :ref:`Object<class_Object>` parent=null, :ref:`int<class_int>` idx=-1 **)** |
  62. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`bool<class_bool>` | :ref:`edit_selected<class_Tree_method_edit_selected>` **(** **)** |
  64. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | void | :ref:`ensure_cursor_is_visible<class_Tree_method_ensure_cursor_is_visible>` **(** **)** |
  66. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | :ref:`int<class_int>` | :ref:`get_button_id_at_position<class_Tree_method_get_button_id_at_position>` **(** :ref:`Vector2<class_Vector2>` position **)** |const| |
  68. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | :ref:`int<class_int>` | :ref:`get_column_at_position<class_Tree_method_get_column_at_position>` **(** :ref:`Vector2<class_Vector2>` position **)** |const| |
  70. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | :ref:`String<class_String>` | :ref:`get_column_title<class_Tree_method_get_column_title>` **(** :ref:`int<class_int>` column **)** |const| |
  72. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | :ref:`int<class_int>` | :ref:`get_column_width<class_Tree_method_get_column_width>` **(** :ref:`int<class_int>` column **)** |const| |
  74. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | :ref:`Rect2<class_Rect2>` | :ref:`get_custom_popup_rect<class_Tree_method_get_custom_popup_rect>` **(** **)** |const| |
  76. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | :ref:`int<class_int>` | :ref:`get_drop_section_at_position<class_Tree_method_get_drop_section_at_position>` **(** :ref:`Vector2<class_Vector2>` position **)** |const| |
  78. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_edited<class_Tree_method_get_edited>` **(** **)** |const| |
  80. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | :ref:`int<class_int>` | :ref:`get_edited_column<class_Tree_method_get_edited_column>` **(** **)** |const| |
  82. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | :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| |
  84. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_item_at_position<class_Tree_method_get_item_at_position>` **(** :ref:`Vector2<class_Vector2>` position **)** |const| |
  86. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_next_selected<class_Tree_method_get_next_selected>` **(** :ref:`Object<class_Object>` from **)** |
  88. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | :ref:`int<class_int>` | :ref:`get_pressed_button<class_Tree_method_get_pressed_button>` **(** **)** |const| |
  90. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_root<class_Tree_method_get_root>` **(** **)** |
  92. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | :ref:`Vector2<class_Vector2>` | :ref:`get_scroll<class_Tree_method_get_scroll>` **(** **)** |const| |
  94. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_selected<class_Tree_method_get_selected>` **(** **)** |const| |
  96. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | :ref:`int<class_int>` | :ref:`get_selected_column<class_Tree_method_get_selected_column>` **(** **)** |const| |
  98. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | void | :ref:`scroll_to_item<class_Tree_method_scroll_to_item>` **(** :ref:`Object<class_Object>` item **)** |
  100. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | void | :ref:`set_column_expand<class_Tree_method_set_column_expand>` **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` expand **)** |
  102. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | void | :ref:`set_column_min_width<class_Tree_method_set_column_min_width>` **(** :ref:`int<class_int>` column, :ref:`int<class_int>` min_width **)** |
  104. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | void | :ref:`set_column_title<class_Tree_method_set_column_title>` **(** :ref:`int<class_int>` column, :ref:`String<class_String>` title **)** |
  106. +---------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. .. rst-class:: classref-reftable-group
  108. Theme Properties
  109. ----------------
  110. .. table::
  111. :widths: auto
  112. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  113. | :ref:`Color<class_Color>` | :ref:`custom_button_font_highlight<class_Tree_theme_color_custom_button_font_highlight>` | ``Color( 0.94, 0.94, 0.94, 1 )`` |
  114. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  115. | :ref:`Color<class_Color>` | :ref:`drop_position_color<class_Tree_theme_color_drop_position_color>` | ``Color( 1, 0.3, 0.2, 1 )`` |
  116. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  117. | :ref:`Color<class_Color>` | :ref:`font_color<class_Tree_theme_color_font_color>` | ``Color( 0.69, 0.69, 0.69, 1 )`` |
  118. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  119. | :ref:`Color<class_Color>` | :ref:`font_color_selected<class_Tree_theme_color_font_color_selected>` | ``Color( 1, 1, 1, 1 )`` |
  120. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  121. | :ref:`Color<class_Color>` | :ref:`guide_color<class_Tree_theme_color_guide_color>` | ``Color( 0, 0, 0, 0.1 )`` |
  122. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  123. | :ref:`Color<class_Color>` | :ref:`relationship_line_color<class_Tree_theme_color_relationship_line_color>` | ``Color( 0.27, 0.27, 0.27, 1 )`` |
  124. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  125. | :ref:`Color<class_Color>` | :ref:`title_button_color<class_Tree_theme_color_title_button_color>` | ``Color( 0.88, 0.88, 0.88, 1 )`` |
  126. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  127. | :ref:`int<class_int>` | :ref:`button_margin<class_Tree_theme_constant_button_margin>` | ``4`` |
  128. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  129. | :ref:`int<class_int>` | :ref:`draw_guides<class_Tree_theme_constant_draw_guides>` | ``1`` |
  130. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  131. | :ref:`int<class_int>` | :ref:`draw_relationship_lines<class_Tree_theme_constant_draw_relationship_lines>` | ``0`` |
  132. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  133. | :ref:`int<class_int>` | :ref:`hseparation<class_Tree_theme_constant_hseparation>` | ``4`` |
  134. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  135. | :ref:`int<class_int>` | :ref:`item_margin<class_Tree_theme_constant_item_margin>` | ``12`` |
  136. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  137. | :ref:`int<class_int>` | :ref:`scroll_border<class_Tree_theme_constant_scroll_border>` | ``4`` |
  138. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  139. | :ref:`int<class_int>` | :ref:`scroll_speed<class_Tree_theme_constant_scroll_speed>` | ``12`` |
  140. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  141. | :ref:`int<class_int>` | :ref:`vseparation<class_Tree_theme_constant_vseparation>` | ``4`` |
  142. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  143. | :ref:`Font<class_Font>` | :ref:`font<class_Tree_theme_font_font>` | |
  144. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  145. | :ref:`Font<class_Font>` | :ref:`title_button_font<class_Tree_theme_font_title_button_font>` | |
  146. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  147. | :ref:`Texture<class_Texture>` | :ref:`arrow<class_Tree_theme_icon_arrow>` | |
  148. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  149. | :ref:`Texture<class_Texture>` | :ref:`arrow_collapsed<class_Tree_theme_icon_arrow_collapsed>` | |
  150. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  151. | :ref:`Texture<class_Texture>` | :ref:`checked<class_Tree_theme_icon_checked>` | |
  152. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  153. | :ref:`Texture<class_Texture>` | :ref:`select_arrow<class_Tree_theme_icon_select_arrow>` | |
  154. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  155. | :ref:`Texture<class_Texture>` | :ref:`unchecked<class_Tree_theme_icon_unchecked>` | |
  156. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  157. | :ref:`Texture<class_Texture>` | :ref:`updown<class_Tree_theme_icon_updown>` | |
  158. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  159. | :ref:`StyleBox<class_StyleBox>` | :ref:`bg<class_Tree_theme_style_bg>` | |
  160. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  161. | :ref:`StyleBox<class_StyleBox>` | :ref:`bg_focus<class_Tree_theme_style_bg_focus>` | |
  162. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  163. | :ref:`StyleBox<class_StyleBox>` | :ref:`button_pressed<class_Tree_theme_style_button_pressed>` | |
  164. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  165. | :ref:`StyleBox<class_StyleBox>` | :ref:`cursor<class_Tree_theme_style_cursor>` | |
  166. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  167. | :ref:`StyleBox<class_StyleBox>` | :ref:`cursor_unfocused<class_Tree_theme_style_cursor_unfocused>` | |
  168. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  169. | :ref:`StyleBox<class_StyleBox>` | :ref:`custom_button<class_Tree_theme_style_custom_button>` | |
  170. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  171. | :ref:`StyleBox<class_StyleBox>` | :ref:`custom_button_hover<class_Tree_theme_style_custom_button_hover>` | |
  172. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  173. | :ref:`StyleBox<class_StyleBox>` | :ref:`custom_button_pressed<class_Tree_theme_style_custom_button_pressed>` | |
  174. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  175. | :ref:`StyleBox<class_StyleBox>` | :ref:`selected<class_Tree_theme_style_selected>` | |
  176. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  177. | :ref:`StyleBox<class_StyleBox>` | :ref:`selected_focus<class_Tree_theme_style_selected_focus>` | |
  178. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  179. | :ref:`StyleBox<class_StyleBox>` | :ref:`title_button_hover<class_Tree_theme_style_title_button_hover>` | |
  180. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  181. | :ref:`StyleBox<class_StyleBox>` | :ref:`title_button_normal<class_Tree_theme_style_title_button_normal>` | |
  182. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  183. | :ref:`StyleBox<class_StyleBox>` | :ref:`title_button_pressed<class_Tree_theme_style_title_button_pressed>` | |
  184. +---------------------------------+------------------------------------------------------------------------------------------+----------------------------------+
  185. .. rst-class:: classref-section-separator
  186. ----
  187. .. rst-class:: classref-descriptions-group
  188. Signals
  189. -------
  190. .. _class_Tree_signal_button_pressed:
  191. .. rst-class:: classref-signal
  192. **button_pressed** **(** :ref:`TreeItem<class_TreeItem>` item, :ref:`int<class_int>` column, :ref:`int<class_int>` id **)**
  193. Emitted when a button on the tree was pressed (see :ref:`TreeItem.add_button<class_TreeItem_method_add_button>`).
  194. .. rst-class:: classref-item-separator
  195. ----
  196. .. _class_Tree_signal_cell_selected:
  197. .. rst-class:: classref-signal
  198. **cell_selected** **(** **)**
  199. Emitted when a cell is selected.
  200. .. rst-class:: classref-item-separator
  201. ----
  202. .. _class_Tree_signal_column_title_pressed:
  203. .. rst-class:: classref-signal
  204. **column_title_pressed** **(** :ref:`int<class_int>` column **)**
  205. Emitted when a column's title is pressed.
  206. .. rst-class:: classref-item-separator
  207. ----
  208. .. _class_Tree_signal_custom_popup_edited:
  209. .. rst-class:: classref-signal
  210. **custom_popup_edited** **(** :ref:`bool<class_bool>` arrow_clicked **)**
  211. Emitted when a cell with the :ref:`TreeItem.CELL_MODE_CUSTOM<class_TreeItem_constant_CELL_MODE_CUSTOM>` is clicked to be edited.
  212. .. rst-class:: classref-item-separator
  213. ----
  214. .. _class_Tree_signal_empty_rmb:
  215. .. rst-class:: classref-signal
  216. **empty_rmb** **(** :ref:`Vector2<class_Vector2>` position **)**
  217. Emitted when the right mouse button is pressed in the empty space of the tree.
  218. .. rst-class:: classref-item-separator
  219. ----
  220. .. _class_Tree_signal_empty_tree_rmb_selected:
  221. .. rst-class:: classref-signal
  222. **empty_tree_rmb_selected** **(** :ref:`Vector2<class_Vector2>` position **)**
  223. Emitted when the right mouse button is pressed if right mouse button selection is active and the tree is empty.
  224. .. rst-class:: classref-item-separator
  225. ----
  226. .. _class_Tree_signal_item_activated:
  227. .. rst-class:: classref-signal
  228. **item_activated** **(** **)**
  229. Emitted when an item's label is double-clicked.
  230. .. rst-class:: classref-item-separator
  231. ----
  232. .. _class_Tree_signal_item_collapsed:
  233. .. rst-class:: classref-signal
  234. **item_collapsed** **(** :ref:`TreeItem<class_TreeItem>` item **)**
  235. Emitted when an item is collapsed by a click on the folding arrow.
  236. .. rst-class:: classref-item-separator
  237. ----
  238. .. _class_Tree_signal_item_custom_button_pressed:
  239. .. rst-class:: classref-signal
  240. **item_custom_button_pressed** **(** **)**
  241. Emitted when a custom button is pressed (i.e. in a :ref:`TreeItem.CELL_MODE_CUSTOM<class_TreeItem_constant_CELL_MODE_CUSTOM>` mode cell).
  242. .. rst-class:: classref-item-separator
  243. ----
  244. .. _class_Tree_signal_item_double_clicked:
  245. .. rst-class:: classref-signal
  246. **item_double_clicked** **(** **)**
  247. Emitted when an item's icon is double-clicked.
  248. .. rst-class:: classref-item-separator
  249. ----
  250. .. _class_Tree_signal_item_edited:
  251. .. rst-class:: classref-signal
  252. **item_edited** **(** **)**
  253. Emitted when an item is edited.
  254. .. rst-class:: classref-item-separator
  255. ----
  256. .. _class_Tree_signal_item_rmb_edited:
  257. .. rst-class:: classref-signal
  258. **item_rmb_edited** **(** **)**
  259. Emitted when an item is edited using the right mouse button.
  260. .. rst-class:: classref-item-separator
  261. ----
  262. .. _class_Tree_signal_item_rmb_selected:
  263. .. rst-class:: classref-signal
  264. **item_rmb_selected** **(** :ref:`Vector2<class_Vector2>` position **)**
  265. Emitted when an item is selected with the right mouse button.
  266. .. rst-class:: classref-item-separator
  267. ----
  268. .. _class_Tree_signal_item_selected:
  269. .. rst-class:: classref-signal
  270. **item_selected** **(** **)**
  271. Emitted when an item is selected.
  272. .. rst-class:: classref-item-separator
  273. ----
  274. .. _class_Tree_signal_multi_selected:
  275. .. rst-class:: classref-signal
  276. **multi_selected** **(** :ref:`TreeItem<class_TreeItem>` item, :ref:`int<class_int>` column, :ref:`bool<class_bool>` selected **)**
  277. Emitted instead of ``item_selected`` if ``select_mode`` is :ref:`SELECT_MULTI<class_Tree_constant_SELECT_MULTI>`.
  278. .. rst-class:: classref-item-separator
  279. ----
  280. .. _class_Tree_signal_nothing_selected:
  281. .. rst-class:: classref-signal
  282. **nothing_selected** **(** **)**
  283. Emitted when a left mouse button click does not select any item.
  284. .. rst-class:: classref-section-separator
  285. ----
  286. .. rst-class:: classref-descriptions-group
  287. Enumerations
  288. ------------
  289. .. _enum_Tree_SelectMode:
  290. .. rst-class:: classref-enumeration
  291. enum **SelectMode**:
  292. .. _class_Tree_constant_SELECT_SINGLE:
  293. .. rst-class:: classref-enumeration-constant
  294. :ref:`SelectMode<enum_Tree_SelectMode>` **SELECT_SINGLE** = ``0``
  295. Allows selection of a single cell at a time. From the perspective of items, only a single item is allowed to be selected. And there is only one column selected in the selected item.
  296. The focus cursor is always hidden in this mode, but it is positioned at the current selection, making the currently selected item the currently focused item.
  297. .. _class_Tree_constant_SELECT_ROW:
  298. .. rst-class:: classref-enumeration-constant
  299. :ref:`SelectMode<enum_Tree_SelectMode>` **SELECT_ROW** = ``1``
  300. Allows selection of a single row at a time. From the perspective of items, only a single items is allowed to be selected. And all the columns are selected in the selected item.
  301. The focus cursor is always hidden in this mode, but it is positioned at the first column of the current selection, making the currently selected item the currently focused item.
  302. .. _class_Tree_constant_SELECT_MULTI:
  303. .. rst-class:: classref-enumeration-constant
  304. :ref:`SelectMode<enum_Tree_SelectMode>` **SELECT_MULTI** = ``2``
  305. Allows selection of multiple cells at the same time. From the perspective of items, multiple items are allowed to be selected. And there can be multiple columns selected in each selected item.
  306. The focus cursor is visible in this mode, the item or column under the cursor is not necessarily selected.
  307. .. rst-class:: classref-item-separator
  308. ----
  309. .. _enum_Tree_DropModeFlags:
  310. .. rst-class:: classref-enumeration
  311. enum **DropModeFlags**:
  312. .. _class_Tree_constant_DROP_MODE_DISABLED:
  313. .. rst-class:: classref-enumeration-constant
  314. :ref:`DropModeFlags<enum_Tree_DropModeFlags>` **DROP_MODE_DISABLED** = ``0``
  315. Disables all drop sections, but still allows to detect the "on item" drop section by :ref:`get_drop_section_at_position<class_Tree_method_get_drop_section_at_position>`.
  316. \ **Note:** This is the default flag, it has no effect when combined with other flags.
  317. .. _class_Tree_constant_DROP_MODE_ON_ITEM:
  318. .. rst-class:: classref-enumeration-constant
  319. :ref:`DropModeFlags<enum_Tree_DropModeFlags>` **DROP_MODE_ON_ITEM** = ``1``
  320. Enables the "on item" drop section. This drop section covers the entire item.
  321. When combined with :ref:`DROP_MODE_INBETWEEN<class_Tree_constant_DROP_MODE_INBETWEEN>`, this drop section halves the height and stays centered vertically.
  322. .. _class_Tree_constant_DROP_MODE_INBETWEEN:
  323. .. rst-class:: classref-enumeration-constant
  324. :ref:`DropModeFlags<enum_Tree_DropModeFlags>` **DROP_MODE_INBETWEEN** = ``2``
  325. Enables "above item" and "below item" drop sections. The "above item" drop section covers the top half of the item, and the "below item" drop section covers the bottom half.
  326. When combined with :ref:`DROP_MODE_ON_ITEM<class_Tree_constant_DROP_MODE_ON_ITEM>`, these drop sections halves the height and stays on top / bottom accordingly.
  327. .. rst-class:: classref-section-separator
  328. ----
  329. .. rst-class:: classref-descriptions-group
  330. Property Descriptions
  331. ---------------------
  332. .. _class_Tree_property_allow_reselect:
  333. .. rst-class:: classref-property
  334. :ref:`bool<class_bool>` **allow_reselect** = ``false``
  335. .. rst-class:: classref-property-setget
  336. - void **set_allow_reselect** **(** :ref:`bool<class_bool>` value **)**
  337. - :ref:`bool<class_bool>` **get_allow_reselect** **(** **)**
  338. If ``true``, the currently selected cell may be selected again.
  339. .. rst-class:: classref-item-separator
  340. ----
  341. .. _class_Tree_property_allow_rmb_select:
  342. .. rst-class:: classref-property
  343. :ref:`bool<class_bool>` **allow_rmb_select** = ``false``
  344. .. rst-class:: classref-property-setget
  345. - void **set_allow_rmb_select** **(** :ref:`bool<class_bool>` value **)**
  346. - :ref:`bool<class_bool>` **get_allow_rmb_select** **(** **)**
  347. If ``true``, a right mouse button click can select items.
  348. .. rst-class:: classref-item-separator
  349. ----
  350. .. _class_Tree_property_column_titles_visible:
  351. .. rst-class:: classref-property
  352. :ref:`bool<class_bool>` **column_titles_visible** = ``false``
  353. .. rst-class:: classref-property-setget
  354. - void **set_column_titles_visible** **(** :ref:`bool<class_bool>` value **)**
  355. - :ref:`bool<class_bool>` **are_column_titles_visible** **(** **)**
  356. If ``true``, column titles are visible.
  357. .. rst-class:: classref-item-separator
  358. ----
  359. .. _class_Tree_property_columns:
  360. .. rst-class:: classref-property
  361. :ref:`int<class_int>` **columns** = ``1``
  362. .. rst-class:: classref-property-setget
  363. - void **set_columns** **(** :ref:`int<class_int>` value **)**
  364. - :ref:`int<class_int>` **get_columns** **(** **)**
  365. The number of columns.
  366. .. rst-class:: classref-item-separator
  367. ----
  368. .. _class_Tree_property_drop_mode_flags:
  369. .. rst-class:: classref-property
  370. :ref:`int<class_int>` **drop_mode_flags** = ``0``
  371. .. rst-class:: classref-property-setget
  372. - void **set_drop_mode_flags** **(** :ref:`int<class_int>` value **)**
  373. - :ref:`int<class_int>` **get_drop_mode_flags** **(** **)**
  374. The drop mode as an OR combination of flags. See :ref:`DropModeFlags<enum_Tree_DropModeFlags>` 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.
  375. This controls the drop sections, i.e. the decision and drawing of possible drop locations based on the mouse position.
  376. .. rst-class:: classref-item-separator
  377. ----
  378. .. _class_Tree_property_hide_folding:
  379. .. rst-class:: classref-property
  380. :ref:`bool<class_bool>` **hide_folding** = ``false``
  381. .. rst-class:: classref-property-setget
  382. - void **set_hide_folding** **(** :ref:`bool<class_bool>` value **)**
  383. - :ref:`bool<class_bool>` **is_folding_hidden** **(** **)**
  384. If ``true``, the folding arrow is hidden.
  385. .. rst-class:: classref-item-separator
  386. ----
  387. .. _class_Tree_property_hide_root:
  388. .. rst-class:: classref-property
  389. :ref:`bool<class_bool>` **hide_root** = ``false``
  390. .. rst-class:: classref-property-setget
  391. - void **set_hide_root** **(** :ref:`bool<class_bool>` value **)**
  392. - :ref:`bool<class_bool>` **is_root_hidden** **(** **)**
  393. If ``true``, the tree's root is hidden.
  394. .. rst-class:: classref-item-separator
  395. ----
  396. .. _class_Tree_property_select_mode:
  397. .. rst-class:: classref-property
  398. :ref:`SelectMode<enum_Tree_SelectMode>` **select_mode** = ``0``
  399. .. rst-class:: classref-property-setget
  400. - void **set_select_mode** **(** :ref:`SelectMode<enum_Tree_SelectMode>` value **)**
  401. - :ref:`SelectMode<enum_Tree_SelectMode>` **get_select_mode** **(** **)**
  402. Allows single or multiple selection. See the :ref:`SelectMode<enum_Tree_SelectMode>` constants.
  403. .. rst-class:: classref-section-separator
  404. ----
  405. .. rst-class:: classref-descriptions-group
  406. Method Descriptions
  407. -------------------
  408. .. _class_Tree_method_clear:
  409. .. rst-class:: classref-method
  410. void **clear** **(** **)**
  411. Clears the tree. This removes all items.
  412. .. rst-class:: classref-item-separator
  413. ----
  414. .. _class_Tree_method_create_item:
  415. .. rst-class:: classref-method
  416. :ref:`TreeItem<class_TreeItem>` **create_item** **(** :ref:`Object<class_Object>` parent=null, :ref:`int<class_int>` idx=-1 **)**
  417. Creates an item in the tree and adds it as a child of ``parent``, which can be either a valid :ref:`TreeItem<class_TreeItem>` or ``null``.
  418. If ``parent`` is ``null``, the root item will be the parent, or the new item will be the root itself if the tree is empty.
  419. The new item will be the ``idx``\ th child of parent, or it will be the last child if there are not enough siblings.
  420. .. rst-class:: classref-item-separator
  421. ----
  422. .. _class_Tree_method_edit_selected:
  423. .. rst-class:: classref-method
  424. :ref:`bool<class_bool>` **edit_selected** **(** **)**
  425. Edits the selected tree item as if it was clicked. The item must be set editable with :ref:`TreeItem.set_editable<class_TreeItem_method_set_editable>`. Returns ``true`` if the item could be edited. Fails if no item is selected.
  426. .. rst-class:: classref-item-separator
  427. ----
  428. .. _class_Tree_method_ensure_cursor_is_visible:
  429. .. rst-class:: classref-method
  430. void **ensure_cursor_is_visible** **(** **)**
  431. Makes the currently focused cell visible.
  432. This will scroll the tree if necessary. In :ref:`SELECT_ROW<class_Tree_constant_SELECT_ROW>` mode, this will not do horizontal scrolling, as all the cells in the selected row is focused logically.
  433. \ **Note:** Despite the name of this method, the focus cursor itself is only visible in :ref:`SELECT_MULTI<class_Tree_constant_SELECT_MULTI>` mode.
  434. .. rst-class:: classref-item-separator
  435. ----
  436. .. _class_Tree_method_get_button_id_at_position:
  437. .. rst-class:: classref-method
  438. :ref:`int<class_int>` **get_button_id_at_position** **(** :ref:`Vector2<class_Vector2>` position **)** |const|
  439. Returns the button id at ``position``, or -1 if no button is there.
  440. .. rst-class:: classref-item-separator
  441. ----
  442. .. _class_Tree_method_get_column_at_position:
  443. .. rst-class:: classref-method
  444. :ref:`int<class_int>` **get_column_at_position** **(** :ref:`Vector2<class_Vector2>` position **)** |const|
  445. Returns the column index at ``position``, or -1 if no item is there.
  446. .. rst-class:: classref-item-separator
  447. ----
  448. .. _class_Tree_method_get_column_title:
  449. .. rst-class:: classref-method
  450. :ref:`String<class_String>` **get_column_title** **(** :ref:`int<class_int>` column **)** |const|
  451. Returns the column's title.
  452. .. rst-class:: classref-item-separator
  453. ----
  454. .. _class_Tree_method_get_column_width:
  455. .. rst-class:: classref-method
  456. :ref:`int<class_int>` **get_column_width** **(** :ref:`int<class_int>` column **)** |const|
  457. Returns the column's width in pixels.
  458. .. rst-class:: classref-item-separator
  459. ----
  460. .. _class_Tree_method_get_custom_popup_rect:
  461. .. rst-class:: classref-method
  462. :ref:`Rect2<class_Rect2>` **get_custom_popup_rect** **(** **)** |const|
  463. 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>`.
  464. .. rst-class:: classref-item-separator
  465. ----
  466. .. _class_Tree_method_get_drop_section_at_position:
  467. .. rst-class:: classref-method
  468. :ref:`int<class_int>` **get_drop_section_at_position** **(** :ref:`Vector2<class_Vector2>` position **)** |const|
  469. Returns the drop section at ``position``, or -100 if no item is there.
  470. Values -1, 0, or 1 will be returned for the "above item", "on item", and "below item" drop sections, respectively. See :ref:`DropModeFlags<enum_Tree_DropModeFlags>` for a description of each drop section.
  471. To get the item which the returned drop section is relative to, use :ref:`get_item_at_position<class_Tree_method_get_item_at_position>`.
  472. .. rst-class:: classref-item-separator
  473. ----
  474. .. _class_Tree_method_get_edited:
  475. .. rst-class:: classref-method
  476. :ref:`TreeItem<class_TreeItem>` **get_edited** **(** **)** |const|
  477. Returns the currently edited item. Can be used with :ref:`item_edited<class_Tree_signal_item_edited>` to get the item that was modified.
  478. ::
  479. func _ready():
  480. $Tree.connect("item_edited", self, "on_Tree_item_edited")
  481. func on_Tree_item_edited():
  482. print($Tree.get_edited()) # This item just got edited (e.g. checked).
  483. .. rst-class:: classref-item-separator
  484. ----
  485. .. _class_Tree_method_get_edited_column:
  486. .. rst-class:: classref-method
  487. :ref:`int<class_int>` **get_edited_column** **(** **)** |const|
  488. Returns the column for the currently edited item.
  489. .. rst-class:: classref-item-separator
  490. ----
  491. .. _class_Tree_method_get_item_area_rect:
  492. .. rst-class:: classref-method
  493. :ref:`Rect2<class_Rect2>` **get_item_area_rect** **(** :ref:`Object<class_Object>` item, :ref:`int<class_int>` column=-1 **)** |const|
  494. Returns the rectangle area for the specified :ref:`TreeItem<class_TreeItem>`. If ``column`` is specified, only get the position and size of that column, otherwise get the rectangle containing all columns.
  495. .. rst-class:: classref-item-separator
  496. ----
  497. .. _class_Tree_method_get_item_at_position:
  498. .. rst-class:: classref-method
  499. :ref:`TreeItem<class_TreeItem>` **get_item_at_position** **(** :ref:`Vector2<class_Vector2>` position **)** |const|
  500. Returns the tree item at the specified position (relative to the tree origin position).
  501. .. rst-class:: classref-item-separator
  502. ----
  503. .. _class_Tree_method_get_next_selected:
  504. .. rst-class:: classref-method
  505. :ref:`TreeItem<class_TreeItem>` **get_next_selected** **(** :ref:`Object<class_Object>` from **)**
  506. Returns the next selected :ref:`TreeItem<class_TreeItem>` after the given one, or ``null`` if the end is reached.
  507. If ``from`` is ``null``, this returns the first selected item.
  508. .. rst-class:: classref-item-separator
  509. ----
  510. .. _class_Tree_method_get_pressed_button:
  511. .. rst-class:: classref-method
  512. :ref:`int<class_int>` **get_pressed_button** **(** **)** |const|
  513. Returns the last pressed button's index.
  514. .. rst-class:: classref-item-separator
  515. ----
  516. .. _class_Tree_method_get_root:
  517. .. rst-class:: classref-method
  518. :ref:`TreeItem<class_TreeItem>` **get_root** **(** **)**
  519. Returns the tree's root item, or ``null`` if the tree is empty.
  520. .. rst-class:: classref-item-separator
  521. ----
  522. .. _class_Tree_method_get_scroll:
  523. .. rst-class:: classref-method
  524. :ref:`Vector2<class_Vector2>` **get_scroll** **(** **)** |const|
  525. Returns the current scrolling position.
  526. .. rst-class:: classref-item-separator
  527. ----
  528. .. _class_Tree_method_get_selected:
  529. .. rst-class:: classref-method
  530. :ref:`TreeItem<class_TreeItem>` **get_selected** **(** **)** |const|
  531. Returns the currently focused item, or ``null`` if no item is focused.
  532. In :ref:`SELECT_ROW<class_Tree_constant_SELECT_ROW>` and :ref:`SELECT_SINGLE<class_Tree_constant_SELECT_SINGLE>` modes, the focused item is same as the selected item. In :ref:`SELECT_MULTI<class_Tree_constant_SELECT_MULTI>` mode, the focused item is the item under the focus cursor, not necessarily selected.
  533. To get the currently selected item(s), use :ref:`get_next_selected<class_Tree_method_get_next_selected>`.
  534. .. rst-class:: classref-item-separator
  535. ----
  536. .. _class_Tree_method_get_selected_column:
  537. .. rst-class:: classref-method
  538. :ref:`int<class_int>` **get_selected_column** **(** **)** |const|
  539. Returns the currently focused column, or -1 if no column is focused.
  540. In :ref:`SELECT_SINGLE<class_Tree_constant_SELECT_SINGLE>` mode, the focused column is the selected column. In :ref:`SELECT_ROW<class_Tree_constant_SELECT_ROW>` mode, the focused column is always 0 if any item is selected. In :ref:`SELECT_MULTI<class_Tree_constant_SELECT_MULTI>` mode, the focused column is the column under the focus cursor, and there are not necessarily any column selected.
  541. To tell whether a column of an item is selected, use :ref:`TreeItem.is_selected<class_TreeItem_method_is_selected>`.
  542. .. rst-class:: classref-item-separator
  543. ----
  544. .. _class_Tree_method_scroll_to_item:
  545. .. rst-class:: classref-method
  546. void **scroll_to_item** **(** :ref:`Object<class_Object>` item **)**
  547. Causes the **Tree** to jump to the specified :ref:`TreeItem<class_TreeItem>`.
  548. .. rst-class:: classref-item-separator
  549. ----
  550. .. _class_Tree_method_set_column_expand:
  551. .. rst-class:: classref-method
  552. void **set_column_expand** **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` expand **)**
  553. 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>`.
  554. .. rst-class:: classref-item-separator
  555. ----
  556. .. _class_Tree_method_set_column_min_width:
  557. .. rst-class:: classref-method
  558. void **set_column_min_width** **(** :ref:`int<class_int>` column, :ref:`int<class_int>` min_width **)**
  559. 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>`.
  560. .. rst-class:: classref-item-separator
  561. ----
  562. .. _class_Tree_method_set_column_title:
  563. .. rst-class:: classref-method
  564. void **set_column_title** **(** :ref:`int<class_int>` column, :ref:`String<class_String>` title **)**
  565. Sets the title of a column.
  566. .. rst-class:: classref-section-separator
  567. ----
  568. .. rst-class:: classref-descriptions-group
  569. Theme Property Descriptions
  570. ---------------------------
  571. .. _class_Tree_theme_color_custom_button_font_highlight:
  572. .. rst-class:: classref-themeproperty
  573. :ref:`Color<class_Color>` **custom_button_font_highlight** = ``Color( 0.94, 0.94, 0.94, 1 )``
  574. Text :ref:`Color<class_Color>` for a :ref:`TreeItem.CELL_MODE_CUSTOM<class_TreeItem_constant_CELL_MODE_CUSTOM>` mode cell when it's hovered.
  575. .. rst-class:: classref-item-separator
  576. ----
  577. .. _class_Tree_theme_color_drop_position_color:
  578. .. rst-class:: classref-themeproperty
  579. :ref:`Color<class_Color>` **drop_position_color** = ``Color( 1, 0.3, 0.2, 1 )``
  580. :ref:`Color<class_Color>` used to draw possible drop locations. See :ref:`DropModeFlags<enum_Tree_DropModeFlags>` constants for further description of drop locations.
  581. .. rst-class:: classref-item-separator
  582. ----
  583. .. _class_Tree_theme_color_font_color:
  584. .. rst-class:: classref-themeproperty
  585. :ref:`Color<class_Color>` **font_color** = ``Color( 0.69, 0.69, 0.69, 1 )``
  586. Default text :ref:`Color<class_Color>` of the item.
  587. .. rst-class:: classref-item-separator
  588. ----
  589. .. _class_Tree_theme_color_font_color_selected:
  590. .. rst-class:: classref-themeproperty
  591. :ref:`Color<class_Color>` **font_color_selected** = ``Color( 1, 1, 1, 1 )``
  592. Text :ref:`Color<class_Color>` used when the item is selected.
  593. .. rst-class:: classref-item-separator
  594. ----
  595. .. _class_Tree_theme_color_guide_color:
  596. .. rst-class:: classref-themeproperty
  597. :ref:`Color<class_Color>` **guide_color** = ``Color( 0, 0, 0, 0.1 )``
  598. :ref:`Color<class_Color>` of the guideline.
  599. .. rst-class:: classref-item-separator
  600. ----
  601. .. _class_Tree_theme_color_relationship_line_color:
  602. .. rst-class:: classref-themeproperty
  603. :ref:`Color<class_Color>` **relationship_line_color** = ``Color( 0.27, 0.27, 0.27, 1 )``
  604. :ref:`Color<class_Color>` of the relationship lines.
  605. .. rst-class:: classref-item-separator
  606. ----
  607. .. _class_Tree_theme_color_title_button_color:
  608. .. rst-class:: classref-themeproperty
  609. :ref:`Color<class_Color>` **title_button_color** = ``Color( 0.88, 0.88, 0.88, 1 )``
  610. Default text :ref:`Color<class_Color>` of the title button.
  611. .. rst-class:: classref-item-separator
  612. ----
  613. .. _class_Tree_theme_constant_button_margin:
  614. .. rst-class:: classref-themeproperty
  615. :ref:`int<class_int>` **button_margin** = ``4``
  616. The horizontal space between each button in a cell.
  617. .. rst-class:: classref-item-separator
  618. ----
  619. .. _class_Tree_theme_constant_draw_guides:
  620. .. rst-class:: classref-themeproperty
  621. :ref:`int<class_int>` **draw_guides** = ``1``
  622. Draws the guidelines if not zero, this acts as a boolean. The guideline is a horizontal line drawn at the bottom of each item.
  623. .. rst-class:: classref-item-separator
  624. ----
  625. .. _class_Tree_theme_constant_draw_relationship_lines:
  626. .. rst-class:: classref-themeproperty
  627. :ref:`int<class_int>` **draw_relationship_lines** = ``0``
  628. Draws the relationship lines if not zero, this acts as a boolean. Relationship lines are drawn at the start of child items to show hierarchy.
  629. .. rst-class:: classref-item-separator
  630. ----
  631. .. _class_Tree_theme_constant_hseparation:
  632. .. rst-class:: classref-themeproperty
  633. :ref:`int<class_int>` **hseparation** = ``4``
  634. The horizontal space between item cells. This is also used as the margin at the start of an item when folding is disabled.
  635. .. rst-class:: classref-item-separator
  636. ----
  637. .. _class_Tree_theme_constant_item_margin:
  638. .. rst-class:: classref-themeproperty
  639. :ref:`int<class_int>` **item_margin** = ``12``
  640. The horizontal margin at the start of an item. This is used when folding is enabled for the item.
  641. .. rst-class:: classref-item-separator
  642. ----
  643. .. _class_Tree_theme_constant_scroll_border:
  644. .. rst-class:: classref-themeproperty
  645. :ref:`int<class_int>` **scroll_border** = ``4``
  646. The maximum distance between the mouse cursor and the control's border to trigger border scrolling when dragging.
  647. .. rst-class:: classref-item-separator
  648. ----
  649. .. _class_Tree_theme_constant_scroll_speed:
  650. .. rst-class:: classref-themeproperty
  651. :ref:`int<class_int>` **scroll_speed** = ``12``
  652. The speed of border scrolling.
  653. .. rst-class:: classref-item-separator
  654. ----
  655. .. _class_Tree_theme_constant_vseparation:
  656. .. rst-class:: classref-themeproperty
  657. :ref:`int<class_int>` **vseparation** = ``4``
  658. The vertical padding inside each item, i.e. the distance between the item's content and top/bottom border.
  659. .. rst-class:: classref-item-separator
  660. ----
  661. .. _class_Tree_theme_font_font:
  662. .. rst-class:: classref-themeproperty
  663. :ref:`Font<class_Font>` **font**
  664. :ref:`Font<class_Font>` of the item's text.
  665. .. rst-class:: classref-item-separator
  666. ----
  667. .. _class_Tree_theme_font_title_button_font:
  668. .. rst-class:: classref-themeproperty
  669. :ref:`Font<class_Font>` **title_button_font**
  670. :ref:`Font<class_Font>` of the title button's text.
  671. .. rst-class:: classref-item-separator
  672. ----
  673. .. _class_Tree_theme_icon_arrow:
  674. .. rst-class:: classref-themeproperty
  675. :ref:`Texture<class_Texture>` **arrow**
  676. The arrow icon used when a foldable item is not collapsed.
  677. .. rst-class:: classref-item-separator
  678. ----
  679. .. _class_Tree_theme_icon_arrow_collapsed:
  680. .. rst-class:: classref-themeproperty
  681. :ref:`Texture<class_Texture>` **arrow_collapsed**
  682. The arrow icon used when a foldable item is collapsed.
  683. .. rst-class:: classref-item-separator
  684. ----
  685. .. _class_Tree_theme_icon_checked:
  686. .. rst-class:: classref-themeproperty
  687. :ref:`Texture<class_Texture>` **checked**
  688. The check icon to display when the :ref:`TreeItem.CELL_MODE_CHECK<class_TreeItem_constant_CELL_MODE_CHECK>` mode cell is checked.
  689. .. rst-class:: classref-item-separator
  690. ----
  691. .. _class_Tree_theme_icon_select_arrow:
  692. .. rst-class:: classref-themeproperty
  693. :ref:`Texture<class_Texture>` **select_arrow**
  694. The arrow icon to display for the :ref:`TreeItem.CELL_MODE_RANGE<class_TreeItem_constant_CELL_MODE_RANGE>` mode cell.
  695. .. rst-class:: classref-item-separator
  696. ----
  697. .. _class_Tree_theme_icon_unchecked:
  698. .. rst-class:: classref-themeproperty
  699. :ref:`Texture<class_Texture>` **unchecked**
  700. The check icon to display when the :ref:`TreeItem.CELL_MODE_CHECK<class_TreeItem_constant_CELL_MODE_CHECK>` mode cell is unchecked.
  701. .. rst-class:: classref-item-separator
  702. ----
  703. .. _class_Tree_theme_icon_updown:
  704. .. rst-class:: classref-themeproperty
  705. :ref:`Texture<class_Texture>` **updown**
  706. The updown arrow icon to display for the :ref:`TreeItem.CELL_MODE_RANGE<class_TreeItem_constant_CELL_MODE_RANGE>` mode cell.
  707. .. rst-class:: classref-item-separator
  708. ----
  709. .. _class_Tree_theme_style_bg:
  710. .. rst-class:: classref-themeproperty
  711. :ref:`StyleBox<class_StyleBox>` **bg**
  712. Default :ref:`StyleBox<class_StyleBox>` for the **Tree**, i.e. used when the control is not being focused.
  713. .. rst-class:: classref-item-separator
  714. ----
  715. .. _class_Tree_theme_style_bg_focus:
  716. .. rst-class:: classref-themeproperty
  717. :ref:`StyleBox<class_StyleBox>` **bg_focus**
  718. :ref:`StyleBox<class_StyleBox>` used when the **Tree** is being focused.
  719. .. rst-class:: classref-item-separator
  720. ----
  721. .. _class_Tree_theme_style_button_pressed:
  722. .. rst-class:: classref-themeproperty
  723. :ref:`StyleBox<class_StyleBox>` **button_pressed**
  724. :ref:`StyleBox<class_StyleBox>` used when a button in the tree is pressed.
  725. .. rst-class:: classref-item-separator
  726. ----
  727. .. _class_Tree_theme_style_cursor:
  728. .. rst-class:: classref-themeproperty
  729. :ref:`StyleBox<class_StyleBox>` **cursor**
  730. :ref:`StyleBox<class_StyleBox>` used for the cursor, when the **Tree** is being focused.
  731. .. rst-class:: classref-item-separator
  732. ----
  733. .. _class_Tree_theme_style_cursor_unfocused:
  734. .. rst-class:: classref-themeproperty
  735. :ref:`StyleBox<class_StyleBox>` **cursor_unfocused**
  736. :ref:`StyleBox<class_StyleBox>` used for the cursor, when the **Tree** is not being focused.
  737. .. rst-class:: classref-item-separator
  738. ----
  739. .. _class_Tree_theme_style_custom_button:
  740. .. rst-class:: classref-themeproperty
  741. :ref:`StyleBox<class_StyleBox>` **custom_button**
  742. Default :ref:`StyleBox<class_StyleBox>` for a :ref:`TreeItem.CELL_MODE_CUSTOM<class_TreeItem_constant_CELL_MODE_CUSTOM>` mode cell.
  743. .. rst-class:: classref-item-separator
  744. ----
  745. .. _class_Tree_theme_style_custom_button_hover:
  746. .. rst-class:: classref-themeproperty
  747. :ref:`StyleBox<class_StyleBox>` **custom_button_hover**
  748. :ref:`StyleBox<class_StyleBox>` for a :ref:`TreeItem.CELL_MODE_CUSTOM<class_TreeItem_constant_CELL_MODE_CUSTOM>` mode cell when it's hovered.
  749. .. rst-class:: classref-item-separator
  750. ----
  751. .. _class_Tree_theme_style_custom_button_pressed:
  752. .. rst-class:: classref-themeproperty
  753. :ref:`StyleBox<class_StyleBox>` **custom_button_pressed**
  754. :ref:`StyleBox<class_StyleBox>` for a :ref:`TreeItem.CELL_MODE_CUSTOM<class_TreeItem_constant_CELL_MODE_CUSTOM>` mode cell when it's pressed.
  755. .. rst-class:: classref-item-separator
  756. ----
  757. .. _class_Tree_theme_style_selected:
  758. .. rst-class:: classref-themeproperty
  759. :ref:`StyleBox<class_StyleBox>` **selected**
  760. :ref:`StyleBox<class_StyleBox>` for the selected items, used when the **Tree** is not being focused.
  761. .. rst-class:: classref-item-separator
  762. ----
  763. .. _class_Tree_theme_style_selected_focus:
  764. .. rst-class:: classref-themeproperty
  765. :ref:`StyleBox<class_StyleBox>` **selected_focus**
  766. :ref:`StyleBox<class_StyleBox>` for the selected items, used when the **Tree** is being focused.
  767. .. rst-class:: classref-item-separator
  768. ----
  769. .. _class_Tree_theme_style_title_button_hover:
  770. .. rst-class:: classref-themeproperty
  771. :ref:`StyleBox<class_StyleBox>` **title_button_hover**
  772. :ref:`StyleBox<class_StyleBox>` used when the title button is being hovered.
  773. .. rst-class:: classref-item-separator
  774. ----
  775. .. _class_Tree_theme_style_title_button_normal:
  776. .. rst-class:: classref-themeproperty
  777. :ref:`StyleBox<class_StyleBox>` **title_button_normal**
  778. Default :ref:`StyleBox<class_StyleBox>` for the title button.
  779. .. rst-class:: classref-item-separator
  780. ----
  781. .. _class_Tree_theme_style_title_button_pressed:
  782. .. rst-class:: classref-themeproperty
  783. :ref:`StyleBox<class_StyleBox>` **title_button_pressed**
  784. :ref:`StyleBox<class_StyleBox>` used when the title button is being pressed.
  785. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  786. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  787. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  788. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`