2017-09-12 22:42:36 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2018-07-31 20:13:10 +02:00
<class name= "Tree" inherits= "Control" category= "Core" version= "3.0.7" >
2017-09-12 22:42:36 +02:00
<brief_description >
Control to show a tree of items.
</brief_description>
<description >
2017-10-07 19:43:24 +02:00
This shows a tree of items that can be selected, expanded and collapsed. The tree can have multiple columns with custom controls like text editing, buttons and popups. It can be useful for structured displays and interactions.
Trees are built via code, using [TreeItem] objects to create the structure. They have a single root but multiple roots can be simulated if a dummy hidden root is added.
2017-09-12 22:42:36 +02:00
[codeblock]
func _ready():
var tree = Tree.new()
var root = tree.create_item()
tree.set_hide_root(true)
var child1 = tree.create_item(root)
var child2 = tree.create_item(root)
var subchild1 = tree.create_item(child1)
subchild1.set_text(0, "Subchild1")
[/codeblock]
</description>
<tutorials >
</tutorials>
<demos >
</demos>
<methods >
<method name= "are_column_titles_visible" qualifiers= "const" >
<return type= "bool" >
</return>
<description >
2017-10-07 19:43:24 +02:00
Returns [code]true[/code] if the column titles are being shown.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "clear" >
<return type= "void" >
</return>
<description >
2017-10-07 19:43:24 +02:00
Clears the tree. This removes all items.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "create_item" >
<return type= "Object" >
</return>
<argument index= "0" name= "parent" type= "Object" default= "null" >
</argument>
2018-01-03 13:45:03 +01:00
<argument index= "1" name= "idx" type= "int" default= "-1" >
</argument>
2017-09-12 22:42:36 +02:00
<description >
2017-10-07 19:43:24 +02:00
Create an item in the tree and add it as the last child of [code]parent[/code]. If parent is not given, it will be added as the root's last child, or it'll the be the root itself if the tree is empty.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "ensure_cursor_is_visible" >
<return type= "void" >
</return>
<description >
2017-10-07 19:43:24 +02:00
Makes the currently selected item visible. This will scroll the tree to make sure the selected item is visible.
2017-09-12 22:42:36 +02:00
</description>
</method>
2017-09-10 15:37:49 +02:00
<method name= "get_column_at_position" qualifiers= "const" >
2017-09-12 22:42:36 +02:00
<return type= "int" >
</return>
2017-09-10 15:37:49 +02:00
<argument index= "0" name= "position" type= "Vector2" >
2017-09-12 22:42:36 +02:00
</argument>
<description >
2017-10-07 19:43:24 +02:00
Returns the column index under the given point.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_column_title" qualifiers= "const" >
<return type= "String" >
</return>
<argument index= "0" name= "column" type= "int" >
</argument>
<description >
2017-10-07 19:43:24 +02:00
Returns the column's title.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_column_width" qualifiers= "const" >
<return type= "int" >
</return>
<argument index= "0" name= "column" type= "int" >
</argument>
<description >
2017-10-07 19:43:24 +02:00
Returns the column's width in pixels.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_custom_popup_rect" qualifiers= "const" >
<return type= "Rect2" >
</return>
<description >
2017-10-07 19:43:24 +02:00
Returns the rectangle for custom popups. Helper to create custom cell controls that display a popup. See [method TreeItem.set_cell_mode].
2017-09-12 22:42:36 +02:00
</description>
</method>
2017-09-10 15:37:49 +02:00
<method name= "get_drop_section_at_position" qualifiers= "const" >
2017-09-13 20:56:01 +02:00
<return type= "int" >
</return>
2017-09-10 15:37:49 +02:00
<argument index= "0" name= "position" type= "Vector2" >
2017-09-13 20:56:01 +02:00
</argument>
<description >
</description>
</method>
2017-09-12 22:42:36 +02:00
<method name= "get_edited" qualifiers= "const" >
<return type= "TreeItem" >
</return>
<description >
2017-10-07 19:43:24 +02:00
Returns the currently edited item. This is only available for custom cell mode.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_edited_column" qualifiers= "const" >
<return type= "int" >
</return>
<description >
2017-10-07 19:43:24 +02:00
Returns the column for the currently edited item. This is only available for custom cell mode.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_item_area_rect" qualifiers= "const" >
<return type= "Rect2" >
</return>
<argument index= "0" name= "item" type= "Object" >
</argument>
<argument index= "1" name= "column" type= "int" default= "-1" >
</argument>
<description >
2017-10-07 19:43:24 +02:00
Returns the rectangle area for the specified item. If column is specified, only get the position and size of that column, otherwise get the rectangle containing all columns.
2017-09-12 22:42:36 +02:00
</description>
</method>
2017-09-10 15:37:49 +02:00
<method name= "get_item_at_position" qualifiers= "const" >
2017-09-12 22:42:36 +02:00
<return type= "TreeItem" >
</return>
2017-09-10 15:37:49 +02:00
<argument index= "0" name= "position" type= "Vector2" >
2017-09-12 22:42:36 +02:00
</argument>
<description >
2017-10-07 19:43:24 +02:00
Returns the tree item at the specified position (relative to the tree origin position).
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_next_selected" >
<return type= "TreeItem" >
</return>
<argument index= "0" name= "from" type= "Object" >
</argument>
<description >
2017-10-07 19:43:24 +02:00
Returns the next selected item after the given one.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_pressed_button" qualifiers= "const" >
<return type= "int" >
</return>
<description >
2017-10-07 19:43:24 +02:00
Returns the last pressed button's index.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_root" >
<return type= "TreeItem" >
</return>
<description >
2017-10-07 19:43:24 +02:00
Returns the tree's root item.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_scroll" qualifiers= "const" >
<return type= "Vector2" >
</return>
<description >
2017-10-07 19:43:24 +02:00
Returns the current scrolling position.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_selected" qualifiers= "const" >
<return type= "TreeItem" >
</return>
<description >
2017-10-07 19:43:24 +02:00
Returns the currently selected item.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "get_selected_column" qualifiers= "const" >
<return type= "int" >
</return>
<description >
2017-10-07 19:43:24 +02:00
Returns the current selection's column.
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "set_column_expand" >
<return type= "void" >
</return>
<argument index= "0" name= "column" type= "int" >
</argument>
<argument index= "1" name= "expand" type= "bool" >
</argument>
<description >
2017-10-07 19:43:24 +02:00
If [code]true[/code] the column will have the "Expand" flag of [Control].
2017-09-12 22:42:36 +02:00
</description>
</method>
<method name= "set_column_min_width" >
<return type= "void" >
</return>
<argument index= "0" name= "column" type= "int" >
</argument>
<argument index= "1" name= "min_width" type= "int" >
</argument>
<description >
Set the minimum width of a column.
</description>
</method>
<method name= "set_column_title" >
<return type= "void" >
</return>
<argument index= "0" name= "column" type= "int" >
</argument>
<argument index= "1" name= "title" type= "String" >
</argument>
<description >
Set the title of a column.
</description>
</method>
<method name= "set_column_titles_visible" >
<return type= "void" >
</return>
<argument index= "0" name= "visible" type= "bool" >
</argument>
<description >
2017-10-07 19:43:24 +02:00
If [code]true[/code] column titles are visible.
2017-09-12 22:42:36 +02:00
</description>
</method>
</methods>
2018-01-11 23:38:35 +01:00
<members >
<member name= "allow_reselect" type= "bool" setter= "set_allow_reselect" getter= "get_allow_reselect" >
If [code]true[/code] the currently selected cell may be selected again.
</member>
<member name= "allow_rmb_select" type= "bool" setter= "set_allow_rmb_select" getter= "get_allow_rmb_select" >
If [code]true[/code] a right mouse button click can select items.
</member>
<member name= "columns" type= "int" setter= "set_columns" getter= "get_columns" >
The amount of columns.
</member>
<member name= "drop_mode_flags" type= "int" setter= "set_drop_mode_flags" getter= "get_drop_mode_flags" >
The drop mode as an OR combination of flags. See [code]DROP_MODE_*[/code] constants.
</member>
<member name= "hide_folding" type= "bool" setter= "set_hide_folding" getter= "is_folding_hidden" >
If [code]true[/code] the folding arrow is hidden.
</member>
<member name= "hide_root" type= "bool" setter= "set_hide_root" getter= "is_root_hidden" >
If [code]true[/code] the tree's root is hidden.
</member>
<member name= "select_mode" type= "int" setter= "set_select_mode" getter= "get_select_mode" enum= "Tree.SelectMode" >
Allow single or multiple selection. See the [code]SELECT_*[/code] constants.
</member>
</members>
2017-09-12 22:42:36 +02:00
<signals >
<signal name= "button_pressed" >
<argument index= "0" name= "item" type= "Object" >
</argument>
<argument index= "1" name= "column" type= "int" >
</argument>
<argument index= "2" name= "id" type= "int" >
</argument>
<description >
Emitted when a button on the tree was pressed (see [method TreeItem.add_button]).
</description>
</signal>
<signal name= "cell_selected" >
<description >
Emitted when a cell is selected.
</description>
</signal>
<signal name= "column_title_pressed" >
<argument index= "0" name= "column" type= "int" >
</argument>
<description >
2017-10-07 19:43:24 +02:00
Emitted when a column's title is pressed.
2017-09-12 22:42:36 +02:00
</description>
</signal>
<signal name= "custom_popup_edited" >
<argument index= "0" name= "arrow_clicked" type= "bool" >
</argument>
<description >
Emitted when a cell with the [code]CELL_MODE_CUSTOM[/code] is clicked to be edited.
</description>
</signal>
<signal name= "empty_tree_rmb_selected" >
2017-09-10 15:37:49 +02:00
<argument index= "0" name= "position" type= "Vector2" >
2017-09-12 22:42:36 +02:00
</argument>
<description >
Emitted when the right mouse button is pressed if RMB selection is active and the tree is empty.
</description>
</signal>
<signal name= "item_activated" >
<description >
Emitted when an item is activated (double-clicked).
</description>
</signal>
<signal name= "item_collapsed" >
<argument index= "0" name= "item" type= "Object" >
</argument>
<description >
Emitted when an item is collapsed by a click on the folding arrow.
</description>
</signal>
<signal name= "item_custom_button_pressed" >
<description >
</description>
</signal>
<signal name= "item_double_clicked" >
<description >
2017-10-07 19:43:24 +02:00
Emitted when an item is double clicked.
2017-09-12 22:42:36 +02:00
</description>
</signal>
<signal name= "item_edited" >
<description >
2017-10-07 19:43:24 +02:00
Emitted when an item is edited.
2017-09-12 22:42:36 +02:00
</description>
</signal>
<signal name= "item_rmb_edited" >
<description >
2017-10-07 19:43:24 +02:00
Emitted when an item is edited using the right mouse button.
2017-09-12 22:42:36 +02:00
</description>
</signal>
<signal name= "item_rmb_selected" >
2017-09-10 15:37:49 +02:00
<argument index= "0" name= "position" type= "Vector2" >
2017-09-12 22:42:36 +02:00
</argument>
<description >
Emitted when an item is selected with right mouse button.
</description>
</signal>
<signal name= "item_selected" >
<description >
Emitted when an item is selected with right mouse button.
</description>
</signal>
<signal name= "multi_selected" >
<argument index= "0" name= "item" type= "Object" >
</argument>
<argument index= "1" name= "column" type= "int" >
</argument>
<argument index= "2" name= "selected" type= "bool" >
</argument>
<description >
2017-10-07 19:43:24 +02:00
Emitted instead of [code]item_selected[/code] when [code]select_mode[/code] is [code]SELECT_MULTI[/code].
2017-09-12 22:42:36 +02:00
</description>
</signal>
2017-11-27 23:37:47 +01:00
<signal name= "nothing_selected" >
<description >
</description>
</signal>
2017-09-12 22:42:36 +02:00
</signals>
<constants >
2017-11-24 23:16:30 +01:00
<constant name= "SELECT_SINGLE" value= "0" enum= "SelectMode" >
2017-10-07 19:43:24 +02:00
Allow selection of a single item at a time.
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "SELECT_ROW" value= "1" enum= "SelectMode" >
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "SELECT_MULTI" value= "2" enum= "SelectMode" >
2017-10-07 19:43:24 +02:00
Allow selection of multiple items at the same time.
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "DROP_MODE_DISABLED" value= "0" enum= "DropModeFlags" >
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "DROP_MODE_ON_ITEM" value= "1" enum= "DropModeFlags" >
2017-09-12 22:42:36 +02:00
</constant>
2017-11-24 23:16:30 +01:00
<constant name= "DROP_MODE_INBETWEEN" value= "2" enum= "DropModeFlags" >
2017-09-12 22:42:36 +02:00
</constant>
</constants>
<theme_items >
<theme_item name= "arrow" type= "Texture" >
</theme_item>
<theme_item name= "arrow_collapsed" type= "Texture" >
</theme_item>
<theme_item name= "bg" type= "StyleBox" >
</theme_item>
<theme_item name= "bg_focus" type= "StyleBox" >
</theme_item>
<theme_item name= "button_margin" type= "int" >
</theme_item>
<theme_item name= "button_pressed" type= "StyleBox" >
</theme_item>
<theme_item name= "checked" type= "Texture" >
</theme_item>
<theme_item name= "cursor" type= "StyleBox" >
</theme_item>
<theme_item name= "cursor_color" type= "Color" >
</theme_item>
<theme_item name= "cursor_unfocused" type= "StyleBox" >
</theme_item>
<theme_item name= "custom_button" type= "StyleBox" >
</theme_item>
<theme_item name= "custom_button_font_highlight" type= "Color" >
</theme_item>
<theme_item name= "custom_button_hover" type= "StyleBox" >
</theme_item>
<theme_item name= "custom_button_pressed" type= "StyleBox" >
</theme_item>
<theme_item name= "draw_relationship_lines" type= "int" >
</theme_item>
<theme_item name= "drop_position_color" type= "Color" >
</theme_item>
<theme_item name= "font" type= "Font" >
</theme_item>
<theme_item name= "font_color" type= "Color" >
</theme_item>
<theme_item name= "font_color_selected" type= "Color" >
</theme_item>
<theme_item name= "guide_color" type= "Color" >
</theme_item>
<theme_item name= "guide_width" type= "int" >
</theme_item>
<theme_item name= "hseparation" type= "int" >
</theme_item>
<theme_item name= "item_margin" type= "int" >
</theme_item>
<theme_item name= "relationship_line_color" type= "Color" >
</theme_item>
<theme_item name= "scroll_border" type= "int" >
</theme_item>
<theme_item name= "scroll_speed" type= "int" >
</theme_item>
<theme_item name= "select_arrow" type= "Texture" >
</theme_item>
<theme_item name= "selected" type= "StyleBox" >
</theme_item>
<theme_item name= "selected_focus" type= "StyleBox" >
</theme_item>
<theme_item name= "selection_color" type= "Color" >
</theme_item>
<theme_item name= "title_button_color" type= "Color" >
</theme_item>
<theme_item name= "title_button_font" type= "Font" >
</theme_item>
<theme_item name= "title_button_hover" type= "StyleBox" >
</theme_item>
<theme_item name= "title_button_normal" type= "StyleBox" >
</theme_item>
<theme_item name= "title_button_pressed" type= "StyleBox" >
</theme_item>
<theme_item name= "unchecked" type= "Texture" >
</theme_item>
<theme_item name= "updown" type= "Texture" >
</theme_item>
<theme_item name= "vseparation" type= "int" >
</theme_item>
</theme_items>
</class>