TreeItem
Inherits: Object
Category: Core
Brief Description
Control for a single item inside a Tree.
Properties
bool | collapsed |
int | custom_minimum_height |
bool | disable_folding |
Methods
Enumerations
enum TreeCellMode:
- CELL_MODE_STRING = 0 — Cell contains a string.
- CELL_MODE_CHECK = 1 — Cell can be checked.
- CELL_MODE_RANGE = 2 — Cell contains a range.
- CELL_MODE_ICON = 3 — Cell contains an icon.
- CELL_MODE_CUSTOM = 4
enum TextAlign:
- ALIGN_LEFT = 0 — Align text to the left. See
set_text_align()
. - ALIGN_CENTER = 1 — Center text. See
set_text_align()
. - ALIGN_RIGHT = 2 — Align text to the right. See
set_text_align()
.
Description
Control for a single item inside a Tree. May have child TreeItem
s and be styled as well as contain buttons.
Property Descriptions
- bool collapsed
Setter | set_collapsed(value) |
Getter | is_collapsed() |
If true
, the TreeItem is collapsed.
- int custom_minimum_height
Setter | set_custom_minimum_height(value) |
Getter | get_custom_minimum_height() |
The custom minimum height.
- bool disable_folding
Setter | set_disable_folding(value) |
Getter | is_folding_disabled() |
If true
, folding is disabled for this TreeItem.
Method Descriptions
- void add_button ( int column, Texture button, int button_idx=-1, bool disabled=false, String tooltip=”” )
Adds a button with Texture button
at column column
. The button_idx
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 get_button_count immediately after this method. Optionally, the button can be disabled
and have a tooltip
.
- void clear_custom_bg_color ( int column )
Resets the background color for the given column to default.
- void clear_custom_color ( int column )
Resets the color for the given column to default.
- void deselect ( int column )
Deselects the given column.
Removes the button at index button_idx
in column column
.
Returns the Texture of the button at index button_idx
in column column
.
Returns the number of buttons in column column
. May be used to get the most recently added button’s index, if no index was specified.
- TreeCellMode get_cell_mode ( int column ) const
Returns the column’s cell mode. See CELL_MODE_*
constants.
- TreeItem get_children ( )
Returns the TreeItem’s child items.
Returns the custom background color of column column
.
Returns true
if expand_right
is set.
Returns the given column’s icon Texture. Error if no icon is set.
Returns the column’s icon’s maximum width.
Returns the icon Texture region as Rect2.
- TreeItem get_next ( )
Returns the next TreeItem in the tree.
- TreeItem get_next_visible ( )
Returns the next visible TreeItem in the tree.
- TreeItem get_parent ( )
Returns the parent TreeItem.
- TreeItem get_prev ( )
Returns the previous TreeItem in the tree.
- TreeItem get_prev_visible ( )
Returns the previous visible TreeItem in the tree.
- Dictionary get_range_config ( int column )
Returns the given column’s text.
Returns the given column’s text alignment.
Returns the given column’s tooltip.
Returns true
if the button at index button_idx
for the given column is disabled.
Returns true
if the given column is checked.
Returns true
if column column
is editable.
Returns true
if column column
is selectable.
Returns true
if column column
is selected.
- void move_to_bottom ( )
Moves this TreeItem to the bottom in the Tree hierarchy.
- void move_to_top ( )
Moves this TreeItem to the top in the Tree hierarchy.
- void remove_child ( Object child )
Removes the given child TreeItem.
- void select ( int column )
Selects the column column
.
Sets the given column’s button Texture at index button_idx
to button
.
- void set_cell_mode ( int column, TreeCellMode mode )
Sets the given column’s cell mode to mode
. See CELL_MODE_*
constants.
If true
, the column column
is checked.
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.
If true
, column column
is editable.
If true
, column column
is expanded to the right.
Sets the given column’s icon Texture.
Sets the given column’s icon’s maximum width.
Sets the given column’s icon’s texture region.
If true
, the given column is selectable.
Sets the given column’s text alignment. See ALIGN_*
constants.
Sets the given column’s tooltip text.