class_tree.rst 60 KB

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