class_tree.rst 94 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012
  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:`int<class_int>` | :ref:`title_button_font_size<class_Tree_theme_font_size_title_button_font_size>` | |
  234. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  235. | :ref:`Texture2D<class_Texture2D>` | :ref:`arrow<class_Tree_theme_icon_arrow>` | |
  236. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  237. | :ref:`Texture2D<class_Texture2D>` | :ref:`arrow_collapsed<class_Tree_theme_icon_arrow_collapsed>` | |
  238. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  239. | :ref:`Texture2D<class_Texture2D>` | :ref:`arrow_collapsed_mirrored<class_Tree_theme_icon_arrow_collapsed_mirrored>` | |
  240. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  241. | :ref:`Texture2D<class_Texture2D>` | :ref:`checked<class_Tree_theme_icon_checked>` | |
  242. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  243. | :ref:`Texture2D<class_Texture2D>` | :ref:`indeterminate<class_Tree_theme_icon_indeterminate>` | |
  244. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  245. | :ref:`Texture2D<class_Texture2D>` | :ref:`select_arrow<class_Tree_theme_icon_select_arrow>` | |
  246. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  247. | :ref:`Texture2D<class_Texture2D>` | :ref:`unchecked<class_Tree_theme_icon_unchecked>` | |
  248. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  249. | :ref:`Texture2D<class_Texture2D>` | :ref:`updown<class_Tree_theme_icon_updown>` | |
  250. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  251. | :ref:`StyleBox<class_StyleBox>` | :ref:`button_pressed<class_Tree_theme_style_button_pressed>` | |
  252. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  253. | :ref:`StyleBox<class_StyleBox>` | :ref:`cursor<class_Tree_theme_style_cursor>` | |
  254. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  255. | :ref:`StyleBox<class_StyleBox>` | :ref:`cursor_unfocused<class_Tree_theme_style_cursor_unfocused>` | |
  256. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  257. | :ref:`StyleBox<class_StyleBox>` | :ref:`custom_button<class_Tree_theme_style_custom_button>` | |
  258. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  259. | :ref:`StyleBox<class_StyleBox>` | :ref:`custom_button_hover<class_Tree_theme_style_custom_button_hover>` | |
  260. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  261. | :ref:`StyleBox<class_StyleBox>` | :ref:`custom_button_pressed<class_Tree_theme_style_custom_button_pressed>` | |
  262. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  263. | :ref:`StyleBox<class_StyleBox>` | :ref:`focus<class_Tree_theme_style_focus>` | |
  264. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  265. | :ref:`StyleBox<class_StyleBox>` | :ref:`panel<class_Tree_theme_style_panel>` | |
  266. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  267. | :ref:`StyleBox<class_StyleBox>` | :ref:`selected<class_Tree_theme_style_selected>` | |
  268. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  269. | :ref:`StyleBox<class_StyleBox>` | :ref:`selected_focus<class_Tree_theme_style_selected_focus>` | |
  270. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  271. | :ref:`StyleBox<class_StyleBox>` | :ref:`title_button_hover<class_Tree_theme_style_title_button_hover>` | |
  272. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  273. | :ref:`StyleBox<class_StyleBox>` | :ref:`title_button_normal<class_Tree_theme_style_title_button_normal>` | |
  274. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  275. | :ref:`StyleBox<class_StyleBox>` | :ref:`title_button_pressed<class_Tree_theme_style_title_button_pressed>` | |
  276. +-----------------------------------+------------------------------------------------------------------------------------------+-----------------------------------+
  277. .. rst-class:: classref-section-separator
  278. ----
  279. .. rst-class:: classref-descriptions-group
  280. Signals
  281. -------
  282. .. _class_Tree_signal_button_clicked:
  283. .. rst-class:: classref-signal
  284. **button_clicked** **(** :ref:`TreeItem<class_TreeItem>` item, :ref:`int<class_int>` column, :ref:`int<class_int>` id, :ref:`int<class_int>` mouse_button_index **)**
  285. Emitted when a button on the tree was pressed (see :ref:`TreeItem.add_button<class_TreeItem_method_add_button>`).
  286. .. rst-class:: classref-item-separator
  287. ----
  288. .. _class_Tree_signal_cell_selected:
  289. .. rst-class:: classref-signal
  290. **cell_selected** **(** **)**
  291. Emitted when a cell is selected.
  292. .. rst-class:: classref-item-separator
  293. ----
  294. .. _class_Tree_signal_check_propagated_to_item:
  295. .. rst-class:: classref-signal
  296. **check_propagated_to_item** **(** :ref:`TreeItem<class_TreeItem>` item, :ref:`int<class_int>` column **)**
  297. 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.
  298. .. rst-class:: classref-item-separator
  299. ----
  300. .. _class_Tree_signal_column_title_clicked:
  301. .. rst-class:: classref-signal
  302. **column_title_clicked** **(** :ref:`int<class_int>` column, :ref:`int<class_int>` mouse_button_index **)**
  303. 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>`.
  304. .. rst-class:: classref-item-separator
  305. ----
  306. .. _class_Tree_signal_custom_item_clicked:
  307. .. rst-class:: classref-signal
  308. **custom_item_clicked** **(** :ref:`int<class_int>` mouse_button_index **)**
  309. Emitted when an item with :ref:`TreeItem.CELL_MODE_CUSTOM<class_TreeItem_constant_CELL_MODE_CUSTOM>` is clicked with a mouse button.
  310. .. rst-class:: classref-item-separator
  311. ----
  312. .. _class_Tree_signal_custom_popup_edited:
  313. .. rst-class:: classref-signal
  314. **custom_popup_edited** **(** :ref:`bool<class_bool>` arrow_clicked **)**
  315. Emitted when a cell with the :ref:`TreeItem.CELL_MODE_CUSTOM<class_TreeItem_constant_CELL_MODE_CUSTOM>` is clicked to be edited.
  316. .. rst-class:: classref-item-separator
  317. ----
  318. .. _class_Tree_signal_empty_clicked:
  319. .. rst-class:: classref-signal
  320. **empty_clicked** **(** :ref:`Vector2<class_Vector2>` position, :ref:`int<class_int>` mouse_button_index **)**
  321. Emitted when a mouse button is clicked in the empty space of the tree.
  322. .. rst-class:: classref-item-separator
  323. ----
  324. .. _class_Tree_signal_item_activated:
  325. .. rst-class:: classref-signal
  326. **item_activated** **(** **)**
  327. 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).
  328. .. rst-class:: classref-item-separator
  329. ----
  330. .. _class_Tree_signal_item_collapsed:
  331. .. rst-class:: classref-signal
  332. **item_collapsed** **(** :ref:`TreeItem<class_TreeItem>` item **)**
  333. Emitted when an item is collapsed by a click on the folding arrow.
  334. .. rst-class:: classref-item-separator
  335. ----
  336. .. _class_Tree_signal_item_edited:
  337. .. rst-class:: classref-signal
  338. **item_edited** **(** **)**
  339. Emitted when an item is edited.
  340. .. rst-class:: classref-item-separator
  341. ----
  342. .. _class_Tree_signal_item_icon_double_clicked:
  343. .. rst-class:: classref-signal
  344. **item_icon_double_clicked** **(** **)**
  345. 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>`.
  346. .. rst-class:: classref-item-separator
  347. ----
  348. .. _class_Tree_signal_item_mouse_selected:
  349. .. rst-class:: classref-signal
  350. **item_mouse_selected** **(** :ref:`Vector2<class_Vector2>` position, :ref:`int<class_int>` mouse_button_index **)**
  351. Emitted when an item is selected with a mouse button.
  352. .. rst-class:: classref-item-separator
  353. ----
  354. .. _class_Tree_signal_item_selected:
  355. .. rst-class:: classref-signal
  356. **item_selected** **(** **)**
  357. Emitted when an item is selected.
  358. .. rst-class:: classref-item-separator
  359. ----
  360. .. _class_Tree_signal_multi_selected:
  361. .. rst-class:: classref-signal
  362. **multi_selected** **(** :ref:`TreeItem<class_TreeItem>` item, :ref:`int<class_int>` column, :ref:`bool<class_bool>` selected **)**
  363. Emitted instead of :ref:`item_selected<class_Tree_signal_item_selected>` if :ref:`select_mode<class_Tree_property_select_mode>` is set to :ref:`SELECT_MULTI<class_Tree_constant_SELECT_MULTI>`.
  364. .. rst-class:: classref-item-separator
  365. ----
  366. .. _class_Tree_signal_nothing_selected:
  367. .. rst-class:: classref-signal
  368. **nothing_selected** **(** **)**
  369. Emitted when a left mouse button click does not select any item.
  370. .. rst-class:: classref-section-separator
  371. ----
  372. .. rst-class:: classref-descriptions-group
  373. Enumerations
  374. ------------
  375. .. _enum_Tree_SelectMode:
  376. .. rst-class:: classref-enumeration
  377. enum **SelectMode**:
  378. .. _class_Tree_constant_SELECT_SINGLE:
  379. .. rst-class:: classref-enumeration-constant
  380. :ref:`SelectMode<enum_Tree_SelectMode>` **SELECT_SINGLE** = ``0``
  381. 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.
  382. 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.
  383. .. _class_Tree_constant_SELECT_ROW:
  384. .. rst-class:: classref-enumeration-constant
  385. :ref:`SelectMode<enum_Tree_SelectMode>` **SELECT_ROW** = ``1``
  386. 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.
  387. 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.
  388. .. _class_Tree_constant_SELECT_MULTI:
  389. .. rst-class:: classref-enumeration-constant
  390. :ref:`SelectMode<enum_Tree_SelectMode>` **SELECT_MULTI** = ``2``
  391. 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.
  392. The focus cursor is visible in this mode, the item or column under the cursor is not necessarily selected.
  393. .. rst-class:: classref-item-separator
  394. ----
  395. .. _enum_Tree_DropModeFlags:
  396. .. rst-class:: classref-enumeration
  397. enum **DropModeFlags**:
  398. .. _class_Tree_constant_DROP_MODE_DISABLED:
  399. .. rst-class:: classref-enumeration-constant
  400. :ref:`DropModeFlags<enum_Tree_DropModeFlags>` **DROP_MODE_DISABLED** = ``0``
  401. 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>`.
  402. \ **Note:** This is the default flag, it has no effect when combined with other flags.
  403. .. _class_Tree_constant_DROP_MODE_ON_ITEM:
  404. .. rst-class:: classref-enumeration-constant
  405. :ref:`DropModeFlags<enum_Tree_DropModeFlags>` **DROP_MODE_ON_ITEM** = ``1``
  406. Enables the "on item" drop section. This drop section covers the entire item.
  407. When combined with :ref:`DROP_MODE_INBETWEEN<class_Tree_constant_DROP_MODE_INBETWEEN>`, this drop section halves the height and stays centered vertically.
  408. .. _class_Tree_constant_DROP_MODE_INBETWEEN:
  409. .. rst-class:: classref-enumeration-constant
  410. :ref:`DropModeFlags<enum_Tree_DropModeFlags>` **DROP_MODE_INBETWEEN** = ``2``
  411. 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.
  412. 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.
  413. .. rst-class:: classref-section-separator
  414. ----
  415. .. rst-class:: classref-descriptions-group
  416. Property Descriptions
  417. ---------------------
  418. .. _class_Tree_property_allow_reselect:
  419. .. rst-class:: classref-property
  420. :ref:`bool<class_bool>` **allow_reselect** = ``false``
  421. .. rst-class:: classref-property-setget
  422. - void **set_allow_reselect** **(** :ref:`bool<class_bool>` value **)**
  423. - :ref:`bool<class_bool>` **get_allow_reselect** **(** **)**
  424. If ``true``, the currently selected cell may be selected again.
  425. .. rst-class:: classref-item-separator
  426. ----
  427. .. _class_Tree_property_allow_rmb_select:
  428. .. rst-class:: classref-property
  429. :ref:`bool<class_bool>` **allow_rmb_select** = ``false``
  430. .. rst-class:: classref-property-setget
  431. - void **set_allow_rmb_select** **(** :ref:`bool<class_bool>` value **)**
  432. - :ref:`bool<class_bool>` **get_allow_rmb_select** **(** **)**
  433. If ``true``, a right mouse button click can select items.
  434. .. rst-class:: classref-item-separator
  435. ----
  436. .. _class_Tree_property_allow_search:
  437. .. rst-class:: classref-property
  438. :ref:`bool<class_bool>` **allow_search** = ``true``
  439. .. rst-class:: classref-property-setget
  440. - void **set_allow_search** **(** :ref:`bool<class_bool>` value **)**
  441. - :ref:`bool<class_bool>` **get_allow_search** **(** **)**
  442. If ``true``, allows navigating the **Tree** with letter keys through incremental search.
  443. .. rst-class:: classref-item-separator
  444. ----
  445. .. _class_Tree_property_column_titles_visible:
  446. .. rst-class:: classref-property
  447. :ref:`bool<class_bool>` **column_titles_visible** = ``false``
  448. .. rst-class:: classref-property-setget
  449. - void **set_column_titles_visible** **(** :ref:`bool<class_bool>` value **)**
  450. - :ref:`bool<class_bool>` **are_column_titles_visible** **(** **)**
  451. If ``true``, column titles are visible.
  452. .. rst-class:: classref-item-separator
  453. ----
  454. .. _class_Tree_property_columns:
  455. .. rst-class:: classref-property
  456. :ref:`int<class_int>` **columns** = ``1``
  457. .. rst-class:: classref-property-setget
  458. - void **set_columns** **(** :ref:`int<class_int>` value **)**
  459. - :ref:`int<class_int>` **get_columns** **(** **)**
  460. The number of columns.
  461. .. rst-class:: classref-item-separator
  462. ----
  463. .. _class_Tree_property_drop_mode_flags:
  464. .. rst-class:: classref-property
  465. :ref:`int<class_int>` **drop_mode_flags** = ``0``
  466. .. rst-class:: classref-property-setget
  467. - void **set_drop_mode_flags** **(** :ref:`int<class_int>` value **)**
  468. - :ref:`int<class_int>` **get_drop_mode_flags** **(** **)**
  469. 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_private_method__can_drop_data>` is recommended.
  470. This controls the drop sections, i.e. the decision and drawing of possible drop locations based on the mouse position.
  471. .. rst-class:: classref-item-separator
  472. ----
  473. .. _class_Tree_property_enable_recursive_folding:
  474. .. rst-class:: classref-property
  475. :ref:`bool<class_bool>` **enable_recursive_folding** = ``true``
  476. .. rst-class:: classref-property-setget
  477. - void **set_enable_recursive_folding** **(** :ref:`bool<class_bool>` value **)**
  478. - :ref:`bool<class_bool>` **is_recursive_folding_enabled** **(** **)**
  479. 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.
  480. .. rst-class:: classref-item-separator
  481. ----
  482. .. _class_Tree_property_hide_folding:
  483. .. rst-class:: classref-property
  484. :ref:`bool<class_bool>` **hide_folding** = ``false``
  485. .. rst-class:: classref-property-setget
  486. - void **set_hide_folding** **(** :ref:`bool<class_bool>` value **)**
  487. - :ref:`bool<class_bool>` **is_folding_hidden** **(** **)**
  488. If ``true``, the folding arrow is hidden.
  489. .. rst-class:: classref-item-separator
  490. ----
  491. .. _class_Tree_property_hide_root:
  492. .. rst-class:: classref-property
  493. :ref:`bool<class_bool>` **hide_root** = ``false``
  494. .. rst-class:: classref-property-setget
  495. - void **set_hide_root** **(** :ref:`bool<class_bool>` value **)**
  496. - :ref:`bool<class_bool>` **is_root_hidden** **(** **)**
  497. If ``true``, the tree's root is hidden.
  498. .. rst-class:: classref-item-separator
  499. ----
  500. .. _class_Tree_property_scroll_horizontal_enabled:
  501. .. rst-class:: classref-property
  502. :ref:`bool<class_bool>` **scroll_horizontal_enabled** = ``true``
  503. .. rst-class:: classref-property-setget
  504. - void **set_h_scroll_enabled** **(** :ref:`bool<class_bool>` value **)**
  505. - :ref:`bool<class_bool>` **is_h_scroll_enabled** **(** **)**
  506. If ``true``, enables horizontal scrolling.
  507. .. rst-class:: classref-item-separator
  508. ----
  509. .. _class_Tree_property_scroll_vertical_enabled:
  510. .. rst-class:: classref-property
  511. :ref:`bool<class_bool>` **scroll_vertical_enabled** = ``true``
  512. .. rst-class:: classref-property-setget
  513. - void **set_v_scroll_enabled** **(** :ref:`bool<class_bool>` value **)**
  514. - :ref:`bool<class_bool>` **is_v_scroll_enabled** **(** **)**
  515. If ``true``, enables vertical scrolling.
  516. .. rst-class:: classref-item-separator
  517. ----
  518. .. _class_Tree_property_select_mode:
  519. .. rst-class:: classref-property
  520. :ref:`SelectMode<enum_Tree_SelectMode>` **select_mode** = ``0``
  521. .. rst-class:: classref-property-setget
  522. - void **set_select_mode** **(** :ref:`SelectMode<enum_Tree_SelectMode>` value **)**
  523. - :ref:`SelectMode<enum_Tree_SelectMode>` **get_select_mode** **(** **)**
  524. Allows single or multiple selection. See the :ref:`SelectMode<enum_Tree_SelectMode>` constants.
  525. .. rst-class:: classref-section-separator
  526. ----
  527. .. rst-class:: classref-descriptions-group
  528. Method Descriptions
  529. -------------------
  530. .. _class_Tree_method_clear:
  531. .. rst-class:: classref-method
  532. void **clear** **(** **)**
  533. Clears the tree. This removes all items.
  534. .. rst-class:: classref-item-separator
  535. ----
  536. .. _class_Tree_method_create_item:
  537. .. rst-class:: classref-method
  538. :ref:`TreeItem<class_TreeItem>` **create_item** **(** :ref:`TreeItem<class_TreeItem>` parent=null, :ref:`int<class_int>` index=-1 **)**
  539. 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``.
  540. 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.
  541. The new item will be the ``index``-th child of parent, or it will be the last child if there are not enough siblings.
  542. .. rst-class:: classref-item-separator
  543. ----
  544. .. _class_Tree_method_deselect_all:
  545. .. rst-class:: classref-method
  546. void **deselect_all** **(** **)**
  547. Deselects all tree items (rows and columns). In :ref:`SELECT_MULTI<class_Tree_constant_SELECT_MULTI>` mode also removes selection cursor.
  548. .. rst-class:: classref-item-separator
  549. ----
  550. .. _class_Tree_method_edit_selected:
  551. .. rst-class:: classref-method
  552. :ref:`bool<class_bool>` **edit_selected** **(** :ref:`bool<class_bool>` force_edit=false **)**
  553. Edits the selected tree item as if it was clicked.
  554. Either the item must be set editable with :ref:`TreeItem.set_editable<class_TreeItem_method_set_editable>` or ``force_edit`` must be ``true``.
  555. Returns ``true`` if the item could be edited. Fails if no item is selected.
  556. .. rst-class:: classref-item-separator
  557. ----
  558. .. _class_Tree_method_ensure_cursor_is_visible:
  559. .. rst-class:: classref-method
  560. void **ensure_cursor_is_visible** **(** **)**
  561. Makes the currently focused cell visible.
  562. 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.
  563. \ **Note:** Despite the name of this method, the focus cursor itself is only visible in :ref:`SELECT_MULTI<class_Tree_constant_SELECT_MULTI>` mode.
  564. .. rst-class:: classref-item-separator
  565. ----
  566. .. _class_Tree_method_get_button_id_at_position:
  567. .. rst-class:: classref-method
  568. :ref:`int<class_int>` **get_button_id_at_position** **(** :ref:`Vector2<class_Vector2>` position **)** |const|
  569. Returns the button ID at ``position``, or -1 if no button is there.
  570. .. rst-class:: classref-item-separator
  571. ----
  572. .. _class_Tree_method_get_column_at_position:
  573. .. rst-class:: classref-method
  574. :ref:`int<class_int>` **get_column_at_position** **(** :ref:`Vector2<class_Vector2>` position **)** |const|
  575. Returns the column index at ``position``, or -1 if no item is there.
  576. .. rst-class:: classref-item-separator
  577. ----
  578. .. _class_Tree_method_get_column_expand_ratio:
  579. .. rst-class:: classref-method
  580. :ref:`int<class_int>` **get_column_expand_ratio** **(** :ref:`int<class_int>` column **)** |const|
  581. Returns the expand ratio assigned to the column.
  582. .. rst-class:: classref-item-separator
  583. ----
  584. .. _class_Tree_method_get_column_title:
  585. .. rst-class:: classref-method
  586. :ref:`String<class_String>` **get_column_title** **(** :ref:`int<class_int>` column **)** |const|
  587. Returns the column's title.
  588. .. rst-class:: classref-item-separator
  589. ----
  590. .. _class_Tree_method_get_column_title_alignment:
  591. .. rst-class:: classref-method
  592. :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` **get_column_title_alignment** **(** :ref:`int<class_int>` column **)** |const|
  593. Returns the column title alignment.
  594. .. rst-class:: classref-item-separator
  595. ----
  596. .. _class_Tree_method_get_column_title_direction:
  597. .. rst-class:: classref-method
  598. :ref:`TextDirection<enum_Control_TextDirection>` **get_column_title_direction** **(** :ref:`int<class_int>` column **)** |const|
  599. Returns column title base writing direction.
  600. .. rst-class:: classref-item-separator
  601. ----
  602. .. _class_Tree_method_get_column_title_language:
  603. .. rst-class:: classref-method
  604. :ref:`String<class_String>` **get_column_title_language** **(** :ref:`int<class_int>` column **)** |const|
  605. Returns column title language code.
  606. .. rst-class:: classref-item-separator
  607. ----
  608. .. _class_Tree_method_get_column_width:
  609. .. rst-class:: classref-method
  610. :ref:`int<class_int>` **get_column_width** **(** :ref:`int<class_int>` column **)** |const|
  611. Returns the column's width in pixels.
  612. .. rst-class:: classref-item-separator
  613. ----
  614. .. _class_Tree_method_get_custom_popup_rect:
  615. .. rst-class:: classref-method
  616. :ref:`Rect2<class_Rect2>` **get_custom_popup_rect** **(** **)** |const|
  617. 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>`.
  618. .. rst-class:: classref-item-separator
  619. ----
  620. .. _class_Tree_method_get_drop_section_at_position:
  621. .. rst-class:: classref-method
  622. :ref:`int<class_int>` **get_drop_section_at_position** **(** :ref:`Vector2<class_Vector2>` position **)** |const|
  623. Returns the drop section at ``position``, or -100 if no item is there.
  624. 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.
  625. 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>`.
  626. .. rst-class:: classref-item-separator
  627. ----
  628. .. _class_Tree_method_get_edited:
  629. .. rst-class:: classref-method
  630. :ref:`TreeItem<class_TreeItem>` **get_edited** **(** **)** |const|
  631. Returns the currently edited item. Can be used with :ref:`item_edited<class_Tree_signal_item_edited>` to get the item that was modified.
  632. .. tabs::
  633. .. code-tab:: gdscript
  634. func _ready():
  635. $Tree.item_edited.connect(on_Tree_item_edited)
  636. func on_Tree_item_edited():
  637. print($Tree.get_edited()) # This item just got edited (e.g. checked).
  638. .. code-tab:: csharp
  639. public override void _Ready()
  640. {
  641. GetNode<Tree>("Tree").ItemEdited += OnTreeItemEdited;
  642. }
  643. public void OnTreeItemEdited()
  644. {
  645. GD.Print(GetNode<Tree>("Tree").GetEdited()); // This item just got edited (e.g. checked).
  646. }
  647. .. rst-class:: classref-item-separator
  648. ----
  649. .. _class_Tree_method_get_edited_column:
  650. .. rst-class:: classref-method
  651. :ref:`int<class_int>` **get_edited_column** **(** **)** |const|
  652. Returns the column for the currently edited item.
  653. .. rst-class:: classref-item-separator
  654. ----
  655. .. _class_Tree_method_get_item_area_rect:
  656. .. rst-class:: classref-method
  657. :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|
  658. 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.
  659. .. rst-class:: classref-item-separator
  660. ----
  661. .. _class_Tree_method_get_item_at_position:
  662. .. rst-class:: classref-method
  663. :ref:`TreeItem<class_TreeItem>` **get_item_at_position** **(** :ref:`Vector2<class_Vector2>` position **)** |const|
  664. Returns the tree item at the specified position (relative to the tree origin position).
  665. .. rst-class:: classref-item-separator
  666. ----
  667. .. _class_Tree_method_get_next_selected:
  668. .. rst-class:: classref-method
  669. :ref:`TreeItem<class_TreeItem>` **get_next_selected** **(** :ref:`TreeItem<class_TreeItem>` from **)**
  670. Returns the next selected :ref:`TreeItem<class_TreeItem>` after the given one, or ``null`` if the end is reached.
  671. If ``from`` is ``null``, this returns the first selected item.
  672. .. rst-class:: classref-item-separator
  673. ----
  674. .. _class_Tree_method_get_pressed_button:
  675. .. rst-class:: classref-method
  676. :ref:`int<class_int>` **get_pressed_button** **(** **)** |const|
  677. Returns the last pressed button's index.
  678. .. rst-class:: classref-item-separator
  679. ----
  680. .. _class_Tree_method_get_root:
  681. .. rst-class:: classref-method
  682. :ref:`TreeItem<class_TreeItem>` **get_root** **(** **)** |const|
  683. Returns the tree's root item, or ``null`` if the tree is empty.
  684. .. rst-class:: classref-item-separator
  685. ----
  686. .. _class_Tree_method_get_scroll:
  687. .. rst-class:: classref-method
  688. :ref:`Vector2<class_Vector2>` **get_scroll** **(** **)** |const|
  689. Returns the current scrolling position.
  690. .. rst-class:: classref-item-separator
  691. ----
  692. .. _class_Tree_method_get_selected:
  693. .. rst-class:: classref-method
  694. :ref:`TreeItem<class_TreeItem>` **get_selected** **(** **)** |const|
  695. Returns the currently focused item, or ``null`` if no item is focused.
  696. 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.
  697. To get the currently selected item(s), use :ref:`get_next_selected<class_Tree_method_get_next_selected>`.
  698. .. rst-class:: classref-item-separator
  699. ----
  700. .. _class_Tree_method_get_selected_column:
  701. .. rst-class:: classref-method
  702. :ref:`int<class_int>` **get_selected_column** **(** **)** |const|
  703. Returns the currently focused column, or -1 if no column is focused.
  704. 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.
  705. To tell whether a column of an item is selected, use :ref:`TreeItem.is_selected<class_TreeItem_method_is_selected>`.
  706. .. rst-class:: classref-item-separator
  707. ----
  708. .. _class_Tree_method_is_column_clipping_content:
  709. .. rst-class:: classref-method
  710. :ref:`bool<class_bool>` **is_column_clipping_content** **(** :ref:`int<class_int>` column **)** |const|
  711. Returns ``true`` if the column has enabled clipping (see :ref:`set_column_clip_content<class_Tree_method_set_column_clip_content>`).
  712. .. rst-class:: classref-item-separator
  713. ----
  714. .. _class_Tree_method_is_column_expanding:
  715. .. rst-class:: classref-method
  716. :ref:`bool<class_bool>` **is_column_expanding** **(** :ref:`int<class_int>` column **)** |const|
  717. Returns ``true`` if the column has enabled expanding (see :ref:`set_column_expand<class_Tree_method_set_column_expand>`).
  718. .. rst-class:: classref-item-separator
  719. ----
  720. .. _class_Tree_method_scroll_to_item:
  721. .. rst-class:: classref-method
  722. void **scroll_to_item** **(** :ref:`TreeItem<class_TreeItem>` item, :ref:`bool<class_bool>` center_on_item=false **)**
  723. Causes the **Tree** to jump to the specified :ref:`TreeItem<class_TreeItem>`.
  724. .. rst-class:: classref-item-separator
  725. ----
  726. .. _class_Tree_method_set_column_clip_content:
  727. .. rst-class:: classref-method
  728. void **set_column_clip_content** **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` enable **)**
  729. Allows to enable clipping for column's content, making the content size ignored.
  730. .. rst-class:: classref-item-separator
  731. ----
  732. .. _class_Tree_method_set_column_custom_minimum_width:
  733. .. rst-class:: classref-method
  734. void **set_column_custom_minimum_width** **(** :ref:`int<class_int>` column, :ref:`int<class_int>` min_width **)**
  735. 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>`.
  736. .. rst-class:: classref-item-separator
  737. ----
  738. .. _class_Tree_method_set_column_expand:
  739. .. rst-class:: classref-method
  740. void **set_column_expand** **(** :ref:`int<class_int>` column, :ref:`bool<class_bool>` expand **)**
  741. 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>`).
  742. .. rst-class:: classref-item-separator
  743. ----
  744. .. _class_Tree_method_set_column_expand_ratio:
  745. .. rst-class:: classref-method
  746. void **set_column_expand_ratio** **(** :ref:`int<class_int>` column, :ref:`int<class_int>` ratio **)**
  747. Sets the relative expand ratio for a column. See :ref:`set_column_expand<class_Tree_method_set_column_expand>`.
  748. .. rst-class:: classref-item-separator
  749. ----
  750. .. _class_Tree_method_set_column_title:
  751. .. rst-class:: classref-method
  752. void **set_column_title** **(** :ref:`int<class_int>` column, :ref:`String<class_String>` title **)**
  753. Sets the title of a column.
  754. .. rst-class:: classref-item-separator
  755. ----
  756. .. _class_Tree_method_set_column_title_alignment:
  757. .. rst-class:: classref-method
  758. void **set_column_title_alignment** **(** :ref:`int<class_int>` column, :ref:`HorizontalAlignment<enum_@GlobalScope_HorizontalAlignment>` title_alignment **)**
  759. Sets the column title alignment. Note that :ref:`@GlobalScope.HORIZONTAL_ALIGNMENT_FILL<class_@GlobalScope_constant_HORIZONTAL_ALIGNMENT_FILL>` is not supported for column titles.
  760. .. rst-class:: classref-item-separator
  761. ----
  762. .. _class_Tree_method_set_column_title_direction:
  763. .. rst-class:: classref-method
  764. void **set_column_title_direction** **(** :ref:`int<class_int>` column, :ref:`TextDirection<enum_Control_TextDirection>` direction **)**
  765. Sets column title base writing direction.
  766. .. rst-class:: classref-item-separator
  767. ----
  768. .. _class_Tree_method_set_column_title_language:
  769. .. rst-class:: classref-method
  770. void **set_column_title_language** **(** :ref:`int<class_int>` column, :ref:`String<class_String>` language **)**
  771. Sets language code of column title used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
  772. .. rst-class:: classref-item-separator
  773. ----
  774. .. _class_Tree_method_set_selected:
  775. .. rst-class:: classref-method
  776. void **set_selected** **(** :ref:`TreeItem<class_TreeItem>` item, :ref:`int<class_int>` column **)**
  777. Selects the specified :ref:`TreeItem<class_TreeItem>` and column.
  778. .. rst-class:: classref-section-separator
  779. ----
  780. .. rst-class:: classref-descriptions-group
  781. Theme Property Descriptions
  782. ---------------------------
  783. .. _class_Tree_theme_color_children_hl_line_color:
  784. .. rst-class:: classref-themeproperty
  785. :ref:`Color<class_Color>` **children_hl_line_color** = ``Color(0.27, 0.27, 0.27, 1)``
  786. The :ref:`Color<class_Color>` of the relationship lines between the selected :ref:`TreeItem<class_TreeItem>` and its children.
  787. .. rst-class:: classref-item-separator
  788. ----
  789. .. _class_Tree_theme_color_custom_button_font_highlight:
  790. .. rst-class:: classref-themeproperty
  791. :ref:`Color<class_Color>` **custom_button_font_highlight** = ``Color(0.95, 0.95, 0.95, 1)``
  792. Text :ref:`Color<class_Color>` for a :ref:`TreeItem.CELL_MODE_CUSTOM<class_TreeItem_constant_CELL_MODE_CUSTOM>` mode cell when it's hovered.
  793. .. rst-class:: classref-item-separator
  794. ----
  795. .. _class_Tree_theme_color_drop_position_color:
  796. .. rst-class:: classref-themeproperty
  797. :ref:`Color<class_Color>` **drop_position_color** = ``Color(1, 1, 1, 1)``
  798. :ref:`Color<class_Color>` used to draw possible drop locations. See :ref:`DropModeFlags<enum_Tree_DropModeFlags>` constants for further description of drop locations.
  799. .. rst-class:: classref-item-separator
  800. ----
  801. .. _class_Tree_theme_color_font_color:
  802. .. rst-class:: classref-themeproperty
  803. :ref:`Color<class_Color>` **font_color** = ``Color(0.7, 0.7, 0.7, 1)``
  804. Default text :ref:`Color<class_Color>` of the item.
  805. .. rst-class:: classref-item-separator
  806. ----
  807. .. _class_Tree_theme_color_font_outline_color:
  808. .. rst-class:: classref-themeproperty
  809. :ref:`Color<class_Color>` **font_outline_color** = ``Color(1, 1, 1, 1)``
  810. The tint of text outline of the item.
  811. .. rst-class:: classref-item-separator
  812. ----
  813. .. _class_Tree_theme_color_font_selected_color:
  814. .. rst-class:: classref-themeproperty
  815. :ref:`Color<class_Color>` **font_selected_color** = ``Color(1, 1, 1, 1)``
  816. Text :ref:`Color<class_Color>` used when the item is selected.
  817. .. rst-class:: classref-item-separator
  818. ----
  819. .. _class_Tree_theme_color_guide_color:
  820. .. rst-class:: classref-themeproperty
  821. :ref:`Color<class_Color>` **guide_color** = ``Color(0.7, 0.7, 0.7, 0.25)``
  822. :ref:`Color<class_Color>` of the guideline.
  823. .. rst-class:: classref-item-separator
  824. ----
  825. .. _class_Tree_theme_color_parent_hl_line_color:
  826. .. rst-class:: classref-themeproperty
  827. :ref:`Color<class_Color>` **parent_hl_line_color** = ``Color(0.27, 0.27, 0.27, 1)``
  828. The :ref:`Color<class_Color>` of the relationship lines between the selected :ref:`TreeItem<class_TreeItem>` and its parents.
  829. .. rst-class:: classref-item-separator
  830. ----
  831. .. _class_Tree_theme_color_relationship_line_color:
  832. .. rst-class:: classref-themeproperty
  833. :ref:`Color<class_Color>` **relationship_line_color** = ``Color(0.27, 0.27, 0.27, 1)``
  834. The default :ref:`Color<class_Color>` of the relationship lines.
  835. .. rst-class:: classref-item-separator
  836. ----
  837. .. _class_Tree_theme_color_title_button_color:
  838. .. rst-class:: classref-themeproperty
  839. :ref:`Color<class_Color>` **title_button_color** = ``Color(0.875, 0.875, 0.875, 1)``
  840. Default text :ref:`Color<class_Color>` of the title button.
  841. .. rst-class:: classref-item-separator
  842. ----
  843. .. _class_Tree_theme_constant_button_margin:
  844. .. rst-class:: classref-themeproperty
  845. :ref:`int<class_int>` **button_margin** = ``4``
  846. The horizontal space between each button in a cell.
  847. .. rst-class:: classref-item-separator
  848. ----
  849. .. _class_Tree_theme_constant_children_hl_line_width:
  850. .. rst-class:: classref-themeproperty
  851. :ref:`int<class_int>` **children_hl_line_width** = ``1``
  852. The width of the relationship lines between the selected :ref:`TreeItem<class_TreeItem>` and its children.
  853. .. rst-class:: classref-item-separator
  854. ----
  855. .. _class_Tree_theme_constant_draw_guides:
  856. .. rst-class:: classref-themeproperty
  857. :ref:`int<class_int>` **draw_guides** = ``1``
  858. Draws the guidelines if not zero, this acts as a boolean. The guideline is a horizontal line drawn at the bottom of each item.
  859. .. rst-class:: classref-item-separator
  860. ----
  861. .. _class_Tree_theme_constant_draw_relationship_lines:
  862. .. rst-class:: classref-themeproperty
  863. :ref:`int<class_int>` **draw_relationship_lines** = ``0``
  864. 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.
  865. .. rst-class:: classref-item-separator
  866. ----
  867. .. _class_Tree_theme_constant_h_separation:
  868. .. rst-class:: classref-themeproperty
  869. :ref:`int<class_int>` **h_separation** = ``4``
  870. The horizontal space between item cells. This is also used as the margin at the start of an item when folding is disabled.
  871. .. rst-class:: classref-item-separator
  872. ----
  873. .. _class_Tree_theme_constant_icon_max_width:
  874. .. rst-class:: classref-themeproperty
  875. :ref:`int<class_int>` **icon_max_width** = ``0``
  876. 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.
  877. .. rst-class:: classref-item-separator
  878. ----
  879. .. _class_Tree_theme_constant_inner_item_margin_bottom:
  880. .. rst-class:: classref-themeproperty
  881. :ref:`int<class_int>` **inner_item_margin_bottom** = ``0``
  882. The inner bottom margin of an item.
  883. .. rst-class:: classref-item-separator
  884. ----
  885. .. _class_Tree_theme_constant_inner_item_margin_left:
  886. .. rst-class:: classref-themeproperty
  887. :ref:`int<class_int>` **inner_item_margin_left** = ``0``
  888. The inner left margin of an item.
  889. .. rst-class:: classref-item-separator
  890. ----
  891. .. _class_Tree_theme_constant_inner_item_margin_right:
  892. .. rst-class:: classref-themeproperty
  893. :ref:`int<class_int>` **inner_item_margin_right** = ``0``
  894. The inner right margin of an item.
  895. .. rst-class:: classref-item-separator
  896. ----
  897. .. _class_Tree_theme_constant_inner_item_margin_top:
  898. .. rst-class:: classref-themeproperty
  899. :ref:`int<class_int>` **inner_item_margin_top** = ``0``
  900. The inner top margin of an item.
  901. .. rst-class:: classref-item-separator
  902. ----
  903. .. _class_Tree_theme_constant_item_margin:
  904. .. rst-class:: classref-themeproperty
  905. :ref:`int<class_int>` **item_margin** = ``16``
  906. The horizontal margin at the start of an item. This is used when folding is enabled for the item.
  907. .. rst-class:: classref-item-separator
  908. ----
  909. .. _class_Tree_theme_constant_outline_size:
  910. .. rst-class:: classref-themeproperty
  911. :ref:`int<class_int>` **outline_size** = ``0``
  912. The size of the text outline.
  913. \ **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.
  914. .. rst-class:: classref-item-separator
  915. ----
  916. .. _class_Tree_theme_constant_parent_hl_line_margin:
  917. .. rst-class:: classref-themeproperty
  918. :ref:`int<class_int>` **parent_hl_line_margin** = ``0``
  919. 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.
  920. .. rst-class:: classref-item-separator
  921. ----
  922. .. _class_Tree_theme_constant_parent_hl_line_width:
  923. .. rst-class:: classref-themeproperty
  924. :ref:`int<class_int>` **parent_hl_line_width** = ``1``
  925. The width of the relationship lines between the selected :ref:`TreeItem<class_TreeItem>` and its parents.
  926. .. rst-class:: classref-item-separator
  927. ----
  928. .. _class_Tree_theme_constant_relationship_line_width:
  929. .. rst-class:: classref-themeproperty
  930. :ref:`int<class_int>` **relationship_line_width** = ``1``
  931. The default width of the relationship lines.
  932. .. rst-class:: classref-item-separator
  933. ----
  934. .. _class_Tree_theme_constant_scroll_border:
  935. .. rst-class:: classref-themeproperty
  936. :ref:`int<class_int>` **scroll_border** = ``4``
  937. The maximum distance between the mouse cursor and the control's border to trigger border scrolling when dragging.
  938. .. rst-class:: classref-item-separator
  939. ----
  940. .. _class_Tree_theme_constant_scroll_speed:
  941. .. rst-class:: classref-themeproperty
  942. :ref:`int<class_int>` **scroll_speed** = ``12``
  943. The speed of border scrolling.
  944. .. rst-class:: classref-item-separator
  945. ----
  946. .. _class_Tree_theme_constant_scrollbar_h_separation:
  947. .. rst-class:: classref-themeproperty
  948. :ref:`int<class_int>` **scrollbar_h_separation** = ``4``
  949. The horizontal separation of tree content and scrollbar.
  950. .. rst-class:: classref-item-separator
  951. ----
  952. .. _class_Tree_theme_constant_scrollbar_margin_bottom:
  953. .. rst-class:: classref-themeproperty
  954. :ref:`int<class_int>` **scrollbar_margin_bottom** = ``-1``
  955. The bottom margin of the scrollbars. When negative, uses :ref:`panel<class_Tree_theme_style_panel>` bottom margin.
  956. .. rst-class:: classref-item-separator
  957. ----
  958. .. _class_Tree_theme_constant_scrollbar_margin_left:
  959. .. rst-class:: classref-themeproperty
  960. :ref:`int<class_int>` **scrollbar_margin_left** = ``-1``
  961. The left margin of the horizontal scrollbar. When negative, uses :ref:`panel<class_Tree_theme_style_panel>` left margin.
  962. .. rst-class:: classref-item-separator
  963. ----
  964. .. _class_Tree_theme_constant_scrollbar_margin_right:
  965. .. rst-class:: classref-themeproperty
  966. :ref:`int<class_int>` **scrollbar_margin_right** = ``-1``
  967. The right margin of the scrollbars. When negative, uses :ref:`panel<class_Tree_theme_style_panel>` right margin.
  968. .. rst-class:: classref-item-separator
  969. ----
  970. .. _class_Tree_theme_constant_scrollbar_margin_top:
  971. .. rst-class:: classref-themeproperty
  972. :ref:`int<class_int>` **scrollbar_margin_top** = ``-1``
  973. The top margin of the vertical scrollbar. When negative, uses :ref:`panel<class_Tree_theme_style_panel>` top margin.
  974. .. rst-class:: classref-item-separator
  975. ----
  976. .. _class_Tree_theme_constant_scrollbar_v_separation:
  977. .. rst-class:: classref-themeproperty
  978. :ref:`int<class_int>` **scrollbar_v_separation** = ``4``
  979. The vertical separation of tree content and scrollbar.
  980. .. rst-class:: classref-item-separator
  981. ----
  982. .. _class_Tree_theme_constant_v_separation:
  983. .. rst-class:: classref-themeproperty
  984. :ref:`int<class_int>` **v_separation** = ``4``
  985. The vertical padding inside each item, i.e. the distance between the item's content and top/bottom border.
  986. .. rst-class:: classref-item-separator
  987. ----
  988. .. _class_Tree_theme_font_font:
  989. .. rst-class:: classref-themeproperty
  990. :ref:`Font<class_Font>` **font**
  991. :ref:`Font<class_Font>` of the item's text.
  992. .. rst-class:: classref-item-separator
  993. ----
  994. .. _class_Tree_theme_font_title_button_font:
  995. .. rst-class:: classref-themeproperty
  996. :ref:`Font<class_Font>` **title_button_font**
  997. :ref:`Font<class_Font>` of the title button's text.
  998. .. rst-class:: classref-item-separator
  999. ----
  1000. .. _class_Tree_theme_font_size_font_size:
  1001. .. rst-class:: classref-themeproperty
  1002. :ref:`int<class_int>` **font_size**
  1003. Font size of the item's text.
  1004. .. rst-class:: classref-item-separator
  1005. ----
  1006. .. _class_Tree_theme_font_size_title_button_font_size:
  1007. .. rst-class:: classref-themeproperty
  1008. :ref:`int<class_int>` **title_button_font_size**
  1009. Font size of the title button's text.
  1010. .. rst-class:: classref-item-separator
  1011. ----
  1012. .. _class_Tree_theme_icon_arrow:
  1013. .. rst-class:: classref-themeproperty
  1014. :ref:`Texture2D<class_Texture2D>` **arrow**
  1015. The arrow icon used when a foldable item is not collapsed.
  1016. .. rst-class:: classref-item-separator
  1017. ----
  1018. .. _class_Tree_theme_icon_arrow_collapsed:
  1019. .. rst-class:: classref-themeproperty
  1020. :ref:`Texture2D<class_Texture2D>` **arrow_collapsed**
  1021. The arrow icon used when a foldable item is collapsed (for left-to-right layouts).
  1022. .. rst-class:: classref-item-separator
  1023. ----
  1024. .. _class_Tree_theme_icon_arrow_collapsed_mirrored:
  1025. .. rst-class:: classref-themeproperty
  1026. :ref:`Texture2D<class_Texture2D>` **arrow_collapsed_mirrored**
  1027. The arrow icon used when a foldable item is collapsed (for right-to-left layouts).
  1028. .. rst-class:: classref-item-separator
  1029. ----
  1030. .. _class_Tree_theme_icon_checked:
  1031. .. rst-class:: classref-themeproperty
  1032. :ref:`Texture2D<class_Texture2D>` **checked**
  1033. The check icon to display when the :ref:`TreeItem.CELL_MODE_CHECK<class_TreeItem_constant_CELL_MODE_CHECK>` mode cell is checked.
  1034. .. rst-class:: classref-item-separator
  1035. ----
  1036. .. _class_Tree_theme_icon_indeterminate:
  1037. .. rst-class:: classref-themeproperty
  1038. :ref:`Texture2D<class_Texture2D>` **indeterminate**
  1039. The check icon to display when the :ref:`TreeItem.CELL_MODE_CHECK<class_TreeItem_constant_CELL_MODE_CHECK>` mode cell is indeterminate.
  1040. .. rst-class:: classref-item-separator
  1041. ----
  1042. .. _class_Tree_theme_icon_select_arrow:
  1043. .. rst-class:: classref-themeproperty
  1044. :ref:`Texture2D<class_Texture2D>` **select_arrow**
  1045. The arrow icon to display for the :ref:`TreeItem.CELL_MODE_RANGE<class_TreeItem_constant_CELL_MODE_RANGE>` mode cell.
  1046. .. rst-class:: classref-item-separator
  1047. ----
  1048. .. _class_Tree_theme_icon_unchecked:
  1049. .. rst-class:: classref-themeproperty
  1050. :ref:`Texture2D<class_Texture2D>` **unchecked**
  1051. The check icon to display when the :ref:`TreeItem.CELL_MODE_CHECK<class_TreeItem_constant_CELL_MODE_CHECK>` mode cell is unchecked.
  1052. .. rst-class:: classref-item-separator
  1053. ----
  1054. .. _class_Tree_theme_icon_updown:
  1055. .. rst-class:: classref-themeproperty
  1056. :ref:`Texture2D<class_Texture2D>` **updown**
  1057. The updown arrow icon to display for the :ref:`TreeItem.CELL_MODE_RANGE<class_TreeItem_constant_CELL_MODE_RANGE>` mode cell.
  1058. .. rst-class:: classref-item-separator
  1059. ----
  1060. .. _class_Tree_theme_style_button_pressed:
  1061. .. rst-class:: classref-themeproperty
  1062. :ref:`StyleBox<class_StyleBox>` **button_pressed**
  1063. :ref:`StyleBox<class_StyleBox>` used when a button in the tree is pressed.
  1064. .. rst-class:: classref-item-separator
  1065. ----
  1066. .. _class_Tree_theme_style_cursor:
  1067. .. rst-class:: classref-themeproperty
  1068. :ref:`StyleBox<class_StyleBox>` **cursor**
  1069. :ref:`StyleBox<class_StyleBox>` used for the cursor, when the **Tree** is being focused.
  1070. .. rst-class:: classref-item-separator
  1071. ----
  1072. .. _class_Tree_theme_style_cursor_unfocused:
  1073. .. rst-class:: classref-themeproperty
  1074. :ref:`StyleBox<class_StyleBox>` **cursor_unfocused**
  1075. :ref:`StyleBox<class_StyleBox>` used for the cursor, when the **Tree** is not being focused.
  1076. .. rst-class:: classref-item-separator
  1077. ----
  1078. .. _class_Tree_theme_style_custom_button:
  1079. .. rst-class:: classref-themeproperty
  1080. :ref:`StyleBox<class_StyleBox>` **custom_button**
  1081. Default :ref:`StyleBox<class_StyleBox>` for a :ref:`TreeItem.CELL_MODE_CUSTOM<class_TreeItem_constant_CELL_MODE_CUSTOM>` mode cell.
  1082. .. rst-class:: classref-item-separator
  1083. ----
  1084. .. _class_Tree_theme_style_custom_button_hover:
  1085. .. rst-class:: classref-themeproperty
  1086. :ref:`StyleBox<class_StyleBox>` **custom_button_hover**
  1087. :ref:`StyleBox<class_StyleBox>` for a :ref:`TreeItem.CELL_MODE_CUSTOM<class_TreeItem_constant_CELL_MODE_CUSTOM>` mode cell when it's hovered.
  1088. .. rst-class:: classref-item-separator
  1089. ----
  1090. .. _class_Tree_theme_style_custom_button_pressed:
  1091. .. rst-class:: classref-themeproperty
  1092. :ref:`StyleBox<class_StyleBox>` **custom_button_pressed**
  1093. :ref:`StyleBox<class_StyleBox>` for a :ref:`TreeItem.CELL_MODE_CUSTOM<class_TreeItem_constant_CELL_MODE_CUSTOM>` mode cell when it's pressed.
  1094. .. rst-class:: classref-item-separator
  1095. ----
  1096. .. _class_Tree_theme_style_focus:
  1097. .. rst-class:: classref-themeproperty
  1098. :ref:`StyleBox<class_StyleBox>` **focus**
  1099. The focused style for the **Tree**, drawn on top of everything.
  1100. .. rst-class:: classref-item-separator
  1101. ----
  1102. .. _class_Tree_theme_style_panel:
  1103. .. rst-class:: classref-themeproperty
  1104. :ref:`StyleBox<class_StyleBox>` **panel**
  1105. The background style for the **Tree**.
  1106. .. rst-class:: classref-item-separator
  1107. ----
  1108. .. _class_Tree_theme_style_selected:
  1109. .. rst-class:: classref-themeproperty
  1110. :ref:`StyleBox<class_StyleBox>` **selected**
  1111. :ref:`StyleBox<class_StyleBox>` for the selected items, used when the **Tree** is not being focused.
  1112. .. rst-class:: classref-item-separator
  1113. ----
  1114. .. _class_Tree_theme_style_selected_focus:
  1115. .. rst-class:: classref-themeproperty
  1116. :ref:`StyleBox<class_StyleBox>` **selected_focus**
  1117. :ref:`StyleBox<class_StyleBox>` for the selected items, used when the **Tree** is being focused.
  1118. .. rst-class:: classref-item-separator
  1119. ----
  1120. .. _class_Tree_theme_style_title_button_hover:
  1121. .. rst-class:: classref-themeproperty
  1122. :ref:`StyleBox<class_StyleBox>` **title_button_hover**
  1123. :ref:`StyleBox<class_StyleBox>` used when the title button is being hovered.
  1124. .. rst-class:: classref-item-separator
  1125. ----
  1126. .. _class_Tree_theme_style_title_button_normal:
  1127. .. rst-class:: classref-themeproperty
  1128. :ref:`StyleBox<class_StyleBox>` **title_button_normal**
  1129. Default :ref:`StyleBox<class_StyleBox>` for the title button.
  1130. .. rst-class:: classref-item-separator
  1131. ----
  1132. .. _class_Tree_theme_style_title_button_pressed:
  1133. .. rst-class:: classref-themeproperty
  1134. :ref:`StyleBox<class_StyleBox>` **title_button_pressed**
  1135. :ref:`StyleBox<class_StyleBox>` used when the title button is being pressed.
  1136. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  1137. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  1138. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  1139. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  1140. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  1141. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  1142. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`