A single item of a Tree control. It can contain other TreeItems as children, which allows it to create a hierarchy. It can also contain text and buttons. TreeItem is not a Node, it is internal to the Tree.
To create a TreeItem, use Tree.create_item or create_child. To remove a TreeItem, use Object.free.
CELL_MODE_STRING = 0
Cell contains a string.
CELL_MODE_CHECK = 1
Cell contains a checkbox.
CELL_MODE_RANGE = 2
Cell contains a range.
CELL_MODE_ICON = 3
Cell contains an icon.
CELL_MODE_CUSTOM = 4
There is currently no description for this enum. Please help us by contributing one!
If true
, the TreeItem is collapsed.
The custom minimum height.
If true
, folding is disabled for this TreeItem.
If true
, the TreeItem is visible (default).
Note that if a TreeItem is set to not be visible, none of its children will be visible either.
Adds a button with Texture2D button
at column column
. The id
is used to identify the button in the according Tree.button_clicked signal and can be different from the buttons index. If not specified, the next available index is used, which may be retrieved by calling get_button_count immediately before this method. Optionally, the button can be disabled
and have a tooltip_text
.
Adds a previously unparented TreeItem as a direct child of this one. The child
item must not be a part of any Tree or parented to any TreeItem. See also remove_child.
Calls the method
on the actual TreeItem and its children recursively. Pass parameters as a comma separated list.
Resets the background color for the given column to default.
Resets the color for the given column to default.
Creates an item and adds it as a child.
The new item will be inserted as position index
(the default value -1
means the last position), or it will be the last child if index
is higher than the child count.
Deselects the given column.
Removes the button at index button_index
in column column
.
Returns the text autowrap mode in the given column
. By default it is TextServer.AUTOWRAP_OFF.
Returns the Texture2D of the button at index button_index
in column column
.
Returns the button index if there is a button with ID id
in column column
, otherwise returns -1.
Returns the color of the button with ID id
in column column
. If the specified button does not exist, returns Color.BLACK.
Returns the number of buttons in column column
.
Returns the ID for the button at index button_index
in column column
.
Returns the tooltip text for the button at index button_index
in column column
.
Returns the column's cell mode.
Returns a child item by its index
(see get_child_count). This method is often used for iterating all children of an item.
Negative indices access the children from the last one.
Returns the number of child items.
Returns an array of references to the item's children.
Returns the custom background color of column column
.
Returns the custom color of column column
.
Returns the custom callback of column column
.
Returns custom font used to draw text in the column column
.
Returns custom font size used to draw text in the column column
.
Returns true
if expand_right
is set.
Returns the TreeItem's first child.
Returns the given column's icon Texture2D. Error if no icon is set.
Returns the maximum allowed width of the icon in the given column
.
Returns the Color modulating the column's icon.
Returns the node's order in the tree. For example, if called on the first child item the position is 0
.
Returns item's text language code.
Returns the metadata value that was set for the given column using set_metadata.
Returns the next sibling TreeItem in the tree or a null object if there is none.
Returns the next TreeItem in the tree (in the context of a depth-first search) or a null
object if there is none.
If wrap
is enabled, the method will wrap around to the first element in the tree when called on the last element, otherwise it returns null
.
Returns the next visible TreeItem in the tree (in the context of a depth-first search) or a null
object if there is none.
If wrap
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 null
.
Returns the parent TreeItem or a null object if there is none.
Returns the previous sibling TreeItem in the tree or a null object if there is none.
Returns the previous TreeItem in the tree (in the context of a depth-first search) or a null
object if there is none.
If wrap
is enabled, the method will wrap around to the last element in the tree when called on the first visible element, otherwise it returns null
.
Returns the previous visible sibling TreeItem in the tree (in the context of a depth-first search) or a null
object if there is none.
If wrap
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 null
.
Returns the value of a CELL_MODE_RANGE column.
Returns a dictionary containing the range parameters for a given column. The keys are "min", "max", "step", and "expr".
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
Gets the suffix string shown after the column value.
Returns the given column's text.
Returns the given column's text alignment.
Returns item's text base writing direction.
Returns the clipping behavior when the text exceeds the item's bounding rectangle in the given column
. By default it is TextServer.OVERRUN_TRIM_ELLIPSIS.
Returns the given column's tooltip text.
Returns the Tree that owns this TreeItem.
Returns true
if this TreeItem, or any of its descendants, is collapsed.
If only_visible
is true
it ignores non-visible TreeItems.
Returns true
if the button at index button_index
for the given column
is disabled.
Returns true
if the given column
is checked.
There is currently no description for this method. Please help us by contributing one!
Returns true
if the given column
is multiline editable.
Returns true
if the given column
is editable.
Returns true
if the given column
is indeterminate.
Returns true
if the given column
is selectable.
Returns true
if the given column
is selected.
Moves this TreeItem right after the given item
.
Note: You can't move to the root or move the root.
Moves this TreeItem right before the given item
.
Note: You can't move to the root or move the root.
Propagates this item's checked status to its children and parents for the given column
. It is possible to process the items affected by this method call by connecting to Tree.check_propagated_to_item. The order that the items affected will be processed is as follows: the item invoking this method, children of that item, and finally parents of that item. If emit_signal
is false
, then Tree.check_propagated_to_item will not be emitted.
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 (see add_child). To completely remove a TreeItem use Object.free.
Note: If you want to move a child from one Tree to another, then instead of removing and adding it manually you can use move_before or move_after.
Selects the given column
.
Sets the autowrap mode in the given column
. If set to something other than TextServer.AUTOWRAP_OFF, the text gets wrapped inside the cell's bounding rectangle.
Sets the given column's button Texture2D at index button_index
to button
.
Sets the given column's button color at index button_index
to color
.
If true
, disables the button at index button_index
in the given column
.
Sets the tooltip text for the button at index button_index
in the given column
.
Sets the given column's cell mode to mode
. See TreeCellMode constants.
If checked
is true
, the given column
is checked. Clears column's indeterminate status.
Collapses or uncollapses this TreeItem and all the descendants of this item.
There is currently no description for this method. Please help us by contributing one!
Sets the given column's custom background color and whether to just use it as an outline.
Sets the given column's custom color.
Sets the given column's custom draw callback to callback
method on object
.
The callback
should accept two arguments: the TreeItem that is drawn and its position and size as a Rect2.
Deprecated. Use set_custom_draw_callback instead.
Sets the given column's custom draw callback. Use an empty Callable (Callable()
) to clear the custom callback.
The callback
should accept two arguments: the TreeItem that is drawn and its position and size as a Rect2.
Sets custom font used to draw text in the given column
.
Sets custom font size used to draw text in the given column
.
If multiline
is true
, the given column
is multiline editable.
Note: This option only affects the type of control (LineEdit or TextEdit) that appears when editing the column. You can set multiline values with set_text even if the column is not multiline editable.
If enabled
is true
, the given column
is editable.
If enable
is true
, the given column
is expanded to the right.
Sets the given column's icon Texture2D.
Sets the maximum allowed width of the icon in the given column
. This limit is applied on top of the default size of the icon and on top of Tree.icon_max_width. The height is adjusted according to the icon's ratio.
Modulates the given column's icon with modulate
.
Sets the given column's icon's texture region.
If indeterminate
is true
, the given column
is marked indeterminate.
Note: If set true
from false
, then column is cleared of checked status.
Sets language code of item's text used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
Sets the metadata value for the given column, which can be retrieved later using get_metadata. This can be used, for example, to store a reference to the original data.
Sets the value of a CELL_MODE_RANGE column.
Sets the range of accepted values for a column. The column must be in the CELL_MODE_RANGE mode.
If expr
is true
, the edit mode slider will use an exponential scale as with Range.exp_edit.
If selectable
is true
, the given column
is selectable.
There is currently no description for this method. Please help us by contributing one!
There is currently no description for this method. Please help us by contributing one!
Sets a string to be shown after a column's value (for example, a unit abbreviation).
Sets the given column's text value.
Sets the given column's text alignment. See HorizontalAlignment for possible values.
Sets item's text base writing direction.
Sets the clipping behavior when the text exceeds the item's bounding rectangle in the given column
.
Sets the given column's tooltip text.
Uncollapses all TreeItems necessary to reveal this TreeItem, i.e. all ancestor TreeItems.