TreeItem.xml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="TreeItem" inherits="Object" version="3.3">
  3. <brief_description>
  4. Control for a single item inside a [Tree].
  5. </brief_description>
  6. <description>
  7. Control for a single item inside a [Tree]. May have child [TreeItem]s and be styled as well as contain buttons.
  8. You can remove a [TreeItem] by using [method Object.free].
  9. </description>
  10. <tutorials>
  11. </tutorials>
  12. <methods>
  13. <method name="add_button">
  14. <return type="void">
  15. </return>
  16. <argument index="0" name="column" type="int">
  17. </argument>
  18. <argument index="1" name="button" type="Texture">
  19. </argument>
  20. <argument index="2" name="button_idx" type="int" default="-1">
  21. </argument>
  22. <argument index="3" name="disabled" type="bool" default="false">
  23. </argument>
  24. <argument index="4" name="tooltip" type="String" default="&quot;&quot;">
  25. </argument>
  26. <description>
  27. Adds a button with [Texture] [code]button[/code] at column [code]column[/code]. The [code]button_idx[/code] index is used to identify the button when calling other methods. If not specified, the next available index is used, which may be retrieved by calling [method get_button_count] immediately after this method. Optionally, the button can be [code]disabled[/code] and have a [code]tooltip[/code].
  28. </description>
  29. </method>
  30. <method name="call_recursive" qualifiers="vararg">
  31. <return type="Variant">
  32. </return>
  33. <argument index="0" name="method" type="String">
  34. </argument>
  35. <description>
  36. Calls the [code]method[/code] on the actual TreeItem and its children recursively. Pass parameters as a comma separated list.
  37. </description>
  38. </method>
  39. <method name="clear_custom_bg_color">
  40. <return type="void">
  41. </return>
  42. <argument index="0" name="column" type="int">
  43. </argument>
  44. <description>
  45. Resets the background color for the given column to default.
  46. </description>
  47. </method>
  48. <method name="clear_custom_color">
  49. <return type="void">
  50. </return>
  51. <argument index="0" name="column" type="int">
  52. </argument>
  53. <description>
  54. Resets the color for the given column to default.
  55. </description>
  56. </method>
  57. <method name="deselect">
  58. <return type="void">
  59. </return>
  60. <argument index="0" name="column" type="int">
  61. </argument>
  62. <description>
  63. Deselects the given column.
  64. </description>
  65. </method>
  66. <method name="erase_button">
  67. <return type="void">
  68. </return>
  69. <argument index="0" name="column" type="int">
  70. </argument>
  71. <argument index="1" name="button_idx" type="int">
  72. </argument>
  73. <description>
  74. Removes the button at index [code]button_idx[/code] in column [code]column[/code].
  75. </description>
  76. </method>
  77. <method name="get_button" qualifiers="const">
  78. <return type="Texture">
  79. </return>
  80. <argument index="0" name="column" type="int">
  81. </argument>
  82. <argument index="1" name="button_idx" type="int">
  83. </argument>
  84. <description>
  85. Returns the [Texture] of the button at index [code]button_idx[/code] in column [code]column[/code].
  86. </description>
  87. </method>
  88. <method name="get_button_count" qualifiers="const">
  89. <return type="int">
  90. </return>
  91. <argument index="0" name="column" type="int">
  92. </argument>
  93. <description>
  94. Returns the number of buttons in column [code]column[/code]. May be used to get the most recently added button's index, if no index was specified.
  95. </description>
  96. </method>
  97. <method name="get_button_tooltip" qualifiers="const">
  98. <return type="String">
  99. </return>
  100. <argument index="0" name="column" type="int">
  101. </argument>
  102. <argument index="1" name="button_idx" type="int">
  103. </argument>
  104. <description>
  105. Returns the tooltip string for the button at index [code]button_idx[/code] in column [code]column[/code].
  106. </description>
  107. </method>
  108. <method name="get_cell_mode" qualifiers="const">
  109. <return type="int" enum="TreeItem.TreeCellMode">
  110. </return>
  111. <argument index="0" name="column" type="int">
  112. </argument>
  113. <description>
  114. Returns the column's cell mode.
  115. </description>
  116. </method>
  117. <method name="get_children">
  118. <return type="TreeItem">
  119. </return>
  120. <description>
  121. Returns the TreeItem's first child item or a null object if there is none.
  122. </description>
  123. </method>
  124. <method name="get_custom_bg_color" qualifiers="const">
  125. <return type="Color">
  126. </return>
  127. <argument index="0" name="column" type="int">
  128. </argument>
  129. <description>
  130. Returns the custom background color of column [code]column[/code].
  131. </description>
  132. </method>
  133. <method name="get_custom_color" qualifiers="const">
  134. <return type="Color">
  135. </return>
  136. <argument index="0" name="column" type="int">
  137. </argument>
  138. <description>
  139. Returns the custom color of column [code]column[/code].
  140. </description>
  141. </method>
  142. <method name="get_expand_right" qualifiers="const">
  143. <return type="bool">
  144. </return>
  145. <argument index="0" name="column" type="int">
  146. </argument>
  147. <description>
  148. Returns [code]true[/code] if [code]expand_right[/code] is set.
  149. </description>
  150. </method>
  151. <method name="get_icon" qualifiers="const">
  152. <return type="Texture">
  153. </return>
  154. <argument index="0" name="column" type="int">
  155. </argument>
  156. <description>
  157. Returns the given column's icon [Texture]. Error if no icon is set.
  158. </description>
  159. </method>
  160. <method name="get_icon_max_width" qualifiers="const">
  161. <return type="int">
  162. </return>
  163. <argument index="0" name="column" type="int">
  164. </argument>
  165. <description>
  166. Returns the column's icon's maximum width.
  167. </description>
  168. </method>
  169. <method name="get_icon_modulate" qualifiers="const">
  170. <return type="Color">
  171. </return>
  172. <argument index="0" name="column" type="int">
  173. </argument>
  174. <description>
  175. Returns the [Color] modulating the column's icon.
  176. </description>
  177. </method>
  178. <method name="get_icon_region" qualifiers="const">
  179. <return type="Rect2">
  180. </return>
  181. <argument index="0" name="column" type="int">
  182. </argument>
  183. <description>
  184. Returns the icon [Texture] region as [Rect2].
  185. </description>
  186. </method>
  187. <method name="get_metadata" qualifiers="const">
  188. <return type="Variant">
  189. </return>
  190. <argument index="0" name="column" type="int">
  191. </argument>
  192. <description>
  193. Returns the metadata value that was set for the given column using [method set_metadata].
  194. </description>
  195. </method>
  196. <method name="get_next">
  197. <return type="TreeItem">
  198. </return>
  199. <description>
  200. Returns the next TreeItem in the tree or a null object if there is none.
  201. </description>
  202. </method>
  203. <method name="get_next_visible">
  204. <return type="TreeItem">
  205. </return>
  206. <argument index="0" name="wrap" type="bool" default="false">
  207. </argument>
  208. <description>
  209. Returns the next visible TreeItem in the tree or a null object if there is none.
  210. If [code]wrap[/code] is enabled, the method will wrap around to the first visible element in the tree when called on the last visible element, otherwise it returns [code]null[/code].
  211. </description>
  212. </method>
  213. <method name="get_parent">
  214. <return type="TreeItem">
  215. </return>
  216. <description>
  217. Returns the parent TreeItem or a null object if there is none.
  218. </description>
  219. </method>
  220. <method name="get_prev">
  221. <return type="TreeItem">
  222. </return>
  223. <description>
  224. Returns the previous TreeItem in the tree or a null object if there is none.
  225. </description>
  226. </method>
  227. <method name="get_prev_visible">
  228. <return type="TreeItem">
  229. </return>
  230. <argument index="0" name="wrap" type="bool" default="false">
  231. </argument>
  232. <description>
  233. Returns the previous visible TreeItem in the tree or a null object if there is none.
  234. If [code]wrap[/code] is enabled, the method will wrap around to the last visible element in the tree when called on the first visible element, otherwise it returns [code]null[/code].
  235. </description>
  236. </method>
  237. <method name="get_range" qualifiers="const">
  238. <return type="float">
  239. </return>
  240. <argument index="0" name="column" type="int">
  241. </argument>
  242. <description>
  243. Returns the value of a [constant CELL_MODE_RANGE] column.
  244. </description>
  245. </method>
  246. <method name="get_range_config">
  247. <return type="Dictionary">
  248. </return>
  249. <argument index="0" name="column" type="int">
  250. </argument>
  251. <description>
  252. Returns a dictionary containing the range parameters for a given column. The keys are "min", "max", "step", and "expr".
  253. </description>
  254. </method>
  255. <method name="get_suffix" qualifiers="const">
  256. <return type="String">
  257. </return>
  258. <argument index="0" name="column" type="int">
  259. </argument>
  260. <description>
  261. Gets the suffix string shown after the column value.
  262. </description>
  263. </method>
  264. <method name="get_text" qualifiers="const">
  265. <return type="String">
  266. </return>
  267. <argument index="0" name="column" type="int">
  268. </argument>
  269. <description>
  270. Returns the given column's text.
  271. </description>
  272. </method>
  273. <method name="get_text_align" qualifiers="const">
  274. <return type="int" enum="TreeItem.TextAlign">
  275. </return>
  276. <argument index="0" name="column" type="int">
  277. </argument>
  278. <description>
  279. Returns the given column's text alignment.
  280. </description>
  281. </method>
  282. <method name="get_tooltip" qualifiers="const">
  283. <return type="String">
  284. </return>
  285. <argument index="0" name="column" type="int">
  286. </argument>
  287. <description>
  288. Returns the given column's tooltip.
  289. </description>
  290. </method>
  291. <method name="is_button_disabled" qualifiers="const">
  292. <return type="bool">
  293. </return>
  294. <argument index="0" name="column" type="int">
  295. </argument>
  296. <argument index="1" name="button_idx" type="int">
  297. </argument>
  298. <description>
  299. Returns [code]true[/code] if the button at index [code]button_idx[/code] for the given column is disabled.
  300. </description>
  301. </method>
  302. <method name="is_checked" qualifiers="const">
  303. <return type="bool">
  304. </return>
  305. <argument index="0" name="column" type="int">
  306. </argument>
  307. <description>
  308. Returns [code]true[/code] if the given column is checked.
  309. </description>
  310. </method>
  311. <method name="is_custom_set_as_button" qualifiers="const">
  312. <return type="bool">
  313. </return>
  314. <argument index="0" name="column" type="int">
  315. </argument>
  316. <description>
  317. </description>
  318. </method>
  319. <method name="is_editable">
  320. <return type="bool">
  321. </return>
  322. <argument index="0" name="column" type="int">
  323. </argument>
  324. <description>
  325. Returns [code]true[/code] if column [code]column[/code] is editable.
  326. </description>
  327. </method>
  328. <method name="is_selectable" qualifiers="const">
  329. <return type="bool">
  330. </return>
  331. <argument index="0" name="column" type="int">
  332. </argument>
  333. <description>
  334. Returns [code]true[/code] if column [code]column[/code] is selectable.
  335. </description>
  336. </method>
  337. <method name="is_selected">
  338. <return type="bool">
  339. </return>
  340. <argument index="0" name="column" type="int">
  341. </argument>
  342. <description>
  343. Returns [code]true[/code] if column [code]column[/code] is selected.
  344. </description>
  345. </method>
  346. <method name="move_to_bottom">
  347. <return type="void">
  348. </return>
  349. <description>
  350. Moves this TreeItem to the bottom in the [Tree] hierarchy.
  351. </description>
  352. </method>
  353. <method name="move_to_top">
  354. <return type="void">
  355. </return>
  356. <description>
  357. Moves this TreeItem to the top in the [Tree] hierarchy.
  358. </description>
  359. </method>
  360. <method name="remove_child">
  361. <return type="void">
  362. </return>
  363. <argument index="0" name="child" type="Object">
  364. </argument>
  365. <description>
  366. Removes the given child [TreeItem] and all its children from the [Tree]. Note that it doesn't free the item from memory, so it can be reused later. To completely remove a [TreeItem] use [method Object.free].
  367. </description>
  368. </method>
  369. <method name="select">
  370. <return type="void">
  371. </return>
  372. <argument index="0" name="column" type="int">
  373. </argument>
  374. <description>
  375. Selects the column [code]column[/code].
  376. </description>
  377. </method>
  378. <method name="set_button">
  379. <return type="void">
  380. </return>
  381. <argument index="0" name="column" type="int">
  382. </argument>
  383. <argument index="1" name="button_idx" type="int">
  384. </argument>
  385. <argument index="2" name="button" type="Texture">
  386. </argument>
  387. <description>
  388. Sets the given column's button [Texture] at index [code]button_idx[/code] to [code]button[/code].
  389. </description>
  390. </method>
  391. <method name="set_button_disabled">
  392. <return type="void">
  393. </return>
  394. <argument index="0" name="column" type="int">
  395. </argument>
  396. <argument index="1" name="button_idx" type="int">
  397. </argument>
  398. <argument index="2" name="disabled" type="bool">
  399. </argument>
  400. <description>
  401. If [code]true[/code], disables the button at index [code]button_idx[/code] in column [code]column[/code].
  402. </description>
  403. </method>
  404. <method name="set_cell_mode">
  405. <return type="void">
  406. </return>
  407. <argument index="0" name="column" type="int">
  408. </argument>
  409. <argument index="1" name="mode" type="int" enum="TreeItem.TreeCellMode">
  410. </argument>
  411. <description>
  412. Sets the given column's cell mode to [code]mode[/code]. See [enum TreeCellMode] constants.
  413. </description>
  414. </method>
  415. <method name="set_checked">
  416. <return type="void">
  417. </return>
  418. <argument index="0" name="column" type="int">
  419. </argument>
  420. <argument index="1" name="checked" type="bool">
  421. </argument>
  422. <description>
  423. If [code]true[/code], the column [code]column[/code] is checked.
  424. </description>
  425. </method>
  426. <method name="set_custom_as_button">
  427. <return type="void">
  428. </return>
  429. <argument index="0" name="column" type="int">
  430. </argument>
  431. <argument index="1" name="enable" type="bool">
  432. </argument>
  433. <description>
  434. </description>
  435. </method>
  436. <method name="set_custom_bg_color">
  437. <return type="void">
  438. </return>
  439. <argument index="0" name="column" type="int">
  440. </argument>
  441. <argument index="1" name="color" type="Color">
  442. </argument>
  443. <argument index="2" name="just_outline" type="bool" default="false">
  444. </argument>
  445. <description>
  446. Sets the given column's custom background color and whether to just use it as an outline.
  447. </description>
  448. </method>
  449. <method name="set_custom_color">
  450. <return type="void">
  451. </return>
  452. <argument index="0" name="column" type="int">
  453. </argument>
  454. <argument index="1" name="color" type="Color">
  455. </argument>
  456. <description>
  457. Sets the given column's custom color.
  458. </description>
  459. </method>
  460. <method name="set_custom_draw">
  461. <return type="void">
  462. </return>
  463. <argument index="0" name="column" type="int">
  464. </argument>
  465. <argument index="1" name="object" type="Object">
  466. </argument>
  467. <argument index="2" name="callback" type="String">
  468. </argument>
  469. <description>
  470. Sets the given column's custom draw callback to [code]callback[/code] method on [code]object[/code].
  471. The [code]callback[/code] should accept two arguments: the [TreeItem] that is drawn and its position and size as a [Rect2].
  472. </description>
  473. </method>
  474. <method name="set_editable">
  475. <return type="void">
  476. </return>
  477. <argument index="0" name="column" type="int">
  478. </argument>
  479. <argument index="1" name="enabled" type="bool">
  480. </argument>
  481. <description>
  482. If [code]true[/code], column [code]column[/code] is editable.
  483. </description>
  484. </method>
  485. <method name="set_expand_right">
  486. <return type="void">
  487. </return>
  488. <argument index="0" name="column" type="int">
  489. </argument>
  490. <argument index="1" name="enable" type="bool">
  491. </argument>
  492. <description>
  493. If [code]true[/code], column [code]column[/code] is expanded to the right.
  494. </description>
  495. </method>
  496. <method name="set_icon">
  497. <return type="void">
  498. </return>
  499. <argument index="0" name="column" type="int">
  500. </argument>
  501. <argument index="1" name="texture" type="Texture">
  502. </argument>
  503. <description>
  504. Sets the given column's icon [Texture].
  505. </description>
  506. </method>
  507. <method name="set_icon_max_width">
  508. <return type="void">
  509. </return>
  510. <argument index="0" name="column" type="int">
  511. </argument>
  512. <argument index="1" name="width" type="int">
  513. </argument>
  514. <description>
  515. Sets the given column's icon's maximum width.
  516. </description>
  517. </method>
  518. <method name="set_icon_modulate">
  519. <return type="void">
  520. </return>
  521. <argument index="0" name="column" type="int">
  522. </argument>
  523. <argument index="1" name="modulate" type="Color">
  524. </argument>
  525. <description>
  526. Modulates the given column's icon with [code]modulate[/code].
  527. </description>
  528. </method>
  529. <method name="set_icon_region">
  530. <return type="void">
  531. </return>
  532. <argument index="0" name="column" type="int">
  533. </argument>
  534. <argument index="1" name="region" type="Rect2">
  535. </argument>
  536. <description>
  537. Sets the given column's icon's texture region.
  538. </description>
  539. </method>
  540. <method name="set_metadata">
  541. <return type="void">
  542. </return>
  543. <argument index="0" name="column" type="int">
  544. </argument>
  545. <argument index="1" name="meta" type="Variant">
  546. </argument>
  547. <description>
  548. Sets the metadata value for the given column, which can be retrieved later using [method get_metadata]. This can be used, for example, to store a reference to the original data.
  549. </description>
  550. </method>
  551. <method name="set_range">
  552. <return type="void">
  553. </return>
  554. <argument index="0" name="column" type="int">
  555. </argument>
  556. <argument index="1" name="value" type="float">
  557. </argument>
  558. <description>
  559. Sets the value of a [constant CELL_MODE_RANGE] column.
  560. </description>
  561. </method>
  562. <method name="set_range_config">
  563. <return type="void">
  564. </return>
  565. <argument index="0" name="column" type="int">
  566. </argument>
  567. <argument index="1" name="min" type="float">
  568. </argument>
  569. <argument index="2" name="max" type="float">
  570. </argument>
  571. <argument index="3" name="step" type="float">
  572. </argument>
  573. <argument index="4" name="expr" type="bool" default="false">
  574. </argument>
  575. <description>
  576. Sets the range of accepted values for a column. The column must be in the [constant CELL_MODE_RANGE] mode.
  577. If [code]expr[/code] is [code]true[/code], the edit mode slider will use an exponential scale as with [member Range.exp_edit].
  578. </description>
  579. </method>
  580. <method name="set_selectable">
  581. <return type="void">
  582. </return>
  583. <argument index="0" name="column" type="int">
  584. </argument>
  585. <argument index="1" name="selectable" type="bool">
  586. </argument>
  587. <description>
  588. If [code]true[/code], the given column is selectable.
  589. </description>
  590. </method>
  591. <method name="set_suffix">
  592. <return type="void">
  593. </return>
  594. <argument index="0" name="column" type="int">
  595. </argument>
  596. <argument index="1" name="text" type="String">
  597. </argument>
  598. <description>
  599. Sets a string to be shown after a column's value (for example, a unit abbreviation).
  600. </description>
  601. </method>
  602. <method name="set_text">
  603. <return type="void">
  604. </return>
  605. <argument index="0" name="column" type="int">
  606. </argument>
  607. <argument index="1" name="text" type="String">
  608. </argument>
  609. <description>
  610. Sets the given column's text value.
  611. </description>
  612. </method>
  613. <method name="set_text_align">
  614. <return type="void">
  615. </return>
  616. <argument index="0" name="column" type="int">
  617. </argument>
  618. <argument index="1" name="text_align" type="int" enum="TreeItem.TextAlign">
  619. </argument>
  620. <description>
  621. Sets the given column's text alignment. See [enum TextAlign] for possible values.
  622. </description>
  623. </method>
  624. <method name="set_tooltip">
  625. <return type="void">
  626. </return>
  627. <argument index="0" name="column" type="int">
  628. </argument>
  629. <argument index="1" name="tooltip" type="String">
  630. </argument>
  631. <description>
  632. Sets the given column's tooltip text.
  633. </description>
  634. </method>
  635. </methods>
  636. <members>
  637. <member name="collapsed" type="bool" setter="set_collapsed" getter="is_collapsed">
  638. If [code]true[/code], the TreeItem is collapsed.
  639. </member>
  640. <member name="custom_minimum_height" type="int" setter="set_custom_minimum_height" getter="get_custom_minimum_height">
  641. The custom minimum height.
  642. </member>
  643. <member name="disable_folding" type="bool" setter="set_disable_folding" getter="is_folding_disabled">
  644. If [code]true[/code], folding is disabled for this TreeItem.
  645. </member>
  646. </members>
  647. <constants>
  648. <constant name="CELL_MODE_STRING" value="0" enum="TreeCellMode">
  649. Cell contains a string.
  650. </constant>
  651. <constant name="CELL_MODE_CHECK" value="1" enum="TreeCellMode">
  652. Cell contains a checkbox.
  653. </constant>
  654. <constant name="CELL_MODE_RANGE" value="2" enum="TreeCellMode">
  655. Cell contains a range.
  656. </constant>
  657. <constant name="CELL_MODE_ICON" value="3" enum="TreeCellMode">
  658. Cell contains an icon.
  659. </constant>
  660. <constant name="CELL_MODE_CUSTOM" value="4" enum="TreeCellMode">
  661. </constant>
  662. <constant name="ALIGN_LEFT" value="0" enum="TextAlign">
  663. Align text to the left. See [code]set_text_align()[/code].
  664. </constant>
  665. <constant name="ALIGN_CENTER" value="1" enum="TextAlign">
  666. Center text. See [code]set_text_align()[/code].
  667. </constant>
  668. <constant name="ALIGN_RIGHT" value="2" enum="TextAlign">
  669. Align text to the right. See [code]set_text_align()[/code].
  670. </constant>
  671. </constants>
  672. </class>