TreeItem.xml 19 KB

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