2017-09-13 04:42:36 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-07-06 16:08:05 +08:00
<class name= "Tree" inherits= "Control" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../class.xsd" >
2017-09-13 04:42:36 +08:00
<brief_description >
2023-04-30 22:26:09 +08:00
A control used to show a set of internal [TreeItem]s in a hierarchical structure.
2017-09-13 04:42:36 +08:00
</brief_description>
<description >
2023-04-30 22:26:09 +08:00
A control used to show a set of internal [TreeItem]s in a hierarchical structure. The tree items can be selected, expanded and collapsed. The tree can have multiple columns with custom controls like [LineEdit]s, 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 with [member hide_root]:
2020-11-28 07:33:15 +08:00
[codeblocks]
[gdscript]
2017-09-13 04:42:36 +08:00
func _ready():
var tree = Tree.new()
var root = tree.create_item()
2020-11-28 07:33:15 +08:00
tree.hide_root = true
2017-09-13 04:42:36 +08:00
var child1 = tree.create_item(root)
var child2 = tree.create_item(root)
var subchild1 = tree.create_item(child1)
subchild1.set_text(0, "Subchild1")
2020-11-28 07:33:15 +08:00
[/gdscript]
[csharp]
public override void _Ready()
{
var tree = new Tree();
TreeItem root = tree.CreateItem();
tree.HideRoot = true;
TreeItem child1 = tree.CreateItem(root);
TreeItem child2 = tree.CreateItem(root);
TreeItem subchild1 = tree.CreateItem(child1);
subchild1.SetText(0, "Subchild1");
}
[/csharp]
[/codeblocks]
2021-03-08 04:07:30 +08:00
To iterate over all the [TreeItem] objects in a [Tree] object, use [method TreeItem.get_next] and [method TreeItem.get_first_child] after getting the root through [method get_root]. You can use [method Object.free] on a [TreeItem] to remove it from the [Tree].
2022-06-17 18:54:09 +08:00
[b]Incremental search:[/b] Like [ItemList] and [PopupMenu], [Tree] supports searching within the list while the control is focused. Press a key that matches the first letter of an item's name to select the first item starting with the given letter. After that point, there are two ways to perform incremental search: 1) Press the same key again before the timeout duration to select the next item starting with the same letter. 2) Press letter keys that match the rest of the word before the timeout duration to match to select the item in question directly. Both of these actions will be reset to the beginning of the list if the timeout duration has passed since the last keystroke was registered. You can adjust the timeout duration by changing [member ProjectSettings.gui/timers/incremental_search_max_interval_msec].
2017-09-13 04:42:36 +08:00
</description>
<tutorials >
</tutorials>
<methods >
<method name= "clear" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2017-09-13 04:42:36 +08:00
<description >
2017-10-08 01:43:24 +08:00
Clears the tree. This removes all items.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "create_item" >
2021-07-30 21:28:05 +08:00
<return type= "TreeItem" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "parent" type= "TreeItem" default= "null" />
2022-12-22 15:05:04 +08:00
<param index= "1" name= "index" type= "int" default= "-1" />
2017-09-13 04:42:36 +08:00
<description >
2022-08-09 23:19:47 +08:00
Creates an item in the tree and adds it as a child of [param parent], which can be either a valid [TreeItem] or [code]null[/code].
If [param parent] is [code]null[/code], the root item will be the parent, or the new item will be the root itself if the tree is empty.
2022-12-22 15:05:04 +08:00
The new item will be the [param index]-th child of parent, or it will be the last child if there are not enough siblings.
2017-09-13 04:42:36 +08:00
</description>
</method>
2023-01-08 18:38:04 +08:00
<method name= "deselect_all" >
<return type= "void" />
<description >
Deselects all tree items (rows and columns). In [constant SELECT_MULTI] mode also removes selection cursor.
</description>
</method>
2020-11-04 04:08:05 +08:00
<method name= "edit_selected" >
2021-07-30 21:28:05 +08:00
<return type= "bool" />
2022-11-26 22:58:25 +08:00
<param index= "0" name= "force_edit" type= "bool" default= "false" />
2020-11-04 04:08:05 +08:00
<description >
2022-11-26 22:58:25 +08:00
Edits the selected tree item as if it was clicked.
Either the item must be set editable with [method TreeItem.set_editable] or [param force_edit] must be [code]true[/code].
Returns [code]true[/code] if the item could be edited. Fails if no item is selected.
2020-11-04 04:08:05 +08:00
</description>
</method>
2017-09-13 04:42:36 +08:00
<method name= "ensure_cursor_is_visible" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2017-09-13 04:42:36 +08:00
<description >
2020-01-04 16:48:51 +08:00
Makes the currently focused cell visible.
This will scroll the tree if necessary. In [constant SELECT_ROW] mode, this will not do horizontal scrolling, as all the cells in the selected row is focused logically.
[b]Note:[/b] Despite the name of this method, the focus cursor itself is only visible in [constant SELECT_MULTI] mode.
2017-09-13 04:42:36 +08:00
</description>
</method>
2022-02-08 23:56:13 +08:00
<method name= "get_button_id_at_position" qualifiers= "const" >
<return type= "int" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "position" type= "Vector2" />
2022-02-08 23:56:13 +08:00
<description >
2022-12-08 09:40:49 +08:00
Returns the button ID at [param position], or -1 if no button is there.
2022-02-08 23:56:13 +08:00
</description>
</method>
2017-09-10 21:37:49 +08:00
<method name= "get_column_at_position" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "int" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "position" type= "Vector2" />
2017-09-13 04:42:36 +08:00
<description >
2022-08-09 23:19:47 +08:00
Returns the column index at [param position], or -1 if no item is there.
2017-09-13 04:42:36 +08:00
</description>
</method>
2021-07-04 11:13:28 +08:00
<method name= "get_column_expand_ratio" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "int" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "column" type= "int" />
2021-07-04 11:13:28 +08:00
<description >
2022-11-21 10:48:36 +08:00
Returns the expand ratio assigned to the column.
2021-07-04 11:13:28 +08:00
</description>
</method>
2017-09-13 04:42:36 +08:00
<method name= "get_column_title" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "String" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "column" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2017-10-08 01:43:24 +08:00
Returns the column's title.
2017-09-13 04:42:36 +08:00
</description>
</method>
2023-03-26 09:13:31 +08:00
<method name= "get_column_title_alignment" qualifiers= "const" >
<return type= "int" enum= "HorizontalAlignment" />
<param index= "0" name= "column" type= "int" />
<description >
Returns the column title alignment.
</description>
</method>
2020-08-12 19:49:10 +08:00
<method name= "get_column_title_direction" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "int" enum= "Control.TextDirection" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "column" type= "int" />
2020-08-12 19:49:10 +08:00
<description >
Returns column title base writing direction.
</description>
</method>
<method name= "get_column_title_language" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "String" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "column" type= "int" />
2020-08-12 19:49:10 +08:00
<description >
Returns column title language code.
</description>
</method>
2017-09-13 04:42:36 +08:00
<method name= "get_column_width" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "int" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "column" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2017-10-08 01:43:24 +08:00
Returns the column's width in pixels.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "get_custom_popup_rect" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "Rect2" />
2017-09-13 04:42:36 +08:00
<description >
2017-10-08 01:43:24 +08: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-13 04:42:36 +08:00
</description>
</method>
2017-09-10 21:37:49 +08:00
<method name= "get_drop_section_at_position" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "int" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "position" type= "Vector2" />
2017-09-14 02:56:01 +08:00
<description >
2022-08-09 23:19:47 +08:00
Returns the drop section at [param position], or -100 if no item is there.
2020-01-04 16:48:51 +08:00
Values -1, 0, or 1 will be returned for the "above item", "on item", and "below item" drop sections, respectively. See [enum DropModeFlags] for a description of each drop section.
To get the item which the returned drop section is relative to, use [method get_item_at_position].
2017-09-14 02:56:01 +08:00
</description>
</method>
2017-09-13 04:42:36 +08:00
<method name= "get_edited" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "TreeItem" />
2017-09-13 04:42:36 +08:00
<description >
2020-11-14 22:18:01 +08:00
Returns the currently edited item. Can be used with [signal item_edited] to get the item that was modified.
2020-11-28 07:33:15 +08:00
[codeblocks]
[gdscript]
2020-11-14 22:18:01 +08:00
func _ready():
$Tree.item_edited.connect(on_Tree_item_edited)
func on_Tree_item_edited():
print($Tree.get_edited()) # This item just got edited (e.g. checked).
2020-11-28 07:33:15 +08:00
[/gdscript]
[csharp]
public override void _Ready()
{
GetNode< Tree> ("Tree").ItemEdited += OnTreeItemEdited;
}
public void OnTreeItemEdited()
{
GD.Print(GetNode< Tree> ("Tree").GetEdited()); // This item just got edited (e.g. checked).
}
[/csharp]
[/codeblocks]
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "get_edited_column" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2020-11-14 22:18:01 +08:00
Returns the column for the currently edited item.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "get_item_area_rect" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "Rect2" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "item" type= "TreeItem" />
<param index= "1" name= "column" type= "int" default= "-1" />
<param index= "2" name= "button_index" type= "int" default= "-1" />
2017-09-13 04:42:36 +08:00
<description >
2022-08-09 23:19:47 +08:00
Returns the rectangle area for the specified [TreeItem]. If [param column] is specified, only get the position and size of that column, otherwise get the rectangle containing all columns. If a button index is specified, the rectangle of that button will be returned.
2017-09-13 04:42:36 +08:00
</description>
</method>
2017-09-10 21:37:49 +08:00
<method name= "get_item_at_position" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "TreeItem" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "position" type= "Vector2" />
2017-09-13 04:42:36 +08:00
<description >
2017-10-08 01:43:24 +08:00
Returns the tree item at the specified position (relative to the tree origin position).
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "get_next_selected" >
2021-07-30 21:28:05 +08:00
<return type= "TreeItem" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "from" type= "TreeItem" />
2017-09-13 04:42:36 +08:00
<description >
2022-01-25 07:54:21 +08:00
Returns the next selected [TreeItem] after the given one, or [code]null[/code] if the end is reached.
2022-08-09 23:19:47 +08:00
If [param from] is [code]null[/code], this returns the first selected item.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "get_pressed_button" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2017-10-08 01:43:24 +08:00
Returns the last pressed button's index.
2017-09-13 04:42:36 +08:00
</description>
</method>
2021-06-28 21:40:56 +08:00
<method name= "get_root" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "TreeItem" />
2017-09-13 04:42:36 +08:00
<description >
2020-01-04 16:48:51 +08:00
Returns the tree's root item, or [code]null[/code] if the tree is empty.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "get_scroll" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "Vector2" />
2017-09-13 04:42:36 +08:00
<description >
2017-10-08 01:43:24 +08:00
Returns the current scrolling position.
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "get_selected" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "TreeItem" />
2017-09-13 04:42:36 +08:00
<description >
2020-01-04 16:48:51 +08:00
Returns the currently focused item, or [code]null[/code] if no item is focused.
In [constant SELECT_ROW] and [constant SELECT_SINGLE] modes, the focused item is same as the selected item. In [constant SELECT_MULTI] mode, the focused item is the item under the focus cursor, not necessarily selected.
To get the currently selected item(s), use [method get_next_selected].
2017-09-13 04:42:36 +08:00
</description>
</method>
<method name= "get_selected_column" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2020-01-04 16:48:51 +08:00
Returns the currently focused column, or -1 if no column is focused.
In [constant SELECT_SINGLE] mode, the focused column is the selected column. In [constant SELECT_ROW] mode, the focused column is always 0 if any item is selected. In [constant SELECT_MULTI] mode, the focused column is the column under the focus cursor, and there are not necessarily any column selected.
To tell whether a column of an item is selected, use [method TreeItem.is_selected].
2017-09-13 04:42:36 +08:00
</description>
</method>
2021-07-04 11:13:28 +08:00
<method name= "is_column_clipping_content" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "bool" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "column" type= "int" />
2021-07-04 11:13:28 +08:00
<description >
2022-11-21 10:48:36 +08:00
Returns [code]true[/code] if the column has enabled clipping (see [method set_column_clip_content]).
2021-07-04 11:13:28 +08:00
</description>
</method>
<method name= "is_column_expanding" qualifiers= "const" >
2021-07-30 21:28:05 +08:00
<return type= "bool" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "column" type= "int" />
2021-07-04 11:13:28 +08:00
<description >
2022-11-21 10:48:36 +08:00
Returns [code]true[/code] if the column has enabled expanding (see [method set_column_expand]).
2021-07-04 11:13:28 +08:00
</description>
</method>
2021-02-19 20:35:31 +08:00
<method name= "scroll_to_item" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "item" type= "TreeItem" />
<param index= "1" name= "center_on_item" type= "bool" default= "false" />
2021-02-19 20:35:31 +08:00
<description >
2022-01-25 07:54:21 +08:00
Causes the [Tree] to jump to the specified [TreeItem].
2021-02-19 20:35:31 +08:00
</description>
</method>
2021-07-04 11:13:28 +08:00
<method name= "set_column_clip_content" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "column" type= "int" />
<param index= "1" name= "enable" type= "bool" />
2021-07-04 11:13:28 +08:00
<description >
2022-11-21 10:48:36 +08:00
Allows to enable clipping for column's content, making the content size ignored.
2021-07-04 11:13:28 +08:00
</description>
</method>
2021-06-28 21:40:56 +08:00
<method name= "set_column_custom_minimum_width" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "column" type= "int" />
<param index= "1" name= "min_width" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2022-11-01 22:29:38 +08:00
Overrides the calculated minimum width of a column. It can be set to [code]0[/code] to restore the default behavior. Columns that have the "Expand" flag will use their "min_width" in a similar fashion to [member Control.size_flags_stretch_ratio].
2017-09-13 04:42:36 +08:00
</description>
</method>
2021-06-28 21:40:56 +08:00
<method name= "set_column_expand" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "column" type= "int" />
<param index= "1" name= "expand" type= "bool" />
2017-09-13 04:42:36 +08:00
<description >
2022-11-21 10:48:36 +08:00
If [code]true[/code], the column will have the "Expand" flag of [Control]. Columns that have the "Expand" flag will use their expand ratio in a similar fashion to [member Control.size_flags_stretch_ratio] (see [method set_column_expand_ratio]).
2017-09-13 04:42:36 +08:00
</description>
</method>
2021-07-04 11:13:28 +08:00
<method name= "set_column_expand_ratio" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "column" type= "int" />
<param index= "1" name= "ratio" type= "int" />
2021-07-04 11:13:28 +08:00
<description >
2022-11-21 10:48:36 +08:00
Sets the relative expand ratio for a column. See [method set_column_expand].
2021-07-04 11:13:28 +08:00
</description>
</method>
2017-09-13 04:42:36 +08:00
<method name= "set_column_title" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "column" type= "int" />
<param index= "1" name= "title" type= "String" />
2017-09-13 04:42:36 +08:00
<description >
2019-06-22 07:04:47 +08:00
Sets the title of a column.
2017-09-13 04:42:36 +08:00
</description>
</method>
2023-03-26 09:13:31 +08:00
<method name= "set_column_title_alignment" >
<return type= "void" />
<param index= "0" name= "column" type= "int" />
<param index= "1" name= "title_alignment" type= "int" enum= "HorizontalAlignment" />
<description >
Sets the column title alignment. Note that [constant @GlobalScope.HORIZONTAL_ALIGNMENT_FILL] is not supported for column titles.
</description>
</method>
2020-08-12 19:49:10 +08:00
<method name= "set_column_title_direction" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "column" type= "int" />
<param index= "1" name= "direction" type= "int" enum= "Control.TextDirection" />
2020-08-12 19:49:10 +08:00
<description >
Sets column title base writing direction.
</description>
</method>
<method name= "set_column_title_language" >
2021-07-30 21:28:05 +08:00
<return type= "void" />
2022-08-07 02:11:48 +08:00
<param index= "0" name= "column" type= "int" />
<param index= "1" name= "language" type= "String" />
2020-08-12 19:49:10 +08:00
<description >
Sets language code of column title used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
</description>
</method>
2022-11-09 20:45:21 +08:00
<method name= "set_selected" >
<return type= "void" />
<param index= "0" name= "item" type= "TreeItem" />
<param index= "1" name= "column" type= "int" />
<description >
Selects the specified [TreeItem] and column.
</description>
</method>
2017-09-13 04:42:36 +08:00
</methods>
2018-01-12 06:38:35 +08:00
<members >
2019-06-29 18:38:01 +08:00
<member name= "allow_reselect" type= "bool" setter= "set_allow_reselect" getter= "get_allow_reselect" default= "false" >
2018-12-20 20:46:54 +08:00
If [code]true[/code], the currently selected cell may be selected again.
2018-01-12 06:38:35 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "allow_rmb_select" type= "bool" setter= "set_allow_rmb_select" getter= "get_allow_rmb_select" default= "false" >
2018-12-20 20:46:54 +08:00
If [code]true[/code], a right mouse button click can select items.
2018-01-12 06:38:35 +08:00
</member>
2023-04-18 14:50:24 +08:00
<member name= "allow_search" type= "bool" setter= "set_allow_search" getter= "get_allow_search" default= "true" >
If [code]true[/code], allows navigating the [Tree] with letter keys through incremental search.
</member>
2022-01-24 01:14:31 +08:00
<member name= "clip_contents" type= "bool" setter= "set_clip_contents" getter= "is_clipping_contents" overrides= "Control" default= "true" />
2021-12-05 09:35:04 +08:00
<member name= "column_titles_visible" type= "bool" setter= "set_column_titles_visible" getter= "are_column_titles_visible" default= "false" >
If [code]true[/code], column titles are visible.
</member>
2019-06-29 18:38:01 +08:00
<member name= "columns" type= "int" setter= "set_columns" getter= "get_columns" default= "1" >
2019-06-22 07:04:47 +08:00
The number of columns.
2018-01-12 06:38:35 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "drop_mode_flags" type= "int" setter= "set_drop_mode_flags" getter= "get_drop_mode_flags" default= "0" >
2021-05-16 05:48:59 +08:00
The drop mode as an OR combination of flags. See [enum DropModeFlags] constants. Once dropping is done, reverts to [constant DROP_MODE_DISABLED]. Setting this during [method Control._can_drop_data] is recommended.
2020-01-04 16:48:51 +08:00
This controls the drop sections, i.e. the decision and drawing of possible drop locations based on the mouse position.
2018-01-12 06:38:35 +08:00
</member>
2022-07-01 21:43:39 +08:00
<member name= "enable_recursive_folding" type= "bool" setter= "set_enable_recursive_folding" getter= "is_recursive_folding_enabled" default= "true" >
2024-02-13 09:25:37 +08:00
If [code]true[/code], recursive folding is enabled for this [Tree]. Holding down [kbd]Shift[/kbd] while clicking the fold arrow or using [code]ui_right[/code]/[code]ui_left[/code] shortcuts collapses or uncollapses the [TreeItem] and all its descendants.
2022-07-01 21:43:39 +08:00
</member>
2021-12-03 03:38:49 +08:00
<member name= "focus_mode" type= "int" setter= "set_focus_mode" getter= "get_focus_mode" overrides= "Control" enum= "Control.FocusMode" default= "2" />
2019-06-29 18:38:01 +08:00
<member name= "hide_folding" type= "bool" setter= "set_hide_folding" getter= "is_folding_hidden" default= "false" >
2018-12-20 20:46:54 +08:00
If [code]true[/code], the folding arrow is hidden.
2018-01-12 06:38:35 +08:00
</member>
2019-06-29 18:38:01 +08:00
<member name= "hide_root" type= "bool" setter= "set_hide_root" getter= "is_root_hidden" default= "false" >
2018-12-20 20:46:54 +08:00
If [code]true[/code], the tree's root is hidden.
2018-01-12 06:38:35 +08:00
</member>
2021-06-26 03:19:46 +08:00
<member name= "scroll_horizontal_enabled" type= "bool" setter= "set_h_scroll_enabled" getter= "is_h_scroll_enabled" default= "true" >
If [code]true[/code], enables horizontal scrolling.
</member>
<member name= "scroll_vertical_enabled" type= "bool" setter= "set_v_scroll_enabled" getter= "is_v_scroll_enabled" default= "true" >
If [code]true[/code], enables vertical scrolling.
</member>
2019-06-29 18:38:01 +08:00
<member name= "select_mode" type= "int" setter= "set_select_mode" getter= "get_select_mode" enum= "Tree.SelectMode" default= "0" >
2019-12-07 06:09:20 +08:00
Allows single or multiple selection. See the [enum SelectMode] constants.
2018-01-12 06:38:35 +08:00
</member>
</members>
2017-09-13 04:42:36 +08:00
<signals >
2021-09-18 15:33:18 +08:00
<signal name= "button_clicked" >
2022-08-07 02:11:48 +08:00
<param index= "0" name= "item" type= "TreeItem" />
<param index= "1" name= "column" type= "int" />
<param index= "2" name= "id" type= "int" />
<param index= "3" name= "mouse_button_index" type= "int" />
2017-09-13 04:42:36 +08:00
<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>
2021-09-17 23:50:24 +08:00
<signal name= "check_propagated_to_item" >
2022-08-07 02:11:48 +08:00
<param index= "0" name= "item" type= "TreeItem" />
<param index= "1" name= "column" type= "int" />
2021-09-17 23:50:24 +08:00
<description >
Emitted when [method TreeItem.propagate_check] is called. Connect to this signal to process the items that are affected when [method TreeItem.propagate_check] is invoked. The order that the items affected will be processed is as follows: the item that invoked the method, children of that item, and finally parents of that item.
</description>
</signal>
2022-08-14 00:30:41 +08:00
<signal name= "column_title_clicked" >
2022-08-07 02:11:48 +08:00
<param index= "0" name= "column" type= "int" />
2022-08-14 00:30:41 +08:00
<param index= "1" name= "mouse_button_index" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2022-08-14 00:30:41 +08:00
Emitted when a column's title is clicked with either [constant MOUSE_BUTTON_LEFT] or [constant MOUSE_BUTTON_RIGHT].
2017-09-13 04:42:36 +08:00
</description>
</signal>
2021-09-18 15:33:18 +08:00
<signal name= "custom_item_clicked" >
2022-08-07 02:11:48 +08:00
<param index= "0" name= "mouse_button_index" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2021-09-18 15:33:18 +08:00
Emitted when an item with [constant TreeItem.CELL_MODE_CUSTOM] is clicked with a mouse button.
2017-09-13 04:42:36 +08:00
</description>
</signal>
2021-09-18 15:33:18 +08:00
<signal name= "custom_popup_edited" >
2022-08-07 02:11:48 +08:00
<param index= "0" name= "arrow_clicked" type= "bool" />
2019-05-29 00:08:13 +08:00
<description >
2021-09-18 15:33:18 +08:00
Emitted when a cell with the [constant TreeItem.CELL_MODE_CUSTOM] is clicked to be edited.
2019-05-29 00:08:13 +08:00
</description>
</signal>
2021-09-18 15:33:18 +08:00
<signal name= "empty_clicked" >
2022-08-07 02:11:48 +08:00
<param index= "0" name= "position" type= "Vector2" />
<param index= "1" name= "mouse_button_index" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2021-09-18 15:33:18 +08:00
Emitted when a mouse button is clicked in the empty space of the tree.
2017-09-13 04:42:36 +08:00
</description>
</signal>
<signal name= "item_activated" >
<description >
2022-12-21 23:58:59 +08:00
Emitted when an item is double-clicked, or selected with a [code]ui_accept[/code] input event (e.g. using [kbd]Enter[/kbd] or [kbd]Space[/kbd] on the keyboard).
2017-09-13 04:42:36 +08:00
</description>
</signal>
<signal name= "item_collapsed" >
2022-08-07 02:11:48 +08:00
<param index= "0" name= "item" type= "TreeItem" />
2017-09-13 04:42:36 +08:00
<description >
Emitted when an item is collapsed by a click on the folding arrow.
</description>
</signal>
2022-12-21 23:58:59 +08:00
<signal name= "item_edited" >
2017-09-13 04:42:36 +08:00
<description >
2022-12-21 23:58:59 +08:00
Emitted when an item is edited.
2017-09-13 04:42:36 +08:00
</description>
</signal>
2022-12-21 23:58:59 +08:00
<signal name= "item_icon_double_clicked" >
2017-09-13 04:42:36 +08:00
<description >
2022-12-21 23:58:59 +08:00
Emitted when an item's icon is double-clicked. For a signal that emits when any part of the item is double-clicked, see [signal item_activated].
2017-09-13 04:42:36 +08:00
</description>
</signal>
2021-09-18 15:33:18 +08:00
<signal name= "item_mouse_selected" >
2022-08-07 02:11:48 +08:00
<param index= "0" name= "position" type= "Vector2" />
<param index= "1" name= "mouse_button_index" type= "int" />
2017-09-13 04:42:36 +08:00
<description >
2021-09-18 15:33:18 +08:00
Emitted when an item is selected with a mouse button.
2017-09-13 04:42:36 +08:00
</description>
</signal>
<signal name= "item_selected" >
<description >
2018-11-23 01:11:09 +08:00
Emitted when an item is selected.
2017-09-13 04:42:36 +08:00
</description>
</signal>
<signal name= "multi_selected" >
2022-08-07 02:11:48 +08:00
<param index= "0" name= "item" type= "TreeItem" />
<param index= "1" name= "column" type= "int" />
<param index= "2" name= "selected" type= "bool" />
2017-09-13 04:42:36 +08:00
<description >
2023-10-03 02:11:43 +08:00
Emitted instead of [signal item_selected] if [member select_mode] is set to [constant SELECT_MULTI].
2017-09-13 04:42:36 +08:00
</description>
</signal>
2017-11-28 06:37:47 +08:00
<signal name= "nothing_selected" >
<description >
2020-01-04 16:48:51 +08:00
Emitted when a left mouse button click does not select any item.
2017-11-28 06:37:47 +08:00
</description>
</signal>
2017-09-13 04:42:36 +08:00
</signals>
<constants >
2017-11-25 06:16:30 +08:00
<constant name= "SELECT_SINGLE" value= "0" enum= "SelectMode" >
2020-01-04 16:48:51 +08:00
Allows selection of a single cell at a time. From the perspective of items, only a single item is allowed to be selected. And there is only one column selected in the selected item.
The focus cursor is always hidden in this mode, but it is positioned at the current selection, making the currently selected item the currently focused item.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "SELECT_ROW" value= "1" enum= "SelectMode" >
2020-01-04 16:48:51 +08:00
Allows selection of a single row at a time. From the perspective of items, only a single items is allowed to be selected. And all the columns are selected in the selected item.
The focus cursor is always hidden in this mode, but it is positioned at the first column of the current selection, making the currently selected item the currently focused item.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "SELECT_MULTI" value= "2" enum= "SelectMode" >
2020-01-04 16:48:51 +08:00
Allows selection of multiple cells at the same time. From the perspective of items, multiple items are allowed to be selected. And there can be multiple columns selected in each selected item.
The focus cursor is visible in this mode, the item or column under the cursor is not necessarily selected.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "DROP_MODE_DISABLED" value= "0" enum= "DropModeFlags" >
2020-01-04 16:48:51 +08:00
Disables all drop sections, but still allows to detect the "on item" drop section by [method get_drop_section_at_position].
[b]Note:[/b] This is the default flag, it has no effect when combined with other flags.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "DROP_MODE_ON_ITEM" value= "1" enum= "DropModeFlags" >
2020-01-04 16:48:51 +08:00
Enables the "on item" drop section. This drop section covers the entire item.
When combined with [constant DROP_MODE_INBETWEEN], this drop section halves the height and stays centered vertically.
2017-09-13 04:42:36 +08:00
</constant>
2017-11-25 06:16:30 +08:00
<constant name= "DROP_MODE_INBETWEEN" value= "2" enum= "DropModeFlags" >
2020-01-04 16:48:51 +08:00
Enables "above item" and "below item" drop sections. The "above item" drop section covers the top half of the item, and the "below item" drop section covers the bottom half.
When combined with [constant DROP_MODE_ON_ITEM], these drop sections halves the height and stays on top / bottom accordingly.
2017-09-13 04:42:36 +08:00
</constant>
</constants>
<theme_items >
2021-08-05 00:54:41 +08:00
<theme_item name= "children_hl_line_color" data_type= "color" type= "Color" default= "Color(0.27, 0.27, 0.27, 1)" >
2021-05-02 23:34:29 +08:00
The [Color] of the relationship lines between the selected [TreeItem] and its children.
</theme_item>
2021-12-31 00:22:06 +08:00
<theme_item name= "custom_button_font_highlight" data_type= "color" type= "Color" default= "Color(0.95, 0.95, 0.95, 1)" >
2020-02-07 10:01:42 +08:00
Text [Color] for a [constant TreeItem.CELL_MODE_CUSTOM] mode cell when it's hovered.
2017-09-13 04:42:36 +08:00
</theme_item>
2022-08-03 06:48:11 +08:00
<theme_item name= "drop_position_color" data_type= "color" type= "Color" default= "Color(1, 1, 1, 1)" >
2020-02-07 10:01:42 +08:00
[Color] used to draw possible drop locations. See [enum DropModeFlags] constants for further description of drop locations.
2017-09-13 04:42:36 +08:00
</theme_item>
2021-12-31 00:22:06 +08:00
<theme_item name= "font_color" data_type= "color" type= "Color" default= "Color(0.7, 0.7, 0.7, 1)" >
2020-02-07 10:01:42 +08:00
Default text [Color] of the item.
2017-09-13 04:42:36 +08:00
</theme_item>
2023-11-13 21:38:56 +08:00
<theme_item name= "font_disabled_color" data_type= "color" type= "Color" default= "Color(0.875, 0.875, 0.875, 0.5)" >
Text [Color] for a [constant TreeItem.CELL_MODE_CHECK] mode cell when it's non-editable (see [method TreeItem.set_editable]).
</theme_item>
2021-08-05 00:54:41 +08:00
<theme_item name= "font_outline_color" data_type= "color" type= "Color" default= "Color(1, 1, 1, 1)" >
2020-12-26 05:45:28 +08:00
The tint of text outline of the item.
</theme_item>
2021-08-05 00:54:41 +08:00
<theme_item name= "font_selected_color" data_type= "color" type= "Color" default= "Color(1, 1, 1, 1)" >
2020-02-07 10:01:42 +08:00
Text [Color] used when the item is selected.
2017-09-13 04:42:36 +08:00
</theme_item>
2021-12-31 00:22:06 +08:00
<theme_item name= "guide_color" data_type= "color" type= "Color" default= "Color(0.7, 0.7, 0.7, 0.25)" >
2020-02-07 10:01:42 +08:00
[Color] of the guideline.
2017-09-13 04:42:36 +08:00
</theme_item>
2021-12-02 02:02:20 +08:00
<theme_item name= "parent_hl_line_color" data_type= "color" type= "Color" default= "Color(0.27, 0.27, 0.27, 1)" >
The [Color] of the relationship lines between the selected [TreeItem] and its parents.
</theme_item>
<theme_item name= "relationship_line_color" data_type= "color" type= "Color" default= "Color(0.27, 0.27, 0.27, 1)" >
The default [Color] of the relationship lines.
</theme_item>
2021-12-31 00:22:06 +08:00
<theme_item name= "title_button_color" data_type= "color" type= "Color" default= "Color(0.875, 0.875, 0.875, 1)" >
2021-12-02 02:02:20 +08:00
Default text [Color] of the title button.
</theme_item>
<theme_item name= "button_margin" data_type= "constant" type= "int" default= "4" >
The horizontal space between each button in a cell.
</theme_item>
<theme_item name= "children_hl_line_width" data_type= "constant" type= "int" default= "1" >
The width of the relationship lines between the selected [TreeItem] and its children.
</theme_item>
<theme_item name= "draw_guides" data_type= "constant" type= "int" default= "1" >
Draws the guidelines if not zero, this acts as a boolean. The guideline is a horizontal line drawn at the bottom of each item.
</theme_item>
<theme_item name= "draw_relationship_lines" data_type= "constant" type= "int" default= "0" >
Draws the relationship lines if not zero, this acts as a boolean. Relationship lines are drawn at the start of child items to show hierarchy.
</theme_item>
2022-04-15 05:20:28 +08:00
<theme_item name= "h_separation" data_type= "constant" type= "int" default= "4" >
2020-02-07 10:01:42 +08:00
The horizontal space between item cells. This is also used as the margin at the start of an item when folding is disabled.
2017-09-13 04:42:36 +08:00
</theme_item>
2023-04-01 03:17:59 +08:00
<theme_item name= "icon_max_width" data_type= "constant" type= "int" default= "0" >
The maximum allowed width of the icon in item's cells. This limit is applied on top of the default size of the icon, but before the value set with [method TreeItem.set_icon_max_width]. The height is adjusted according to the icon's ratio.
</theme_item>
2023-04-28 02:16:28 +08:00
<theme_item name= "inner_item_margin_bottom" data_type= "constant" type= "int" default= "0" >
The inner bottom margin of an item.
</theme_item>
<theme_item name= "inner_item_margin_left" data_type= "constant" type= "int" default= "0" >
The inner left margin of an item.
</theme_item>
<theme_item name= "inner_item_margin_right" data_type= "constant" type= "int" default= "0" >
The inner right margin of an item.
</theme_item>
<theme_item name= "inner_item_margin_top" data_type= "constant" type= "int" default= "0" >
The inner top margin of an item.
</theme_item>
2021-12-31 00:22:06 +08:00
<theme_item name= "item_margin" data_type= "constant" type= "int" default= "16" >
2020-02-07 10:01:42 +08:00
The horizontal margin at the start of an item. This is used when folding is enabled for the item.
2017-09-13 04:42:36 +08:00
</theme_item>
2021-08-05 00:54:41 +08:00
<theme_item name= "outline_size" data_type= "constant" type= "int" default= "0" >
2020-12-26 05:45:28 +08:00
The size of the text outline.
2022-12-20 00:15:44 +08:00
[b]Note:[/b] If using a font with [member FontFile.multichannel_signed_distance_field] enabled, its [member FontFile.msdf_pixel_range] must be set to at least [i]twice[/i] the value of [theme_item outline_size] for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended.
2020-12-26 05:45:28 +08:00
</theme_item>
2021-08-05 00:54:41 +08:00
<theme_item name= "parent_hl_line_margin" data_type= "constant" type= "int" default= "0" >
2021-05-02 23:34:29 +08:00
The space between the parent relationship lines for the selected [TreeItem] and the relationship lines to its siblings that are not selected.
</theme_item>
2021-08-05 00:54:41 +08:00
<theme_item name= "parent_hl_line_width" data_type= "constant" type= "int" default= "1" >
2021-05-02 23:34:29 +08:00
The width of the relationship lines between the selected [TreeItem] and its parents.
</theme_item>
2021-08-05 00:54:41 +08:00
<theme_item name= "relationship_line_width" data_type= "constant" type= "int" default= "1" >
2021-05-02 23:34:29 +08:00
The default width of the relationship lines.
2017-09-13 04:42:36 +08:00
</theme_item>
2021-08-05 00:54:41 +08:00
<theme_item name= "scroll_border" data_type= "constant" type= "int" default= "4" >
2020-02-07 10:01:42 +08:00
The maximum distance between the mouse cursor and the control's border to trigger border scrolling when dragging.
2017-09-13 04:42:36 +08:00
</theme_item>
2021-08-05 00:54:41 +08:00
<theme_item name= "scroll_speed" data_type= "constant" type= "int" default= "12" >
2020-02-07 10:01:42 +08:00
The speed of border scrolling.
2017-09-13 04:42:36 +08:00
</theme_item>
2023-01-04 10:59:34 +08:00
<theme_item name= "scrollbar_h_separation" data_type= "constant" type= "int" default= "4" >
The horizontal separation of tree content and scrollbar.
</theme_item>
<theme_item name= "scrollbar_margin_bottom" data_type= "constant" type= "int" default= "-1" >
The bottom margin of the scrollbars. When negative, uses [theme_item panel] bottom margin.
</theme_item>
<theme_item name= "scrollbar_margin_left" data_type= "constant" type= "int" default= "-1" >
The left margin of the horizontal scrollbar. When negative, uses [theme_item panel] left margin.
</theme_item>
<theme_item name= "scrollbar_margin_right" data_type= "constant" type= "int" default= "-1" >
The right margin of the scrollbars. When negative, uses [theme_item panel] right margin.
</theme_item>
<theme_item name= "scrollbar_margin_top" data_type= "constant" type= "int" default= "-1" >
2023-08-22 16:13:42 +08:00
The top margin of the vertical scrollbar. When negative, uses [theme_item panel] top margin.
2023-01-04 10:59:34 +08:00
</theme_item>
<theme_item name= "scrollbar_v_separation" data_type= "constant" type= "int" default= "4" >
The vertical separation of tree content and scrollbar.
</theme_item>
2022-04-15 05:20:28 +08:00
<theme_item name= "v_separation" data_type= "constant" type= "int" default= "4" >
2021-12-02 02:02:20 +08:00
The vertical padding inside each item, i.e. the distance between the item's content and top/bottom border.
</theme_item>
<theme_item name= "font" data_type= "font" type= "Font" >
[Font] of the item's text.
</theme_item>
<theme_item name= "title_button_font" data_type= "font" type= "Font" >
[Font] of the title button's text.
</theme_item>
<theme_item name= "font_size" data_type= "font_size" type= "int" >
Font size of the item's text.
</theme_item>
2023-07-08 00:48:13 +08:00
<theme_item name= "title_button_font_size" data_type= "font_size" type= "int" >
Font size of the title button's text.
</theme_item>
2021-12-02 02:02:20 +08:00
<theme_item name= "arrow" data_type= "icon" type= "Texture2D" >
The arrow icon used when a foldable item is not collapsed.
</theme_item>
<theme_item name= "arrow_collapsed" data_type= "icon" type= "Texture2D" >
The arrow icon used when a foldable item is collapsed (for left-to-right layouts).
</theme_item>
<theme_item name= "arrow_collapsed_mirrored" data_type= "icon" type= "Texture2D" >
The arrow icon used when a foldable item is collapsed (for right-to-left layouts).
</theme_item>
<theme_item name= "checked" data_type= "icon" type= "Texture2D" >
2023-11-13 21:38:56 +08:00
The check icon to display when the [constant TreeItem.CELL_MODE_CHECK] mode cell is checked and editable (see [method TreeItem.set_editable]).
</theme_item>
<theme_item name= "checked_disabled" data_type= "icon" type= "Texture2D" >
The check icon to display when the [constant TreeItem.CELL_MODE_CHECK] mode cell is checked and non-editable (see [method TreeItem.set_editable]).
2021-12-02 02:02:20 +08:00
</theme_item>
<theme_item name= "indeterminate" data_type= "icon" type= "Texture2D" >
2023-11-13 21:38:56 +08:00
The check icon to display when the [constant TreeItem.CELL_MODE_CHECK] mode cell is indeterminate and editable (see [method TreeItem.set_editable]).
</theme_item>
<theme_item name= "indeterminate_disabled" data_type= "icon" type= "Texture2D" >
The check icon to display when the [constant TreeItem.CELL_MODE_CHECK] mode cell is indeterminate and non-editable (see [method TreeItem.set_editable]).
2021-12-02 02:02:20 +08:00
</theme_item>
2021-08-05 00:54:41 +08:00
<theme_item name= "select_arrow" data_type= "icon" type= "Texture2D" >
2020-02-07 10:01:42 +08:00
The arrow icon to display for the [constant TreeItem.CELL_MODE_RANGE] mode cell.
2017-09-13 04:42:36 +08:00
</theme_item>
2021-12-02 02:02:20 +08:00
<theme_item name= "unchecked" data_type= "icon" type= "Texture2D" >
2023-11-13 21:38:56 +08:00
The check icon to display when the [constant TreeItem.CELL_MODE_CHECK] mode cell is unchecked and editable (see [method TreeItem.set_editable]).
</theme_item>
<theme_item name= "unchecked_disabled" data_type= "icon" type= "Texture2D" >
The check icon to display when the [constant TreeItem.CELL_MODE_CHECK] mode cell is unchecked and non-editable (see [method TreeItem.set_editable]).
2021-12-02 02:02:20 +08:00
</theme_item>
<theme_item name= "updown" data_type= "icon" type= "Texture2D" >
The updown arrow icon to display for the [constant TreeItem.CELL_MODE_RANGE] mode cell.
</theme_item>
<theme_item name= "button_pressed" data_type= "style" type= "StyleBox" >
[StyleBox] used when a button in the tree is pressed.
</theme_item>
<theme_item name= "cursor" data_type= "style" type= "StyleBox" >
[StyleBox] used for the cursor, when the [Tree] is being focused.
</theme_item>
<theme_item name= "cursor_unfocused" data_type= "style" type= "StyleBox" >
[StyleBox] used for the cursor, when the [Tree] is not being focused.
</theme_item>
<theme_item name= "custom_button" data_type= "style" type= "StyleBox" >
Default [StyleBox] for a [constant TreeItem.CELL_MODE_CUSTOM] mode cell.
</theme_item>
<theme_item name= "custom_button_hover" data_type= "style" type= "StyleBox" >
[StyleBox] for a [constant TreeItem.CELL_MODE_CUSTOM] mode cell when it's hovered.
</theme_item>
<theme_item name= "custom_button_pressed" data_type= "style" type= "StyleBox" >
[StyleBox] for a [constant TreeItem.CELL_MODE_CUSTOM] mode cell when it's pressed.
</theme_item>
2022-09-07 01:09:32 +08:00
<theme_item name= "focus" data_type= "style" type= "StyleBox" >
The focused style for the [Tree], drawn on top of everything.
</theme_item>
<theme_item name= "panel" data_type= "style" type= "StyleBox" >
The background style for the [Tree].
</theme_item>
2021-08-05 00:54:41 +08:00
<theme_item name= "selected" data_type= "style" type= "StyleBox" >
2020-02-07 10:01:42 +08:00
[StyleBox] for the selected items, used when the [Tree] is not being focused.
2017-09-13 04:42:36 +08:00
</theme_item>
2021-08-05 00:54:41 +08:00
<theme_item name= "selected_focus" data_type= "style" type= "StyleBox" >
2020-02-07 10:01:42 +08:00
[StyleBox] for the selected items, used when the [Tree] is being focused.
2017-09-13 04:42:36 +08:00
</theme_item>
2021-08-05 00:54:41 +08:00
<theme_item name= "title_button_hover" data_type= "style" type= "StyleBox" >
2020-02-07 10:01:42 +08:00
[StyleBox] used when the title button is being hovered.
2017-09-13 04:42:36 +08:00
</theme_item>
2021-08-05 00:54:41 +08:00
<theme_item name= "title_button_normal" data_type= "style" type= "StyleBox" >
2020-02-07 10:01:42 +08:00
Default [StyleBox] for the title button.
2017-09-13 04:42:36 +08:00
</theme_item>
2021-08-05 00:54:41 +08:00
<theme_item name= "title_button_pressed" data_type= "style" type= "StyleBox" >
2020-02-07 10:01:42 +08:00
[StyleBox] used when the title button is being pressed.
2017-09-13 04:42:36 +08:00
</theme_item>
</theme_items>
</class>