TreeItem.xml 17 KB

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