W3cubDocs

/Godot 3.0

TreeItem

Inherits: Object

Category: Core

Brief Description

Control for a single item inside a Tree.

Member Functions

void add_button ( int column, Texture button, int button_idx=-1, bool disabled=false, String tooltip=”” )
void clear_custom_bg_color ( int column )
void clear_custom_color ( int column )
void deselect ( int column )
void erase_button ( int column, int button_idx )
Texture get_button ( int column, int button_idx ) const
int get_button_count ( int column ) const
int get_cell_mode ( int column ) const
TreeItem get_children ( )
Color get_custom_bg_color ( int column ) const
bool get_expand_right ( int column ) const
Texture get_icon ( int column ) const
int get_icon_max_width ( int column ) const
Rect2 get_icon_region ( int column ) const
Variant get_metadata ( int column ) const
TreeItem get_next ( )
TreeItem get_next_visible ( )
TreeItem get_parent ( )
TreeItem get_prev ( )
TreeItem get_prev_visible ( )
float get_range ( int column ) const
Dictionary get_range_config ( int column )
String get_text ( int column ) const
int get_text_align ( int column ) const
String get_tooltip ( int column ) const
bool is_button_disabled ( int column, int button_idx ) const
bool is_checked ( int column ) const
bool is_custom_set_as_button ( int column ) const
bool is_editable ( int column )
bool is_selectable ( int column ) const
bool is_selected ( int column )
void move_to_bottom ( )
void move_to_top ( )
void remove_child ( Object child )
void select ( int column )
void set_button ( int column, int button_idx, Texture button )
void set_cell_mode ( int column, int mode )
void set_checked ( int column, bool checked )
void set_custom_as_button ( int column, bool enable )
void set_custom_bg_color ( int column, Color color, bool just_outline=false )
void set_custom_color ( int column, Color color )
void set_custom_draw ( int column, Object object, String callback )
void set_editable ( int column, bool enabled )
void set_expand_right ( int column, bool enable )
void set_icon ( int column, Texture texture )
void set_icon_max_width ( int column, int width )
void set_icon_region ( int column, Rect2 region )
void set_metadata ( int column, Variant meta )
void set_range ( int column, float value )
void set_range_config ( int column, float min, float max, float step, bool expr=false )
void set_selectable ( int column, bool selectable )
void set_text ( int column, String text )
void set_text_align ( int column, int text_align )
void set_tooltip ( int column, String tooltip )

Member Variables

  • bool collapsed - If true the TreeItem is collapsed.
  • int custom_minimum_height - The custom minimum height.
  • bool disable_folding - If true folding is disabled for this TreeItem.

Enums

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_RANGE_EXPRESSION = 3 — Cell contains a range expression.
  • CELL_MODE_ICON = 4 — Cell contains an icon.
  • CELL_MODE_CUSTOM = 5

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 TreeItems and be styled as well as contain buttons.

Member Function Description

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_buton_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.

void erase_button ( int column, int button_idx )

Removes the button at index button_idx in column column.

Texture get_button ( int column, int button_idx ) const

Returns the Texture of the button at index button_idx in column column.

int get_button_count ( int column ) const

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.

int 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.

Color get_custom_bg_color ( int column ) const

Returns the custom background color of column column.

bool get_expand_right ( int column ) const

Returns true if expand_right is set.

Texture get_icon ( int column ) const

Returns the given column’s icon Texture. Error if no icon is set.

int get_icon_max_width ( int column ) const

Returns the column’s icon’s maximum width.

Rect2 get_icon_region ( int column ) const

Returns the icon Texture region as Rect2.

Variant get_metadata ( int column ) const

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.

float get_range ( int column ) const

Dictionary get_range_config ( int column )

String get_text ( int column ) const

Returns the given column’s text.

int get_text_align ( int column ) const

Returns the given column’s text alignment.

String get_tooltip ( int column ) const

Returns the given column’s tooltip.

bool is_button_disabled ( int column, int button_idx ) const

Returns true if the button at index button_idx for the given column is disabled.

bool is_checked ( int column ) const

Returns true if the given column is checked.

bool is_custom_set_as_button ( int column ) const

bool is_editable ( int column )

Returns true if column column is editable.

bool is_selectable ( int column ) const

Returns true if column column is selectable.

bool is_selected ( int column )

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 child TreeItem at index index.

void select ( int column )

Selects the column column.

void set_button ( int column, int button_idx, Texture button )

Sets the given column’s button Texture at index button_idx to button.

void set_cell_mode ( int column, int mode )

Sets the given column’s cell mode to mode. See CELL_MODE_* constants.

void set_checked ( int column, bool checked )

If true the column column is checked.

void set_custom_as_button ( int column, bool enable )

void set_custom_bg_color ( int column, Color color, bool just_outline=false )

Sets the given column’s custom background color and whether to just use it as an outline.

void set_custom_color ( int column, Color color )

Sets the given column’s custom color.

void set_custom_draw ( int column, Object object, String callback )

Sets the given column’s custom draw callback to callback method on object.

void set_editable ( int column, bool enabled )

If true column column is editable.

void set_expand_right ( int column, bool enable )

If true column column is expanded to the right.

void set_icon ( int column, Texture texture )

Sets the given column’s icon Texture.

void set_icon_max_width ( int column, int width )

Sets the given column’s icon’s maximum width.

void set_icon_region ( int column, Rect2 region )

Sets the given column’s icon’s texture region.

void set_metadata ( int column, Variant meta )

void set_range ( int column, float value )

void set_range_config ( int column, float min, float max, float step, bool expr=false )

void set_selectable ( int column, bool selectable )

If true the given column is selectable.

void set_text ( int column, String text )

void set_text_align ( int column, int text_align )

Sets the given column’s text alignment. See ALIGN_* constants.

void set_tooltip ( int column, String tooltip )

Sets the given column’s tooltip text.

© 2014–2018 Juan Linietsky, Ariel Manzur, Godot Engine contributors
Licensed under the MIT License.
http://docs.godotengine.org/en/3.0/classes/class_treeitem.html