An internal control for a single item inside [Tree].
A single item of a [Tree] control. It can contain other [TreeItem]s 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 [method Tree.create_item] or [method TreeItem.create_child]. To remove a [TreeItem], use [method Object.free]. [b]Note:[/b] The ID values used for buttons are 32-bit, unlike [int] which is always 64-bit. They go from [code]-2147483648[/code] to [code]2147483647[/code].
Adds a button with [Texture2D] [param button] at column [param column]. The [param id] is used to identify the button in the according [signal 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 [method get_button_count] immediately before this method. Optionally, the button can be [param disabled] and have a [param tooltip_text].
Adds a previously unparented [TreeItem] as a direct child of this one. The [param child] item must not be a part of any [Tree] or parented to any [TreeItem]. See also [method remove_child].
Calls the [param 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 [param index] (the default value [code]-1[/code] means the last position), or it will be the last child if [param index] is higher than the child count.
Deselects the given column.
Removes the button at index [param button_index] in column [param column].
Returns the text autowrap mode in the given [param column]. By default it is [constant TextServer.AUTOWRAP_OFF].
Returns the [Texture2D] of the button at index [param button_index] in column [param column].
Returns the button index if there is a button with ID [param id] in column [param column], otherwise returns -1.
Returns the number of buttons in column [param column].
Returns the ID for the button at index [param button_index] in column [param column].
Returns the tooltip text for the button at index [param button_index] in column [param column].
Returns the column's cell mode.
Returns a child item by its [param index] (see [method 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 [param column].
Returns the custom color of column [param column].
Returns custom font used to draw text in the column [param column].
Returns custom font size used to draw text in the column [param column].
Returns [code]true[/code] if [code]expand_right[/code] 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 [param column].
Returns the [Color] modulating the column's icon.
Returns the icon [Texture2D] region as [Rect2].
Returns the node's order in the tree. For example, if called on the first child item the position is [code]0[/code].
Returns item's text language code.
Returns the metadata value that was set for the given column using [method 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 [code]null[/code] object if there is none. If [param wrap] is enabled, the method will wrap around to the first element in the tree when called on the last element, otherwise it returns [code]null[/code].
Returns the next visible TreeItem in the tree (in the context of a depth-first search) or a [code]null[/code] object if there is none. If [param 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 [code]null[/code].
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 [code]null[/code] object if there is none. If [param 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 [code]null[/code].
Returns the previous visible sibling TreeItem in the tree (in the context of a depth-first search) or a [code]null[/code] object if there is none. If [param 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 [code]null[/code].
Returns the value of a [constant CELL_MODE_RANGE] column.
Returns a dictionary containing the range parameters for a given column. The keys are "min", "max", "step", and "expr".
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 [param column]. By default it is [constant TextServer.OVERRUN_TRIM_ELLIPSIS].
Returns the given column's tooltip text.
Returns the [Tree] that owns this TreeItem.
Returns [code]true[/code] if this [TreeItem], or any of its descendants, is collapsed. If [param only_visible] is [code]true[/code] it ignores non-visible [TreeItem]s.
Returns [code]true[/code] if the button at index [param button_index] for the given [param column] is disabled.
Returns [code]true[/code] if the given [param column] is checked.
Returns [code]true[/code] if the given [param column] is multiline editable.
Returns [code]true[/code] if the given [param column] is editable.
Returns [code]true[/code] if the given [param column] is indeterminate.
Returns [code]true[/code] if the given [param column] is selectable.
Returns [code]true[/code] if the given [param column] is selected.
Moves this TreeItem right after the given [param item]. [b]Note:[/b] You can't move to the root or move the root.
Moves this TreeItem right before the given [param item]. [b]Note:[/b] 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 [param column]. It is possible to process the items affected by this method call by connecting to [signal 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 [param emit_signal] is [code]false[/code], then [signal 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 [method add_child]). To completely remove a [TreeItem] use [method Object.free]. [b]Note:[/b] If you want to move a child from one [Tree] to another, then instead of removing and adding it manually you can use [method move_before] or [method move_after].
Selects the given [param column].
Sets the autowrap mode in the given [param column]. If set to something other than [constant TextServer.AUTOWRAP_OFF], the text gets wrapped inside the cell's bounding rectangle.
Sets the given column's button [Texture2D] at index [param button_index] to [param button].
Sets the given column's button color at index [param button_index] to [param color].
If [code]true[/code], disables the button at index [param button_index] in the given [param column].
Sets the tooltip text for the button at index [param button_index] in the given [param column].
Sets the given column's cell mode to [param mode]. See [enum TreeCellMode] constants.
If [param checked] is [code]true[/code], the given [param column] is checked. Clears column's indeterminate status.
Collapses or uncollapses this [TreeItem] and all the descendants of this item.
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 [param callback] method on [param object]. The [param 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 [param column].
Sets custom font size used to draw text in the given [param column].
If [param multiline] is [code]true[/code], the given [param column] is multiline editable. [b]Note:[/b] This option only affects the type of control ([LineEdit] or [TextEdit]) that appears when editing the column. You can set multiline values with [method set_text] even if the column is not multiline editable.
If [param enabled] is [code]true[/code], the given [param column] is editable.
If [param enable] is [code]true[/code], the given [param column] is expanded to the right.
Sets the given column's icon [Texture2D].
Sets the maximum allowed width of the icon in the given [param column]. This limit is applied on top of the default size of the icon and on top of [theme_item Tree.icon_max_width]. The height is adjusted according to the icon's ratio.
Modulates the given column's icon with [param modulate].
Sets the given column's icon's texture region.
If [param indeterminate] is [code]true[/code], the given [param column] is marked indeterminate. [b]Note:[/b] If set [code]true[/code] from [code]false[/code], 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 [method get_metadata]. This can be used, for example, to store a reference to the original data.
Sets the value of a [constant CELL_MODE_RANGE] column.
Sets the range of accepted values for a column. The column must be in the [constant CELL_MODE_RANGE] mode. If [param expr] is [code]true[/code], the edit mode slider will use an exponential scale as with [member Range.exp_edit].
If [param selectable] is [code]true[/code], the given [param column] is selectable.
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 [enum 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 [param column].
Sets the given column's tooltip text.
- If [code]true[/code], the TreeItem is collapsed.
- The custom minimum height.
- If [code]true[/code], folding is disabled for this TreeItem.
- If [code]true[/code], the [TreeItem] is visible (default). Note that if a [TreeItem] is set to not be visible, none of its children will be visible either.
Cell contains a string.
Cell contains a checkbox.
Cell contains a range.
Cell contains an icon.