class_tree.rst 94 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/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. A control used to show a set of internal :ref:`TreeItem<class_TreeItem>`\ s in a hierarchical structure.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. A control used to show a set of internal :ref:`TreeItem<class_TreeItem>`\ s in a hierarchical structure. The tree items can be selected, expanded and collapsed. The tree can have multiple columns with custom controls like :ref:`LineEdit<class_LineEdit>`\ s, 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 with :ref:`hide_root<class_Tree_property_hide_root>`:
  16. .. tabs::
  17. .. code-tab:: gdscript
  18. func _ready():
  19. var tree = Tree.new()
  20. var root = tree.create_item()
  21. tree.hide_root = true
  22. var child1 = tree.create_item(root)
  23. var child2 = tree.create_item(root)
  24. var subchild1 = tree.create_item(child1)
  25. subchild1.set_text(0, "Subchild1")
  26. .. code-tab:: csharp
  27. public override void _Ready()
  28. {
  29. var tree = new Tree();
  30. TreeItem root = tree.CreateItem();
  31. tree.HideRoot = true;
  32. TreeItem child1 = tree.CreateItem(root);
  33. TreeItem child2 = tree.CreateItem(root);
  34. TreeItem subchild1 = tree.CreateItem(child1);
  35. subchild1.SetText(0, "Subchild1");
  36. }
  37. 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_first_child<class_TreeItem_method_get_first_child>` 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**.
  38. \ **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>`.
  39. .. rst-class:: classref-reftable-group
  40. Properties
  41. ----------
  42. .. table::
  43. :widths: auto
  44. +------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  45. | :ref:`bool<class_bool>` | :ref:`allow_reselect<class_Tree_property_allow_reselect>` | ``false`` |
  46. +------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  47. | :ref:`bool<class_bool>` | :ref:`allow_rmb_select<class_Tree_property_allow_rmb_select>` | ``false`` |
  48. +------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  49. | :ref:`bool<class_bool>` | :ref:`allow_search<class_Tree_property_allow_search>` | ``true`` |
  50. +------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  51. | :ref:`bool<class_bool>` | clip_contents | ``true`` (overrides :ref:`Control<class_Control_property_clip_contents>`) |
  52. +------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  53. | :ref:`bool<class_bool>` | :ref:`column_titles_visible<class_Tree_property_column_titles_visible>` | ``false`` |
  54. +------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  55. | :ref:`int<class_int>` | :ref:`columns<class_Tree_property_columns>` | ``1`` |
  56. +------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  57. | :ref:`int<class_int>` | :ref:`drop_mode_flags<class_Tree_property_drop_mode_flags>` | ``0`` |
  58. +------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  59. | :ref:`bool<class_bool>` | :ref:`enable_recursive_folding<class_Tree_property_enable_recursive_folding>` | ``true`` |
  60. +------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  61. | :ref:`FocusMode<enum_Control_FocusMode>` | focus_mode | ``2`` (overrides :ref:`Control<class_Control_property_focus_mode>`) |
  62. +------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  63. | :ref:`bool<class_bool>` | :ref:`hide_folding<class_Tree_property_hide_folding>` | ``false`` |
  64. +------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  65. | :ref:`bool<class_bool>` | :ref:`hide_root<class_Tree_property_hide_root>` | ``false`` |
  66. +------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  67. | :ref:`bool<class_bool>` | :ref:`scroll_horizontal_enabled<class_Tree_property_scroll_horizontal_enabled>` | ``true`` |
  68. +------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  69. | :ref:`bool<class_bool>` | :ref:`scroll_vertical_enabled<class_Tree_property_scroll_vertical_enabled>` | ``true`` |
  70. +------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  71. | :ref:`SelectMode<enum_Tree_SelectMode>` | :ref:`select_mode<class_Tree_property_select_mode>` | ``0`` |
  72. +------------------------------------------+---------------------------------------------------------------------------------+---------------------------------------------------------------------------+
  73. .. rst-class:: classref-reftable-group
  74. Methods
  75. -------
  76. .. table::
  77. :widths: auto
  78. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | void | :ref:`clear<class_Tree_method_clear>` **(** **)** |
  80. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | :ref:`TreeItem<class_TreeItem>` | :ref:`create_item<class_Tree_method_create_item>` **(** :ref:`TreeItem<class_TreeItem>` parent=null, :ref:`int<class_int>` index=-1 **)** |
  82. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | void | :ref:`deselect_all<class_Tree_method_deselect_all>` **(** **)** |
  84. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | :ref:`bool<class_bool>` | :ref:`edit_selected<class_Tree_method_edit_selected>` **(** :ref:`bool<class_bool>` force_edit=false **)** |
  86. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | void | :ref:`ensure_cursor_is_visible<class_Tree_method_ensure_cursor_is_visible>` **(** **)** |
  88. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | :ref:`int<class_int>` | :ref:`get_button_id_at_position<class_Tree_method_get_button_id_at_position>` **(** :ref:`Vector2<class_Vector2>` position **)** |const| |
  90. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | :ref:`int<class_int>` | :ref:`get_column_at_position<class_Tree_method_get_column_at_position>` **(** :ref:`Vector2<class_Vector2>` position **)** |const| |
  92. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | :ref:`int<class_int>` | :ref:`get_column_expand_ratio<class_Tree_method_get_column_expand_ratio>` **(** :ref:`int<class_int>` column **)** |const| |
  94. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | :ref:`String<class_String>` | :ref:`get_column_title<class_Tree_method_get_column_title>` **(** :ref:`int<class_int>` column **)** |const| |
  96. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` | :ref:`get_column_title_alignment<class_Tree_method_get_column_title_alignment>` **(** :ref:`int<class_int>` column **)** |const| |
  98. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | :ref:`TextDirection<enum_Control_TextDirection>` | :ref:`get_column_title_direction<class_Tree_method_get_column_title_direction>` **(** :ref:`int<class_int>` column **)** |const| |
  100. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | :ref:`String<class_String>` | :ref:`get_column_title_language<class_Tree_method_get_column_title_language>` **(** :ref:`int<class_int>` column **)** |const| |
  102. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | :ref:`int<class_int>` | :ref:`get_column_width<class_Tree_method_get_column_width>` **(** :ref:`int<class_int>` column **)** |const| |
  104. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | :ref:`Rect2<class_Rect2>` | :ref:`get_custom_popup_rect<class_Tree_method_get_custom_popup_rect>` **(** **)** |const| |
  106. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. | :ref:`int<class_int>` | :ref:`get_drop_section_at_position<class_Tree_method_get_drop_section_at_position>` **(** :ref:`Vector2<class_Vector2>` position **)** |const| |
  108. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  109. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_edited<class_Tree_method_get_edited>` **(** **)** |const| |
  110. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  111. | :ref:`int<class_int>` | :ref:`get_edited_column<class_Tree_method_get_edited_column>` **(** **)** |const| |
  112. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  113. | :ref:`Rect2<class_Rect2>` | :ref:`get_item_area_rect<class_Tree_method_get_item_area_rect>` **(** :ref:`TreeItem<class_TreeItem>` item, :ref:`int<class_int>` column=-1, :ref:`int<class_int>` button_index=-1 **)** |const| |
  114. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  115. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_item_at_position<class_Tree_method_get_item_at_position>` **(** :ref:`Vector2<class_Vector2>` position **)** |const| |
  116. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  117. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_next_selected<class_Tree_method_get_next_selected>` **(** :ref:`TreeItem<class_TreeItem>` from **)** |
  118. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  119. | :ref:`int<class_int>` | :ref:`get_pressed_button<class_Tree_method_get_pressed_button>` **(** **)** |const| |
  120. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  121. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_root<class_Tree_method_get_root>` **(** **)** |const| |
  122. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  123. | :ref:`Vector2<class_Vector2>` | :ref:`get_scroll<class_Tree_method_get_scroll>` **(** **)** |const| |
  124. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  125. | :ref:`TreeItem<class_TreeItem>` | :ref:`get_selected<class_Tree_method_get_selected>` **(** **)** |const| |
  126. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  127. | :ref:`int<class_int>` | :ref:`get_selected_column<class_Tree_method_get_selected_column>` **(** **)** |const| |
  128. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  129. | :ref:`bool<class_bool>` | :ref:`is_column_clipping_content<class_Tree_method_is_column_clipping_content>` **(** :ref:`int<class_int>` column **)** |const| |
  130. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  131. | :ref:`bool<class_bool>` | :ref:`is_column_expanding<class_Tree_method_is_column_expanding>` **(** :ref:`int<class_int>` column **)** |const| |
  132. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  133. | void | :ref:`scroll_to_item<class_Tree_method_scroll_to_item>` **(** :ref:`TreeItem<class_TreeItem>` item, :ref:`bool<class_bool>` center_on_item=false **)** |
  134. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  135. | void | :ref:`set_column_clip_content<class_Tree_method_set_column_clip_content>` **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` enable **)** |
  136. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  137. | void | :ref:`set_column_custom_minimum_width<class_Tree_method_set_column_custom_minimum_width>` **(** :ref:`int<class_int>` column, :ref:`int<class_int>` min_width **)** |
  138. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  139. | void | :ref:`set_column_expand<class_Tree_method_set_column_expand>` **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` expand **)** |
  140. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  141. | void | :ref:`set_column_expand_ratio<class_Tree_method_set_column_expand_ratio>` **(** :ref:`int<class_int>` column, :ref:`int<class_int>` ratio **)** |
  142. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  143. | void | :ref:`set_column_title<class_Tree_method_set_column_title>` **(** :ref:`int<class_int>` column, :ref:`String<class_String>` title **)** |
  144. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  145. | void | :ref:`set_column_title_alignment<class_Tree_method_set_column_title_alignment>` **(** :ref:`int<class_int>` column, :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` title_alignment **)** |
  146. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  147. | void | :ref:`set_column_title_direction<class_Tree_method_set_column_title_direction>` **(** :ref:`int<class_int>` column, :ref:`TextDirection<enum_Control_TextDirection>` direction **)** |
  148. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  149. | void | :ref:`set_column_title_language<class_Tree_method_set_column_title_language>` **(** :ref:`int<class_int>` column, :ref:`String<class_String>` language **)** |
  150. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  151. | void | :ref:`set_selected<class_Tree_method_set_selected>` **(** :ref:`TreeItem<class_TreeItem>` item, :ref:`int<class_int>` column **)** |
  152. +-------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  153. .. rst-class:: classref-reftable-group
  154. Theme Properties
  155. ----------------
  156. .. table::
  157. :widths: auto
  158. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  159. | :ref:`Color<class_Color>` | :ref:`children_hl_line_color<class_Tree_theme_color_children_hl_line_color>` | ``Color(0.27, 0.27, 0.27, 1)`` |
  160. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  161. | :ref:`Color<class_Color>` | :ref:`custom_button_font_highlight<class_Tree_theme_color_custom_button_font_highlight>` | ``Color(0.95, 0.95, 0.95, 1)`` |
  162. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  163. | :ref:`Color<class_Color>` | :ref:`drop_position_color<class_Tree_theme_color_drop_position_color>` | ``Color(1, 1, 1, 1)`` |
  164. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  165. | :ref:`Color<class_Color>` | :ref:`font_color<class_Tree_theme_color_font_color>` | ``Color(0.7, 0.7, 0.7, 1)`` |
  166. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  167. | :ref:`Color<class_Color>` | :ref:`font_outline_color<class_Tree_theme_color_font_outline_color>` | ``Color(1, 1, 1, 1)`` |
  168. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  169. | :ref:`Color<class_Color>` | :ref:`font_selected_color<class_Tree_theme_color_font_selected_color>` | ``Color(1, 1, 1, 1)`` |
  170. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  171. | :ref:`Color<class_Color>` | :ref:`guide_color<class_Tree_theme_color_guide_color>` | ``Color(0.7, 0.7, 0.7, 0.25)`` |
  172. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  173. | :ref:`Color<class_Color>` | :ref:`parent_hl_line_color<class_Tree_theme_color_parent_hl_line_color>` | ``Color(0.27, 0.27, 0.27, 1)`` |
  174. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  175. | :ref:`Color<class_Color>` | :ref:`relationship_line_color<class_Tree_theme_color_relationship_line_color>` | ``Color(0.27, 0.27, 0.27, 1)`` |
  176. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  177. | :ref:`Color<class_Color>` | :ref:`title_button_color<class_Tree_theme_color_title_button_color>` | ``Color(0.875, 0.875, 0.875, 1)`` |
  178. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  179. | :ref:`int<class_int>` | :ref:`button_margin<class_Tree_theme_constant_button_margin>` | ``4`` |
  180. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  181. | :ref:`int<class_int>` | :ref:`children_hl_line_width<class_Tree_theme_constant_children_hl_line_width>` | ``1`` |
  182. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  183. | :ref:`int<class_int>` | :ref:`draw_guides<class_Tree_theme_constant_draw_guides>` | ``1`` |
  184. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  185. | :ref:`int<class_int>` | :ref:`draw_relationship_lines<class_Tree_theme_constant_draw_relationship_lines>` | ``0`` |
  186. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  187. | :ref:`int<class_int>` | :ref:`h_separation<class_Tree_theme_constant_h_separation>` | ``4`` |
  188. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  189. | :ref:`int<class_int>` | :ref:`icon_max_width<class_Tree_theme_constant_icon_max_width>` | ``0`` |
  190. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  191. | :ref:`int<class_int>` | :ref:`inner_item_margin_bottom<class_Tree_theme_constant_inner_item_margin_bottom>` | ``0`` |
  192. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  193. | :ref:`int<class_int>` | :ref:`inner_item_margin_left<class_Tree_theme_constant_inner_item_margin_left>` | ``0`` |
  194. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  195. | :ref:`int<class_int>` | :ref:`inner_item_margin_right<class_Tree_theme_constant_inner_item_margin_right>` | ``0`` |
  196. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  197. | :ref:`int<class_int>` | :ref:`inner_item_margin_top<class_Tree_theme_constant_inner_item_margin_top>` | ``0`` |
  198. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  199. | :ref:`int<class_int>` | :ref:`item_margin<class_Tree_theme_constant_item_margin>` | ``16`` |
  200. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  201. | :ref:`int<class_int>` | :ref:`outline_size<class_Tree_theme_constant_outline_size>` | ``0`` |
  202. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  203. | :ref:`int<class_int>` | :ref:`parent_hl_line_margin<class_Tree_theme_constant_parent_hl_line_margin>` | ``0`` |
  204. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  205. | :ref:`int<class_int>` | :ref:`parent_hl_line_width<class_Tree_theme_constant_parent_hl_line_width>` | ``1`` |
  206. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  207. | :ref:`int<class_int>` | :ref:`relationship_line_width<class_Tree_theme_constant_relationship_line_width>` | ``1`` |
  208. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  209. | :ref:`int<class_int>` | :ref:`scroll_border<class_Tree_theme_constant_scroll_border>` | ``4`` |
  210. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  211. | :ref:`int<class_int>` | :ref:`scroll_speed<class_Tree_theme_constant_scroll_speed>` | ``12`` |
  212. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  213. | :ref:`int<class_int>` | :ref:`scrollbar_h_separation<class_Tree_theme_constant_scrollbar_h_separation>` | ``4`` |
  214. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  215. | :ref:`int<class_int>` | :ref:`scrollbar_margin_bottom<class_Tree_theme_constant_scrollbar_margin_bottom>` | ``-1`` |
  216. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  217. | :ref:`int<class_int>` | :ref:`scrollbar_margin_left<class_Tree_theme_constant_scrollbar_margin_left>` | ``-1`` |
  218. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  219. | :ref:`int<class_int>` | :ref:`scrollbar_margin_right<class_Tree_theme_constant_scrollbar_margin_right>` | ``-1`` |
  220. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  221. | :ref:`int<class_int>` | :ref:`scrollbar_margin_top<class_Tree_theme_constant_scrollbar_margin_top>` | ``-1`` |
  222. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  223. | :ref:`int<class_int>` | :ref:`scrollbar_v_separation<class_Tree_theme_constant_scrollbar_v_separation>` | ``4`` |
  224. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  225. | :ref:`int<class_int>` | :ref:`v_separation<class_Tree_theme_constant_v_separation>` | ``4`` |
  226. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  227. | :ref:`Font<class_Font>` | :ref:`font<class_Tree_theme_font_font>` | |
  228. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  229. | :ref:`Font<class_Font>` | :ref:`title_button_font<class_Tree_theme_font_title_button_font>` | |
  230. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  231. | :ref:`int<class_int>` | :ref:`font_size<class_Tree_theme_font_size_font_size>` | |
  232. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  233. | :ref:`Texture2D<class_Texture2D>` | :ref:`arrow<class_Tree_theme_icon_arrow>` | |
  234. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  235. | :ref:`Texture2D<class_Texture2D>` | :ref:`arrow_collapsed<class_Tree_theme_icon_arrow_collapsed>` | |
  236. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  237. | :ref:`Texture2D<class_Texture2D>` | :ref:`arrow_collapsed_mirrored<class_Tree_theme_icon_arrow_collapsed_mirrored>` | |
  238. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  239. | :ref:`Texture2D<class_Texture2D>` | :ref:`checked<class_Tree_theme_icon_checked>` | |
  240. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  241. | :ref:`Texture2D<class_Texture2D>` | :ref:`indeterminate<class_Tree_theme_icon_indeterminate>` | |
  242. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  243. | :ref:`Texture2D<class_Texture2D>` | :ref:`select_arrow<class_Tree_theme_icon_select_arrow>` | |
  244. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  245. | :ref:`Texture2D<class_Texture2D>` | :ref:`unchecked<class_Tree_theme_icon_unchecked>` | |
  246. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  247. | :ref:`Texture2D<class_Texture2D>` | :ref:`updown<class_Tree_theme_icon_updown>` | |
  248. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  249. | :ref:`StyleBox<class_StyleBox>` | :ref:`button_pressed<class_Tree_theme_style_button_pressed>` | |
  250. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  251. | :ref:`StyleBox<class_StyleBox>` | :ref:`cursor<class_Tree_theme_style_cursor>` | |
  252. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  253. | :ref:`StyleBox<class_StyleBox>` | :ref:`cursor_unfocused<class_Tree_theme_style_cursor_unfocused>` | |
  254. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  255. | :ref:`StyleBox<class_StyleBox>` | :ref:`custom_button<class_Tree_theme_style_custom_button>` | |
  256. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  257. | :ref:`StyleBox<class_StyleBox>` | :ref:`custom_button_hover<class_Tree_theme_style_custom_button_hover>` | |
  258. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  259. | :ref:`StyleBox<class_StyleBox>` | :ref:`custom_button_pressed<class_Tree_theme_style_custom_button_pressed>` | |
  260. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  261. | :ref:`StyleBox<class_StyleBox>` | :ref:`focus<class_Tree_theme_style_focus>` | |
  262. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  263. | :ref:`StyleBox<class_StyleBox>` | :ref:`panel<class_Tree_theme_style_panel>` | |
  264. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  265. | :ref:`StyleBox<class_StyleBox>` | :ref:`selected<class_Tree_theme_style_selected>` | |
  266. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  267. | :ref:`StyleBox<class_StyleBox>` | :ref:`selected_focus<class_Tree_theme_style_selected_focus>` | |
  268. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  269. | :ref:`StyleBox<class_StyleBox>` | :ref:`title_button_hover<class_Tree_theme_style_title_button_hover>` | |
  270. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  271. | :ref:`StyleBox<class_StyleBox>` | :ref:`title_button_normal<class_Tree_theme_style_title_button_normal>` | |
  272. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  273. | :ref:`StyleBox<class_StyleBox>` | :ref:`title_button_pressed<class_Tree_theme_style_title_button_pressed>` | |
  274. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  275. .. rst-class:: classref-section-separator
  276. ----
  277. .. rst-class:: classref-descriptions-group
  278. Signals
  279. -------
  280. .. _class_Tree_signal_button_clicked:
  281. .. rst-class:: classref-signal
  282. **button_clicked** **(** :ref:`TreeItem<class_TreeItem>` item, :ref:`int<class_int>` column, :ref:`int<class_int>` id, :ref:`int<class_int>` mouse_button_index **)**
  283. Emitted when a button on the tree was pressed (see :ref:`TreeItem.add_button<class_TreeItem_method_add_button>`).
  284. .. rst-class:: classref-item-separator
  285. ----
  286. .. _class_Tree_signal_cell_selected:
  287. .. rst-class:: classref-signal
  288. **cell_selected** **(** **)**
  289. Emitted when a cell is selected.
  290. .. rst-class:: classref-item-separator
  291. ----
  292. .. _class_Tree_signal_check_propagated_to_item:
  293. .. rst-class:: classref-signal
  294. **check_propagated_to_item** **(** :ref:`TreeItem<class_TreeItem>` item, :ref:`int<class_int>` column **)**
  295. Emitted when :ref:`TreeItem.propagate_check<class_TreeItem_method_propagate_check>` is called. Connect to this signal to process the items that are affected when :ref:`TreeItem.propagate_check<class_TreeItem_method_propagate_check>` is invoked. The order that the items affected will be processed is as follows: the item that invoked the method, children of that item, and finally parents of that item.
  296. .. rst-class:: classref-item-separator
  297. ----
  298. .. _class_Tree_signal_column_title_clicked:
  299. .. rst-class:: classref-signal
  300. **column_title_clicked** **(** :ref:`int<class_int>` column, :ref:`int<class_int>` mouse_button_index **)**
  301. Emitted when a column's title is clicked with either :ref:`@GlobalScope.MOUSE_BUTTON_LEFT<class_@GlobalScope_constant_MOUSE_BUTTON_LEFT>` or :ref:`@GlobalScope.MOUSE_BUTTON_RIGHT<class_@GlobalScope_constant_MOUSE_BUTTON_RIGHT>`.
  302. .. rst-class:: classref-item-separator
  303. ----
  304. .. _class_Tree_signal_custom_item_clicked:
  305. .. rst-class:: classref-signal
  306. **custom_item_clicked** **(** :ref:`int<class_int>` mouse_button_index **)**
  307. Emitted when an item with :ref:`TreeItem.CELL_MODE_CUSTOM<class_TreeItem_constant_CELL_MODE_CUSTOM>` is clicked with a mouse button.
  308. .. rst-class:: classref-item-separator
  309. ----
  310. .. _class_Tree_signal_custom_popup_edited:
  311. .. rst-class:: classref-signal
  312. **custom_popup_edited** **(** :ref:`bool<class_bool>` arrow_clicked **)**
  313. Emitted when a cell with the :ref:`TreeItem.CELL_MODE_CUSTOM<class_TreeItem_constant_CELL_MODE_CUSTOM>` is clicked to be edited.
  314. .. rst-class:: classref-item-separator
  315. ----
  316. .. _class_Tree_signal_empty_clicked:
  317. .. rst-class:: classref-signal
  318. **empty_clicked** **(** :ref:`Vector2<class_Vector2>` position, :ref:`int<class_int>` mouse_button_index **)**
  319. Emitted when a mouse button is clicked in the empty space of the tree.
  320. .. rst-class:: classref-item-separator
  321. ----
  322. .. _class_Tree_signal_item_activated:
  323. .. rst-class:: classref-signal
  324. **item_activated** **(** **)**
  325. Emitted when an item is double-clicked, or selected with a ``ui_accept`` input event (e.g. using :kbd:`Enter` or :kbd:`Space` on the keyboard).
  326. .. rst-class:: classref-item-separator
  327. ----
  328. .. _class_Tree_signal_item_collapsed:
  329. .. rst-class:: classref-signal
  330. **item_collapsed** **(** :ref:`TreeItem<class_TreeItem>` item **)**
  331. Emitted when an item is collapsed by a click on the folding arrow.
  332. .. rst-class:: classref-item-separator
  333. ----
  334. .. _class_Tree_signal_item_edited:
  335. .. rst-class:: classref-signal
  336. **item_edited** **(** **)**
  337. Emitted when an item is edited.
  338. .. rst-class:: classref-item-separator
  339. ----
  340. .. _class_Tree_signal_item_icon_double_clicked:
  341. .. rst-class:: classref-signal
  342. **item_icon_double_clicked** **(** **)**
  343. Emitted when an item's icon is double-clicked. For a signal that emits when any part of the item is double-clicked, see :ref:`item_activated<class_Tree_signal_item_activated>`.
  344. .. rst-class:: classref-item-separator
  345. ----
  346. .. _class_Tree_signal_item_mouse_selected:
  347. .. rst-class:: classref-signal
  348. **item_mouse_selected** **(** :ref:`Vector2<class_Vector2>` position, :ref:`int<class_int>` mouse_button_index **)**
  349. Emitted when an item is selected with a mouse button.
  350. .. rst-class:: classref-item-separator
  351. ----
  352. .. _class_Tree_signal_item_selected:
  353. .. rst-class:: classref-signal
  354. **item_selected** **(** **)**
  355. Emitted when an item is selected.
  356. .. rst-class:: classref-item-separator
  357. ----
  358. .. _class_Tree_signal_multi_selected:
  359. .. rst-class:: classref-signal
  360. **multi_selected** **(** :ref:`TreeItem<class_TreeItem>` item, :ref:`int<class_int>` column, :ref:`bool<class_bool>` selected **)**
  361. Emitted instead of ``item_selected`` if ``select_mode`` is :ref:`SELECT_MULTI<class_Tree_constant_SELECT_MULTI>`.
  362. .. rst-class:: classref-item-separator
  363. ----
  364. .. _class_Tree_signal_nothing_selected:
  365. .. rst-class:: classref-signal
  366. **nothing_selected** **(** **)**
  367. Emitted when a left mouse button click does not select any item.
  368. .. rst-class:: classref-section-separator
  369. ----
  370. .. rst-class:: classref-descriptions-group
  371. Enumerations
  372. ------------
  373. .. _enum_Tree_SelectMode:
  374. .. rst-class:: classref-enumeration
  375. enum **SelectMode**:
  376. .. _class_Tree_constant_SELECT_SINGLE:
  377. .. rst-class:: classref-enumeration-constant
  378. :ref:`SelectMode<enum_Tree_SelectMode>` **SELECT_SINGLE** = ``0``
  379. 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.
  380. 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.
  381. .. _class_Tree_constant_SELECT_ROW:
  382. .. rst-class:: classref-enumeration-constant
  383. :ref:`SelectMode<enum_Tree_SelectMode>` **SELECT_ROW** = ``1``
  384. 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.
  385. 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.
  386. .. _class_Tree_constant_SELECT_MULTI:
  387. .. rst-class:: classref-enumeration-constant
  388. :ref:`SelectMode<enum_Tree_SelectMode>` **SELECT_MULTI** = ``2``
  389. 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.
  390. The focus cursor is visible in this mode, the item or column under the cursor is not necessarily selected.
  391. .. rst-class:: classref-item-separator
  392. ----
  393. .. _enum_Tree_DropModeFlags:
  394. .. rst-class:: classref-enumeration
  395. enum **DropModeFlags**:
  396. .. _class_Tree_constant_DROP_MODE_DISABLED:
  397. .. rst-class:: classref-enumeration-constant
  398. :ref:`DropModeFlags<enum_Tree_DropModeFlags>` **DROP_MODE_DISABLED** = ``0``
  399. 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>`.
  400. \ **Note:** This is the default flag, it has no effect when combined with other flags.
  401. .. _class_Tree_constant_DROP_MODE_ON_ITEM:
  402. .. rst-class:: classref-enumeration-constant
  403. :ref:`DropModeFlags<enum_Tree_DropModeFlags>` **DROP_MODE_ON_ITEM** = ``1``
  404. Enables the "on item" drop section. This drop section covers the entire item.
  405. When combined with :ref:`DROP_MODE_INBETWEEN<class_Tree_constant_DROP_MODE_INBETWEEN>`, this drop section halves the height and stays centered vertically.
  406. .. _class_Tree_constant_DROP_MODE_INBETWEEN:
  407. .. rst-class:: classref-enumeration-constant
  408. :ref:`DropModeFlags<enum_Tree_DropModeFlags>` **DROP_MODE_INBETWEEN** = ``2``
  409. 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.
  410. 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.
  411. .. rst-class:: classref-section-separator
  412. ----
  413. .. rst-class:: classref-descriptions-group
  414. Property Descriptions
  415. ---------------------
  416. .. _class_Tree_property_allow_reselect:
  417. .. rst-class:: classref-property
  418. :ref:`bool<class_bool>` **allow_reselect** = ``false``
  419. .. rst-class:: classref-property-setget
  420. - void **set_allow_reselect** **(** :ref:`bool<class_bool>` value **)**
  421. - :ref:`bool<class_bool>` **get_allow_reselect** **(** **)**
  422. If ``true``, the currently selected cell may be selected again.
  423. .. rst-class:: classref-item-separator
  424. ----
  425. .. _class_Tree_property_allow_rmb_select:
  426. .. rst-class:: classref-property
  427. :ref:`bool<class_bool>` **allow_rmb_select** = ``false``
  428. .. rst-class:: classref-property-setget
  429. - void **set_allow_rmb_select** **(** :ref:`bool<class_bool>` value **)**
  430. - :ref:`bool<class_bool>` **get_allow_rmb_select** **(** **)**
  431. If ``true``, a right mouse button click can select items.
  432. .. rst-class:: classref-item-separator
  433. ----
  434. .. _class_Tree_property_allow_search:
  435. .. rst-class:: classref-property
  436. :ref:`bool<class_bool>` **allow_search** = ``true``
  437. .. rst-class:: classref-property-setget
  438. - void **set_allow_search** **(** :ref:`bool<class_bool>` value **)**
  439. - :ref:`bool<class_bool>` **get_allow_search** **(** **)**
  440. If ``true``, allows navigating the **Tree** with letter keys through incremental search.
  441. .. rst-class:: classref-item-separator
  442. ----
  443. .. _class_Tree_property_column_titles_visible:
  444. .. rst-class:: classref-property
  445. :ref:`bool<class_bool>` **column_titles_visible** = ``false``
  446. .. rst-class:: classref-property-setget
  447. - void **set_column_titles_visible** **(** :ref:`bool<class_bool>` value **)**
  448. - :ref:`bool<class_bool>` **are_column_titles_visible** **(** **)**
  449. If ``true``, column titles are visible.
  450. .. rst-class:: classref-item-separator
  451. ----
  452. .. _class_Tree_property_columns:
  453. .. rst-class:: classref-property
  454. :ref:`int<class_int>` **columns** = ``1``
  455. .. rst-class:: classref-property-setget
  456. - void **set_columns** **(** :ref:`int<class_int>` value **)**
  457. - :ref:`int<class_int>` **get_columns** **(** **)**
  458. The number of columns.
  459. .. rst-class:: classref-item-separator
  460. ----
  461. .. _class_Tree_property_drop_mode_flags:
  462. .. rst-class:: classref-property
  463. :ref:`int<class_int>` **drop_mode_flags** = ``0``
  464. .. rst-class:: classref-property-setget
  465. - void **set_drop_mode_flags** **(** :ref:`int<class_int>` value **)**
  466. - :ref:`int<class_int>` **get_drop_mode_flags** **(** **)**
  467. 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.
  468. This controls the drop sections, i.e. the decision and drawing of possible drop locations based on the mouse position.
  469. .. rst-class:: classref-item-separator
  470. ----
  471. .. _class_Tree_property_enable_recursive_folding:
  472. .. rst-class:: classref-property
  473. :ref:`bool<class_bool>` **enable_recursive_folding** = ``true``
  474. .. rst-class:: classref-property-setget
  475. - void **set_enable_recursive_folding** **(** :ref:`bool<class_bool>` value **)**
  476. - :ref:`bool<class_bool>` **is_recursive_folding_enabled** **(** **)**
  477. If ``true``, recursive folding is enabled for this **Tree**. Holding down Shift while clicking the fold arrow collapses or uncollapses the :ref:`TreeItem<class_TreeItem>` and all its descendants.
  478. .. rst-class:: classref-item-separator
  479. ----
  480. .. _class_Tree_property_hide_folding:
  481. .. rst-class:: classref-property
  482. :ref:`bool<class_bool>` **hide_folding** = ``false``
  483. .. rst-class:: classref-property-setget
  484. - void **set_hide_folding** **(** :ref:`bool<class_bool>` value **)**
  485. - :ref:`bool<class_bool>` **is_folding_hidden** **(** **)**
  486. If ``true``, the folding arrow is hidden.
  487. .. rst-class:: classref-item-separator
  488. ----
  489. .. _class_Tree_property_hide_root:
  490. .. rst-class:: classref-property
  491. :ref:`bool<class_bool>` **hide_root** = ``false``
  492. .. rst-class:: classref-property-setget
  493. - void **set_hide_root** **(** :ref:`bool<class_bool>` value **)**
  494. - :ref:`bool<class_bool>` **is_root_hidden** **(** **)**
  495. If ``true``, the tree's root is hidden.
  496. .. rst-class:: classref-item-separator
  497. ----
  498. .. _class_Tree_property_scroll_horizontal_enabled:
  499. .. rst-class:: classref-property
  500. :ref:`bool<class_bool>` **scroll_horizontal_enabled** = ``true``
  501. .. rst-class:: classref-property-setget
  502. - void **set_h_scroll_enabled** **(** :ref:`bool<class_bool>` value **)**
  503. - :ref:`bool<class_bool>` **is_h_scroll_enabled** **(** **)**
  504. If ``true``, enables horizontal scrolling.
  505. .. rst-class:: classref-item-separator
  506. ----
  507. .. _class_Tree_property_scroll_vertical_enabled:
  508. .. rst-class:: classref-property
  509. :ref:`bool<class_bool>` **scroll_vertical_enabled** = ``true``
  510. .. rst-class:: classref-property-setget
  511. - void **set_v_scroll_enabled** **(** :ref:`bool<class_bool>` value **)**
  512. - :ref:`bool<class_bool>` **is_v_scroll_enabled** **(** **)**
  513. If ``true``, enables vertical scrolling.
  514. .. rst-class:: classref-item-separator
  515. ----
  516. .. _class_Tree_property_select_mode:
  517. .. rst-class:: classref-property
  518. :ref:`SelectMode<enum_Tree_SelectMode>` **select_mode** = ``0``
  519. .. rst-class:: classref-property-setget
  520. - void **set_select_mode** **(** :ref:`SelectMode<enum_Tree_SelectMode>` value **)**
  521. - :ref:`SelectMode<enum_Tree_SelectMode>` **get_select_mode** **(** **)**
  522. Allows single or multiple selection. See the :ref:`SelectMode<enum_Tree_SelectMode>` constants.
  523. .. rst-class:: classref-section-separator
  524. ----
  525. .. rst-class:: classref-descriptions-group
  526. Method Descriptions
  527. -------------------
  528. .. _class_Tree_method_clear:
  529. .. rst-class:: classref-method
  530. void **clear** **(** **)**
  531. Clears the tree. This removes all items.
  532. .. rst-class:: classref-item-separator
  533. ----
  534. .. _class_Tree_method_create_item:
  535. .. rst-class:: classref-method
  536. :ref:`TreeItem<class_TreeItem>` **create_item** **(** :ref:`TreeItem<class_TreeItem>` parent=null, :ref:`int<class_int>` index=-1 **)**
  537. 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``.
  538. 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.
  539. The new item will be the ``index``-th child of parent, or it will be the last child if there are not enough siblings.
  540. .. rst-class:: classref-item-separator
  541. ----
  542. .. _class_Tree_method_deselect_all:
  543. .. rst-class:: classref-method
  544. void **deselect_all** **(** **)**
  545. Deselects all tree items (rows and columns). In :ref:`SELECT_MULTI<class_Tree_constant_SELECT_MULTI>` mode also removes selection cursor.
  546. .. rst-class:: classref-item-separator
  547. ----
  548. .. _class_Tree_method_edit_selected:
  549. .. rst-class:: classref-method
  550. :ref:`bool<class_bool>` **edit_selected** **(** :ref:`bool<class_bool>` force_edit=false **)**
  551. Edits the selected tree item as if it was clicked.
  552. Either the item must be set editable with :ref:`TreeItem.set_editable<class_TreeItem_method_set_editable>` or ``force_edit`` must be ``true``.
  553. Returns ``true`` if the item could be edited. Fails if no item is selected.
  554. .. rst-class:: classref-item-separator
  555. ----
  556. .. _class_Tree_method_ensure_cursor_is_visible:
  557. .. rst-class:: classref-method
  558. void **ensure_cursor_is_visible** **(** **)**
  559. Makes the currently focused cell visible.
  560. 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.
  561. \ **Note:** Despite the name of this method, the focus cursor itself is only visible in :ref:`SELECT_MULTI<class_Tree_constant_SELECT_MULTI>` mode.
  562. .. rst-class:: classref-item-separator
  563. ----
  564. .. _class_Tree_method_get_button_id_at_position:
  565. .. rst-class:: classref-method
  566. :ref:`int<class_int>` **get_button_id_at_position** **(** :ref:`Vector2<class_Vector2>` position **)** |const|
  567. Returns the button ID at ``position``, or -1 if no button is there.
  568. .. rst-class:: classref-item-separator
  569. ----
  570. .. _class_Tree_method_get_column_at_position:
  571. .. rst-class:: classref-method
  572. :ref:`int<class_int>` **get_column_at_position** **(** :ref:`Vector2<class_Vector2>` position **)** |const|
  573. Returns the column index at ``position``, or -1 if no item is there.
  574. .. rst-class:: classref-item-separator
  575. ----
  576. .. _class_Tree_method_get_column_expand_ratio:
  577. .. rst-class:: classref-method
  578. :ref:`int<class_int>` **get_column_expand_ratio** **(** :ref:`int<class_int>` column **)** |const|
  579. Returns the expand ratio assigned to the column.
  580. .. rst-class:: classref-item-separator
  581. ----
  582. .. _class_Tree_method_get_column_title:
  583. .. rst-class:: classref-method
  584. :ref:`String<class_String>` **get_column_title** **(** :ref:`int<class_int>` column **)** |const|
  585. Returns the column's title.
  586. .. rst-class:: classref-item-separator
  587. ----
  588. .. _class_Tree_method_get_column_title_alignment:
  589. .. rst-class:: classref-method
  590. :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **get_column_title_alignment** **(** :ref:`int<class_int>` column **)** |const|
  591. Returns the column title alignment.
  592. .. rst-class:: classref-item-separator
  593. ----
  594. .. _class_Tree_method_get_column_title_direction:
  595. .. rst-class:: classref-method
  596. :ref:`TextDirection<enum_Control_TextDirection>` **get_column_title_direction** **(** :ref:`int<class_int>` column **)** |const|
  597. Returns column title base writing direction.
  598. .. rst-class:: classref-item-separator
  599. ----
  600. .. _class_Tree_method_get_column_title_language:
  601. .. rst-class:: classref-method
  602. :ref:`String<class_String>` **get_column_title_language** **(** :ref:`int<class_int>` column **)** |const|
  603. Returns column title language code.
  604. .. rst-class:: classref-item-separator
  605. ----
  606. .. _class_Tree_method_get_column_width:
  607. .. rst-class:: classref-method
  608. :ref:`int<class_int>` **get_column_width** **(** :ref:`int<class_int>` column **)** |const|
  609. Returns the column's width in pixels.
  610. .. rst-class:: classref-item-separator
  611. ----
  612. .. _class_Tree_method_get_custom_popup_rect:
  613. .. rst-class:: classref-method
  614. :ref:`Rect2<class_Rect2>` **get_custom_popup_rect** **(** **)** |const|
  615. 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>`.
  616. .. rst-class:: classref-item-separator
  617. ----
  618. .. _class_Tree_method_get_drop_section_at_position:
  619. .. rst-class:: classref-method
  620. :ref:`int<class_int>` **get_drop_section_at_position** **(** :ref:`Vector2<class_Vector2>` position **)** |const|
  621. Returns the drop section at ``position``, or -100 if no item is there.
  622. 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.
  623. 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>`.
  624. .. rst-class:: classref-item-separator
  625. ----
  626. .. _class_Tree_method_get_edited:
  627. .. rst-class:: classref-method
  628. :ref:`TreeItem<class_TreeItem>` **get_edited** **(** **)** |const|
  629. Returns the currently edited item. Can be used with :ref:`item_edited<class_Tree_signal_item_edited>` to get the item that was modified.
  630. .. tabs::
  631. .. code-tab:: gdscript
  632. func _ready():
  633. $Tree.item_edited.connect(on_Tree_item_edited)
  634. func on_Tree_item_edited():
  635. print($Tree.get_edited()) # This item just got edited (e.g. checked).
  636. .. code-tab:: csharp
  637. public override void _Ready()
  638. {
  639. GetNode<Tree>("Tree").ItemEdited += OnTreeItemEdited;
  640. }
  641. public void OnTreeItemEdited()
  642. {
  643. GD.Print(GetNode<Tree>("Tree").GetEdited()); // This item just got edited (e.g. checked).
  644. }
  645. .. rst-class:: classref-item-separator
  646. ----
  647. .. _class_Tree_method_get_edited_column:
  648. .. rst-class:: classref-method
  649. :ref:`int<class_int>` **get_edited_column** **(** **)** |const|
  650. Returns the column for the currently edited item.
  651. .. rst-class:: classref-item-separator
  652. ----
  653. .. _class_Tree_method_get_item_area_rect:
  654. .. rst-class:: classref-method
  655. :ref:`Rect2<class_Rect2>` **get_item_area_rect** **(** :ref:`TreeItem<class_TreeItem>` item, :ref:`int<class_int>` column=-1, :ref:`int<class_int>` button_index=-1 **)** |const|
  656. 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. If a button index is specified, the rectangle of that button will be returned.
  657. .. rst-class:: classref-item-separator
  658. ----
  659. .. _class_Tree_method_get_item_at_position:
  660. .. rst-class:: classref-method
  661. :ref:`TreeItem<class_TreeItem>` **get_item_at_position** **(** :ref:`Vector2<class_Vector2>` position **)** |const|
  662. Returns the tree item at the specified position (relative to the tree origin position).
  663. .. rst-class:: classref-item-separator
  664. ----
  665. .. _class_Tree_method_get_next_selected:
  666. .. rst-class:: classref-method
  667. :ref:`TreeItem<class_TreeItem>` **get_next_selected** **(** :ref:`TreeItem<class_TreeItem>` from **)**
  668. Returns the next selected :ref:`TreeItem<class_TreeItem>` after the given one, or ``null`` if the end is reached.
  669. If ``from`` is ``null``, this returns the first selected item.
  670. .. rst-class:: classref-item-separator
  671. ----
  672. .. _class_Tree_method_get_pressed_button:
  673. .. rst-class:: classref-method
  674. :ref:`int<class_int>` **get_pressed_button** **(** **)** |const|
  675. Returns the last pressed button's index.
  676. .. rst-class:: classref-item-separator
  677. ----
  678. .. _class_Tree_method_get_root:
  679. .. rst-class:: classref-method
  680. :ref:`TreeItem<class_TreeItem>` **get_root** **(** **)** |const|
  681. Returns the tree's root item, or ``null`` if the tree is empty.
  682. .. rst-class:: classref-item-separator
  683. ----
  684. .. _class_Tree_method_get_scroll:
  685. .. rst-class:: classref-method
  686. :ref:`Vector2<class_Vector2>` **get_scroll** **(** **)** |const|
  687. Returns the current scrolling position.
  688. .. rst-class:: classref-item-separator
  689. ----
  690. .. _class_Tree_method_get_selected:
  691. .. rst-class:: classref-method
  692. :ref:`TreeItem<class_TreeItem>` **get_selected** **(** **)** |const|
  693. Returns the currently focused item, or ``null`` if no item is focused.
  694. 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.
  695. To get the currently selected item(s), use :ref:`get_next_selected<class_Tree_method_get_next_selected>`.
  696. .. rst-class:: classref-item-separator
  697. ----
  698. .. _class_Tree_method_get_selected_column:
  699. .. rst-class:: classref-method
  700. :ref:`int<class_int>` **get_selected_column** **(** **)** |const|
  701. Returns the currently focused column, or -1 if no column is focused.
  702. 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.
  703. To tell whether a column of an item is selected, use :ref:`TreeItem.is_selected<class_TreeItem_method_is_selected>`.
  704. .. rst-class:: classref-item-separator
  705. ----
  706. .. _class_Tree_method_is_column_clipping_content:
  707. .. rst-class:: classref-method
  708. :ref:`bool<class_bool>` **is_column_clipping_content** **(** :ref:`int<class_int>` column **)** |const|
  709. Returns ``true`` if the column has enabled clipping (see :ref:`set_column_clip_content<class_Tree_method_set_column_clip_content>`).
  710. .. rst-class:: classref-item-separator
  711. ----
  712. .. _class_Tree_method_is_column_expanding:
  713. .. rst-class:: classref-method
  714. :ref:`bool<class_bool>` **is_column_expanding** **(** :ref:`int<class_int>` column **)** |const|
  715. Returns ``true`` if the column has enabled expanding (see :ref:`set_column_expand<class_Tree_method_set_column_expand>`).
  716. .. rst-class:: classref-item-separator
  717. ----
  718. .. _class_Tree_method_scroll_to_item:
  719. .. rst-class:: classref-method
  720. void **scroll_to_item** **(** :ref:`TreeItem<class_TreeItem>` item, :ref:`bool<class_bool>` center_on_item=false **)**
  721. Causes the **Tree** to jump to the specified :ref:`TreeItem<class_TreeItem>`.
  722. .. rst-class:: classref-item-separator
  723. ----
  724. .. _class_Tree_method_set_column_clip_content:
  725. .. rst-class:: classref-method
  726. void **set_column_clip_content** **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` enable **)**
  727. Allows to enable clipping for column's content, making the content size ignored.
  728. .. rst-class:: classref-item-separator
  729. ----
  730. .. _class_Tree_method_set_column_custom_minimum_width:
  731. .. rst-class:: classref-method
  732. void **set_column_custom_minimum_width** **(** :ref:`int<class_int>` column, :ref:`int<class_int>` min_width **)**
  733. Overrides the calculated minimum width of a column. It can be set to ``0`` to restore the default behavior. 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>`.
  734. .. rst-class:: classref-item-separator
  735. ----
  736. .. _class_Tree_method_set_column_expand:
  737. .. rst-class:: classref-method
  738. void **set_column_expand** **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` expand **)**
  739. If ``true``, the column will have the "Expand" flag of :ref:`Control<class_Control>`. Columns that have the "Expand" flag will use their expand ratio in a similar fashion to :ref:`Control.size_flags_stretch_ratio<class_Control_property_size_flags_stretch_ratio>` (see :ref:`set_column_expand_ratio<class_Tree_method_set_column_expand_ratio>`).
  740. .. rst-class:: classref-item-separator
  741. ----
  742. .. _class_Tree_method_set_column_expand_ratio:
  743. .. rst-class:: classref-method
  744. void **set_column_expand_ratio** **(** :ref:`int<class_int>` column, :ref:`int<class_int>` ratio **)**
  745. Sets the relative expand ratio for a column. See :ref:`set_column_expand<class_Tree_method_set_column_expand>`.
  746. .. rst-class:: classref-item-separator
  747. ----
  748. .. _class_Tree_method_set_column_title:
  749. .. rst-class:: classref-method
  750. void **set_column_title** **(** :ref:`int<class_int>` column, :ref:`String<class_String>` title **)**
  751. Sets the title of a column.
  752. .. rst-class:: classref-item-separator
  753. ----
  754. .. _class_Tree_method_set_column_title_alignment:
  755. .. rst-class:: classref-method
  756. void **set_column_title_alignment** **(** :ref:`int<class_int>` column, :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` title_alignment **)**
  757. Sets the column title alignment. Note that :ref:`@GlobalScope.HORIZONTAL_ALIGNMENT_FILL<class_@GlobalScope_constant_HORIZONTAL_ALIGNMENT_FILL>` is not supported for column titles.
  758. .. rst-class:: classref-item-separator
  759. ----
  760. .. _class_Tree_method_set_column_title_direction:
  761. .. rst-class:: classref-method
  762. void **set_column_title_direction** **(** :ref:`int<class_int>` column, :ref:`TextDirection<enum_Control_TextDirection>` direction **)**
  763. Sets column title base writing direction.
  764. .. rst-class:: classref-item-separator
  765. ----
  766. .. _class_Tree_method_set_column_title_language:
  767. .. rst-class:: classref-method
  768. void **set_column_title_language** **(** :ref:`int<class_int>` column, :ref:`String<class_String>` language **)**
  769. Sets language code of column title used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
  770. .. rst-class:: classref-item-separator
  771. ----
  772. .. _class_Tree_method_set_selected:
  773. .. rst-class:: classref-method
  774. void **set_selected** **(** :ref:`TreeItem<class_TreeItem>` item, :ref:`int<class_int>` column **)**
  775. Selects the specified :ref:`TreeItem<class_TreeItem>` and column.
  776. .. rst-class:: classref-section-separator
  777. ----
  778. .. rst-class:: classref-descriptions-group
  779. Theme Property Descriptions
  780. ---------------------------
  781. .. _class_Tree_theme_color_children_hl_line_color:
  782. .. rst-class:: classref-themeproperty
  783. :ref:`Color<class_Color>` **children_hl_line_color** = ``Color(0.27, 0.27, 0.27, 1)``
  784. The :ref:`Color<class_Color>` of the relationship lines between the selected :ref:`TreeItem<class_TreeItem>` and its children.
  785. .. rst-class:: classref-item-separator
  786. ----
  787. .. _class_Tree_theme_color_custom_button_font_highlight:
  788. .. rst-class:: classref-themeproperty
  789. :ref:`Color<class_Color>` **custom_button_font_highlight** = ``Color(0.95, 0.95, 0.95, 1)``
  790. Text :ref:`Color<class_Color>` for a :ref:`TreeItem.CELL_MODE_CUSTOM<class_TreeItem_constant_CELL_MODE_CUSTOM>` mode cell when it's hovered.
  791. .. rst-class:: classref-item-separator
  792. ----
  793. .. _class_Tree_theme_color_drop_position_color:
  794. .. rst-class:: classref-themeproperty
  795. :ref:`Color<class_Color>` **drop_position_color** = ``Color(1, 1, 1, 1)``
  796. :ref:`Color<class_Color>` used to draw possible drop locations. See :ref:`DropModeFlags<enum_Tree_DropModeFlags>` constants for further description of drop locations.
  797. .. rst-class:: classref-item-separator
  798. ----
  799. .. _class_Tree_theme_color_font_color:
  800. .. rst-class:: classref-themeproperty
  801. :ref:`Color<class_Color>` **font_color** = ``Color(0.7, 0.7, 0.7, 1)``
  802. Default text :ref:`Color<class_Color>` of the item.
  803. .. rst-class:: classref-item-separator
  804. ----
  805. .. _class_Tree_theme_color_font_outline_color:
  806. .. rst-class:: classref-themeproperty
  807. :ref:`Color<class_Color>` **font_outline_color** = ``Color(1, 1, 1, 1)``
  808. The tint of text outline of the item.
  809. .. rst-class:: classref-item-separator
  810. ----
  811. .. _class_Tree_theme_color_font_selected_color:
  812. .. rst-class:: classref-themeproperty
  813. :ref:`Color<class_Color>` **font_selected_color** = ``Color(1, 1, 1, 1)``
  814. Text :ref:`Color<class_Color>` used when the item is selected.
  815. .. rst-class:: classref-item-separator
  816. ----
  817. .. _class_Tree_theme_color_guide_color:
  818. .. rst-class:: classref-themeproperty
  819. :ref:`Color<class_Color>` **guide_color** = ``Color(0.7, 0.7, 0.7, 0.25)``
  820. :ref:`Color<class_Color>` of the guideline.
  821. .. rst-class:: classref-item-separator
  822. ----
  823. .. _class_Tree_theme_color_parent_hl_line_color:
  824. .. rst-class:: classref-themeproperty
  825. :ref:`Color<class_Color>` **parent_hl_line_color** = ``Color(0.27, 0.27, 0.27, 1)``
  826. The :ref:`Color<class_Color>` of the relationship lines between the selected :ref:`TreeItem<class_TreeItem>` and its parents.
  827. .. rst-class:: classref-item-separator
  828. ----
  829. .. _class_Tree_theme_color_relationship_line_color:
  830. .. rst-class:: classref-themeproperty
  831. :ref:`Color<class_Color>` **relationship_line_color** = ``Color(0.27, 0.27, 0.27, 1)``
  832. The default :ref:`Color<class_Color>` of the relationship lines.
  833. .. rst-class:: classref-item-separator
  834. ----
  835. .. _class_Tree_theme_color_title_button_color:
  836. .. rst-class:: classref-themeproperty
  837. :ref:`Color<class_Color>` **title_button_color** = ``Color(0.875, 0.875, 0.875, 1)``
  838. Default text :ref:`Color<class_Color>` of the title button.
  839. .. rst-class:: classref-item-separator
  840. ----
  841. .. _class_Tree_theme_constant_button_margin:
  842. .. rst-class:: classref-themeproperty
  843. :ref:`int<class_int>` **button_margin** = ``4``
  844. The horizontal space between each button in a cell.
  845. .. rst-class:: classref-item-separator
  846. ----
  847. .. _class_Tree_theme_constant_children_hl_line_width:
  848. .. rst-class:: classref-themeproperty
  849. :ref:`int<class_int>` **children_hl_line_width** = ``1``
  850. The width of the relationship lines between the selected :ref:`TreeItem<class_TreeItem>` and its children.
  851. .. rst-class:: classref-item-separator
  852. ----
  853. .. _class_Tree_theme_constant_draw_guides:
  854. .. rst-class:: classref-themeproperty
  855. :ref:`int<class_int>` **draw_guides** = ``1``
  856. Draws the guidelines if not zero, this acts as a boolean. The guideline is a horizontal line drawn at the bottom of each item.
  857. .. rst-class:: classref-item-separator
  858. ----
  859. .. _class_Tree_theme_constant_draw_relationship_lines:
  860. .. rst-class:: classref-themeproperty
  861. :ref:`int<class_int>` **draw_relationship_lines** = ``0``
  862. 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.
  863. .. rst-class:: classref-item-separator
  864. ----
  865. .. _class_Tree_theme_constant_h_separation:
  866. .. rst-class:: classref-themeproperty
  867. :ref:`int<class_int>` **h_separation** = ``4``
  868. The horizontal space between item cells. This is also used as the margin at the start of an item when folding is disabled.
  869. .. rst-class:: classref-item-separator
  870. ----
  871. .. _class_Tree_theme_constant_icon_max_width:
  872. .. rst-class:: classref-themeproperty
  873. :ref:`int<class_int>` **icon_max_width** = ``0``
  874. The maximum allowed width of the icon in item's cells. This limit is applied on top of the default size of the icon, but before the value set with :ref:`TreeItem.set_icon_max_width<class_TreeItem_method_set_icon_max_width>`. The height is adjusted according to the icon's ratio.
  875. .. rst-class:: classref-item-separator
  876. ----
  877. .. _class_Tree_theme_constant_inner_item_margin_bottom:
  878. .. rst-class:: classref-themeproperty
  879. :ref:`int<class_int>` **inner_item_margin_bottom** = ``0``
  880. The inner bottom margin of an item.
  881. .. rst-class:: classref-item-separator
  882. ----
  883. .. _class_Tree_theme_constant_inner_item_margin_left:
  884. .. rst-class:: classref-themeproperty
  885. :ref:`int<class_int>` **inner_item_margin_left** = ``0``
  886. The inner left margin of an item.
  887. .. rst-class:: classref-item-separator
  888. ----
  889. .. _class_Tree_theme_constant_inner_item_margin_right:
  890. .. rst-class:: classref-themeproperty
  891. :ref:`int<class_int>` **inner_item_margin_right** = ``0``
  892. The inner right margin of an item.
  893. .. rst-class:: classref-item-separator
  894. ----
  895. .. _class_Tree_theme_constant_inner_item_margin_top:
  896. .. rst-class:: classref-themeproperty
  897. :ref:`int<class_int>` **inner_item_margin_top** = ``0``
  898. The inner top margin of an item.
  899. .. rst-class:: classref-item-separator
  900. ----
  901. .. _class_Tree_theme_constant_item_margin:
  902. .. rst-class:: classref-themeproperty
  903. :ref:`int<class_int>` **item_margin** = ``16``
  904. The horizontal margin at the start of an item. This is used when folding is enabled for the item.
  905. .. rst-class:: classref-item-separator
  906. ----
  907. .. _class_Tree_theme_constant_outline_size:
  908. .. rst-class:: classref-themeproperty
  909. :ref:`int<class_int>` **outline_size** = ``0``
  910. The size of the text outline.
  911. \ **Note:** If using a font with :ref:`FontFile.multichannel_signed_distance_field<class_FontFile_property_multichannel_signed_distance_field>` enabled, its :ref:`FontFile.msdf_pixel_range<class_FontFile_property_msdf_pixel_range>` must be set to at least *twice* the value of :ref:`outline_size<class_Tree_theme_constant_outline_size>` for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended.
  912. .. rst-class:: classref-item-separator
  913. ----
  914. .. _class_Tree_theme_constant_parent_hl_line_margin:
  915. .. rst-class:: classref-themeproperty
  916. :ref:`int<class_int>` **parent_hl_line_margin** = ``0``
  917. The space between the parent relationship lines for the selected :ref:`TreeItem<class_TreeItem>` and the relationship lines to its siblings that are not selected.
  918. .. rst-class:: classref-item-separator
  919. ----
  920. .. _class_Tree_theme_constant_parent_hl_line_width:
  921. .. rst-class:: classref-themeproperty
  922. :ref:`int<class_int>` **parent_hl_line_width** = ``1``
  923. The width of the relationship lines between the selected :ref:`TreeItem<class_TreeItem>` and its parents.
  924. .. rst-class:: classref-item-separator
  925. ----
  926. .. _class_Tree_theme_constant_relationship_line_width:
  927. .. rst-class:: classref-themeproperty
  928. :ref:`int<class_int>` **relationship_line_width** = ``1``
  929. The default width of the relationship lines.
  930. .. rst-class:: classref-item-separator
  931. ----
  932. .. _class_Tree_theme_constant_scroll_border:
  933. .. rst-class:: classref-themeproperty
  934. :ref:`int<class_int>` **scroll_border** = ``4``
  935. The maximum distance between the mouse cursor and the control's border to trigger border scrolling when dragging.
  936. .. rst-class:: classref-item-separator
  937. ----
  938. .. _class_Tree_theme_constant_scroll_speed:
  939. .. rst-class:: classref-themeproperty
  940. :ref:`int<class_int>` **scroll_speed** = ``12``
  941. The speed of border scrolling.
  942. .. rst-class:: classref-item-separator
  943. ----
  944. .. _class_Tree_theme_constant_scrollbar_h_separation:
  945. .. rst-class:: classref-themeproperty
  946. :ref:`int<class_int>` **scrollbar_h_separation** = ``4``
  947. The horizontal separation of tree content and scrollbar.
  948. .. rst-class:: classref-item-separator
  949. ----
  950. .. _class_Tree_theme_constant_scrollbar_margin_bottom:
  951. .. rst-class:: classref-themeproperty
  952. :ref:`int<class_int>` **scrollbar_margin_bottom** = ``-1``
  953. The bottom margin of the scrollbars. When negative, uses :ref:`panel<class_Tree_theme_style_panel>` bottom margin.
  954. .. rst-class:: classref-item-separator
  955. ----
  956. .. _class_Tree_theme_constant_scrollbar_margin_left:
  957. .. rst-class:: classref-themeproperty
  958. :ref:`int<class_int>` **scrollbar_margin_left** = ``-1``
  959. The left margin of the horizontal scrollbar. When negative, uses :ref:`panel<class_Tree_theme_style_panel>` left margin.
  960. .. rst-class:: classref-item-separator
  961. ----
  962. .. _class_Tree_theme_constant_scrollbar_margin_right:
  963. .. rst-class:: classref-themeproperty
  964. :ref:`int<class_int>` **scrollbar_margin_right** = ``-1``
  965. The right margin of the scrollbars. When negative, uses :ref:`panel<class_Tree_theme_style_panel>` right margin.
  966. .. rst-class:: classref-item-separator
  967. ----
  968. .. _class_Tree_theme_constant_scrollbar_margin_top:
  969. .. rst-class:: classref-themeproperty
  970. :ref:`int<class_int>` **scrollbar_margin_top** = ``-1``
  971. The right margin of the vertical scrollbar. When negative, uses :ref:`panel<class_Tree_theme_style_panel>` top margin.
  972. .. rst-class:: classref-item-separator
  973. ----
  974. .. _class_Tree_theme_constant_scrollbar_v_separation:
  975. .. rst-class:: classref-themeproperty
  976. :ref:`int<class_int>` **scrollbar_v_separation** = ``4``
  977. The vertical separation of tree content and scrollbar.
  978. .. rst-class:: classref-item-separator
  979. ----
  980. .. _class_Tree_theme_constant_v_separation:
  981. .. rst-class:: classref-themeproperty
  982. :ref:`int<class_int>` **v_separation** = ``4``
  983. The vertical padding inside each item, i.e. the distance between the item's content and top/bottom border.
  984. .. rst-class:: classref-item-separator
  985. ----
  986. .. _class_Tree_theme_font_font:
  987. .. rst-class:: classref-themeproperty
  988. :ref:`Font<class_Font>` **font**
  989. :ref:`Font<class_Font>` of the item's text.
  990. .. rst-class:: classref-item-separator
  991. ----
  992. .. _class_Tree_theme_font_title_button_font:
  993. .. rst-class:: classref-themeproperty
  994. :ref:`Font<class_Font>` **title_button_font**
  995. :ref:`Font<class_Font>` of the title button's text.
  996. .. rst-class:: classref-item-separator
  997. ----
  998. .. _class_Tree_theme_font_size_font_size:
  999. .. rst-class:: classref-themeproperty
  1000. :ref:`int<class_int>` **font_size**
  1001. Font size of the item's text.
  1002. .. rst-class:: classref-item-separator
  1003. ----
  1004. .. _class_Tree_theme_icon_arrow:
  1005. .. rst-class:: classref-themeproperty
  1006. :ref:`Texture2D<class_Texture2D>` **arrow**
  1007. The arrow icon used when a foldable item is not collapsed.
  1008. .. rst-class:: classref-item-separator
  1009. ----
  1010. .. _class_Tree_theme_icon_arrow_collapsed:
  1011. .. rst-class:: classref-themeproperty
  1012. :ref:`Texture2D<class_Texture2D>` **arrow_collapsed**
  1013. The arrow icon used when a foldable item is collapsed (for left-to-right layouts).
  1014. .. rst-class:: classref-item-separator
  1015. ----
  1016. .. _class_Tree_theme_icon_arrow_collapsed_mirrored:
  1017. .. rst-class:: classref-themeproperty
  1018. :ref:`Texture2D<class_Texture2D>` **arrow_collapsed_mirrored**
  1019. The arrow icon used when a foldable item is collapsed (for right-to-left layouts).
  1020. .. rst-class:: classref-item-separator
  1021. ----
  1022. .. _class_Tree_theme_icon_checked:
  1023. .. rst-class:: classref-themeproperty
  1024. :ref:`Texture2D<class_Texture2D>` **checked**
  1025. The check icon to display when the :ref:`TreeItem.CELL_MODE_CHECK<class_TreeItem_constant_CELL_MODE_CHECK>` mode cell is checked.
  1026. .. rst-class:: classref-item-separator
  1027. ----
  1028. .. _class_Tree_theme_icon_indeterminate:
  1029. .. rst-class:: classref-themeproperty
  1030. :ref:`Texture2D<class_Texture2D>` **indeterminate**
  1031. The check icon to display when the :ref:`TreeItem.CELL_MODE_CHECK<class_TreeItem_constant_CELL_MODE_CHECK>` mode cell is indeterminate.
  1032. .. rst-class:: classref-item-separator
  1033. ----
  1034. .. _class_Tree_theme_icon_select_arrow:
  1035. .. rst-class:: classref-themeproperty
  1036. :ref:`Texture2D<class_Texture2D>` **select_arrow**
  1037. The arrow icon to display for the :ref:`TreeItem.CELL_MODE_RANGE<class_TreeItem_constant_CELL_MODE_RANGE>` mode cell.
  1038. .. rst-class:: classref-item-separator
  1039. ----
  1040. .. _class_Tree_theme_icon_unchecked:
  1041. .. rst-class:: classref-themeproperty
  1042. :ref:`Texture2D<class_Texture2D>` **unchecked**
  1043. The check icon to display when the :ref:`TreeItem.CELL_MODE_CHECK<class_TreeItem_constant_CELL_MODE_CHECK>` mode cell is unchecked.
  1044. .. rst-class:: classref-item-separator
  1045. ----
  1046. .. _class_Tree_theme_icon_updown:
  1047. .. rst-class:: classref-themeproperty
  1048. :ref:`Texture2D<class_Texture2D>` **updown**
  1049. The updown arrow icon to display for the :ref:`TreeItem.CELL_MODE_RANGE<class_TreeItem_constant_CELL_MODE_RANGE>` mode cell.
  1050. .. rst-class:: classref-item-separator
  1051. ----
  1052. .. _class_Tree_theme_style_button_pressed:
  1053. .. rst-class:: classref-themeproperty
  1054. :ref:`StyleBox<class_StyleBox>` **button_pressed**
  1055. :ref:`StyleBox<class_StyleBox>` used when a button in the tree is pressed.
  1056. .. rst-class:: classref-item-separator
  1057. ----
  1058. .. _class_Tree_theme_style_cursor:
  1059. .. rst-class:: classref-themeproperty
  1060. :ref:`StyleBox<class_StyleBox>` **cursor**
  1061. :ref:`StyleBox<class_StyleBox>` used for the cursor, when the **Tree** is being focused.
  1062. .. rst-class:: classref-item-separator
  1063. ----
  1064. .. _class_Tree_theme_style_cursor_unfocused:
  1065. .. rst-class:: classref-themeproperty
  1066. :ref:`StyleBox<class_StyleBox>` **cursor_unfocused**
  1067. :ref:`StyleBox<class_StyleBox>` used for the cursor, when the **Tree** is not being focused.
  1068. .. rst-class:: classref-item-separator
  1069. ----
  1070. .. _class_Tree_theme_style_custom_button:
  1071. .. rst-class:: classref-themeproperty
  1072. :ref:`StyleBox<class_StyleBox>` **custom_button**
  1073. Default :ref:`StyleBox<class_StyleBox>` for a :ref:`TreeItem.CELL_MODE_CUSTOM<class_TreeItem_constant_CELL_MODE_CUSTOM>` mode cell.
  1074. .. rst-class:: classref-item-separator
  1075. ----
  1076. .. _class_Tree_theme_style_custom_button_hover:
  1077. .. rst-class:: classref-themeproperty
  1078. :ref:`StyleBox<class_StyleBox>` **custom_button_hover**
  1079. :ref:`StyleBox<class_StyleBox>` for a :ref:`TreeItem.CELL_MODE_CUSTOM<class_TreeItem_constant_CELL_MODE_CUSTOM>` mode cell when it's hovered.
  1080. .. rst-class:: classref-item-separator
  1081. ----
  1082. .. _class_Tree_theme_style_custom_button_pressed:
  1083. .. rst-class:: classref-themeproperty
  1084. :ref:`StyleBox<class_StyleBox>` **custom_button_pressed**
  1085. :ref:`StyleBox<class_StyleBox>` for a :ref:`TreeItem.CELL_MODE_CUSTOM<class_TreeItem_constant_CELL_MODE_CUSTOM>` mode cell when it's pressed.
  1086. .. rst-class:: classref-item-separator
  1087. ----
  1088. .. _class_Tree_theme_style_focus:
  1089. .. rst-class:: classref-themeproperty
  1090. :ref:`StyleBox<class_StyleBox>` **focus**
  1091. The focused style for the **Tree**, drawn on top of everything.
  1092. .. rst-class:: classref-item-separator
  1093. ----
  1094. .. _class_Tree_theme_style_panel:
  1095. .. rst-class:: classref-themeproperty
  1096. :ref:`StyleBox<class_StyleBox>` **panel**
  1097. The background style for the **Tree**.
  1098. .. rst-class:: classref-item-separator
  1099. ----
  1100. .. _class_Tree_theme_style_selected:
  1101. .. rst-class:: classref-themeproperty
  1102. :ref:`StyleBox<class_StyleBox>` **selected**
  1103. :ref:`StyleBox<class_StyleBox>` for the selected items, used when the **Tree** is not being focused.
  1104. .. rst-class:: classref-item-separator
  1105. ----
  1106. .. _class_Tree_theme_style_selected_focus:
  1107. .. rst-class:: classref-themeproperty
  1108. :ref:`StyleBox<class_StyleBox>` **selected_focus**
  1109. :ref:`StyleBox<class_StyleBox>` for the selected items, used when the **Tree** is being focused.
  1110. .. rst-class:: classref-item-separator
  1111. ----
  1112. .. _class_Tree_theme_style_title_button_hover:
  1113. .. rst-class:: classref-themeproperty
  1114. :ref:`StyleBox<class_StyleBox>` **title_button_hover**
  1115. :ref:`StyleBox<class_StyleBox>` used when the title button is being hovered.
  1116. .. rst-class:: classref-item-separator
  1117. ----
  1118. .. _class_Tree_theme_style_title_button_normal:
  1119. .. rst-class:: classref-themeproperty
  1120. :ref:`StyleBox<class_StyleBox>` **title_button_normal**
  1121. Default :ref:`StyleBox<class_StyleBox>` for the title button.
  1122. .. rst-class:: classref-item-separator
  1123. ----
  1124. .. _class_Tree_theme_style_title_button_pressed:
  1125. .. rst-class:: classref-themeproperty
  1126. :ref:`StyleBox<class_StyleBox>` **title_button_pressed**
  1127. :ref:`StyleBox<class_StyleBox>` used when the title button is being pressed.
  1128. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  1129. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  1130. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  1131. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  1132. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  1133. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  1134. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`