From 8a4104acb8514bbcd1d7ff811c35f10f3c41149e Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Sat, 4 Jan 2020 16:48:51 +0800 Subject: Improves Tree documentation --- doc/classes/Tree.xml | 47 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/doc/classes/Tree.xml b/doc/classes/Tree.xml index dd4330b00b..aa1f8638d2 100644 --- a/doc/classes/Tree.xml +++ b/doc/classes/Tree.xml @@ -43,14 +43,18 @@ - Create an item in the tree and add it as the last child of [code]parent[/code]. If [code]parent[/code] is [code]null[/code], it will be added as the root's last child, or it'll be the the root itself if the tree is empty. + Creates an item in the tree and adds it as a child of [code]parent[/code]. + If [code]parent[/code] 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. + The new item will be the [code]idx[/code]th child of parent, or it will be the last child if there are not enough siblings. - Makes the currently selected item visible. This will scroll the tree to make sure the selected item is visible. + 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. @@ -59,7 +63,7 @@ - Returns the column index under the given point. + Returns the column index at [code]position[/code], or -1 if no item is there. @@ -93,8 +97,9 @@ - If [member drop_mode_flags] includes [constant DROP_MODE_INBETWEEN], returns -1 if [code]position[/code] is the upper part of a tree item at that position, 1 for the lower part, and additionally 0 for the middle part if [member drop_mode_flags] includes [constant DROP_MODE_ON_ITEM]. - Otherwise, returns 0. If there are no tree items at [code]position[/code], returns -100. + Returns the drop section at [code]position[/code], or -100 if no item is there. + 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]. @@ -119,7 +124,7 @@ - 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. + Returns the rectangle area for the specified item. If [code]column[/code] is specified, only get the position and size of that column, otherwise get the rectangle containing all columns. @@ -137,7 +142,8 @@ - Returns the next selected item after the given one. + Returns the next selected item after the given one, or [code]null[/code] if the end is reached. + If [code]from[/code] is [code]null[/code], this returns the first selected item. @@ -151,7 +157,7 @@ - Returns the tree's root item. + Returns the tree's root item, or [code]null[/code] if the tree is empty. @@ -165,14 +171,18 @@ - Returns the currently selected item. + 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]. - Returns the current selection's column. + 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]. @@ -230,6 +240,7 @@ 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. + This controls the drop sections, i.e. the decision and drawing of possible drop locations based on the mouse position. @@ -278,6 +289,7 @@ + Emitted when the right mouse button is pressed in the empty space of the tree. @@ -343,23 +355,34 @@ + Emitted when a left mouse button click does not select any item. - Allows selection of a single item at a time. + 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. + 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. - Allows selection of multiple items at the same time. + 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. + 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. + 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. + 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. -- cgit v1.2.3