From bca0d36fe662477eb787b4ddc9b0b69ab4603393 Mon Sep 17 00:00:00 2001 From: trollodel <33117082+trollodel@users.noreply.github.com> Date: Sun, 7 Mar 2021 21:07:30 +0100 Subject: Improve TreeItem API and allow to move nodes --- doc/classes/Tree.xml | 2 +- doc/classes/TreeItem.xml | 66 +++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 61 insertions(+), 7 deletions(-) (limited to 'doc') diff --git a/doc/classes/Tree.xml b/doc/classes/Tree.xml index a09f1bf470..27b26801f3 100644 --- a/doc/classes/Tree.xml +++ b/doc/classes/Tree.xml @@ -30,7 +30,7 @@ } [/csharp] [/codeblocks] - To iterate over all the [TreeItem] objects in a [Tree] object, use [method TreeItem.get_next] and [method TreeItem.get_children] after getting the root through [method get_root]. You can use [method Object.free] on a [TreeItem] to remove it from the [Tree]. + 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]. diff --git a/doc/classes/TreeItem.xml b/doc/classes/TreeItem.xml index add23c2ce6..7d37580504 100644 --- a/doc/classes/TreeItem.xml +++ b/doc/classes/TreeItem.xml @@ -63,6 +63,16 @@ Removes all OpenType features. + + + + + + + Creates an item and adds it as a child. + The new item will be inserted as position [code]idx[/code] (the default value [code]-1[/code] means the last position), or it will be the last child if [code]idx[/code] is higher than the child count. + + @@ -123,11 +133,28 @@ Returns the column's cell mode. - + + + + + Returns a child item by its 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 TreeItem's first child item or a null object if there is none. + Returns the number of child items. + + + + + + + Returns an array of references to the item's children. @@ -157,6 +184,13 @@ Returns [code]true[/code] if [code]expand_right[/code] is set. + + + + + Returns the TreeItem's first child. + + @@ -193,6 +227,13 @@ 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]. + + @@ -342,6 +383,13 @@ Returns the given column's tooltip. + + + + + Returns the [Tree] that owns this TreeItem. + + @@ -397,18 +445,24 @@ Returns [code]true[/code] if column [code]column[/code] is selected. - + + + - Moves this TreeItem to the bottom in the [Tree] hierarchy. + Moves this TreeItem right after the given [code]item[/code]. + [b]Note:[/b] You can't move to the root or move the root. - + + + - Moves this TreeItem to the top in the [Tree] hierarchy. + Moves this TreeItem right before the given [code]item[/code]. + [b]Note:[/b] You can't move to the root or move the root. -- cgit v1.2.3