TreeItem.xml 17 KB

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