From a541d4508f380d2306d1a780f4bd1b39a02ebc59 Mon Sep 17 00:00:00 2001 From: kobewi Date: Sun, 19 May 2024 12:37:41 +0200 Subject: [PATCH] Improve documentation on TreeItem's cell modes --- doc/classes/Tree.xml | 6 +++--- doc/classes/TreeItem.xml | 23 ++++++++++++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/doc/classes/Tree.xml b/doc/classes/Tree.xml index 43cd1a8aaa5e..b0cb25fafd8a 100644 --- a/doc/classes/Tree.xml +++ b/doc/classes/Tree.xml @@ -655,13 +655,13 @@ [StyleBox] used for the cursor, when the [Tree] is not being focused. - Default [StyleBox] for a [constant TreeItem.CELL_MODE_CUSTOM] mode cell. + Default [StyleBox] for a [constant TreeItem.CELL_MODE_CUSTOM] mode cell when button is enabled with [method TreeItem.set_custom_as_button]. - [StyleBox] for a [constant TreeItem.CELL_MODE_CUSTOM] mode cell when it's hovered. + [StyleBox] for a [constant TreeItem.CELL_MODE_CUSTOM] mode button cell when it's hovered. - [StyleBox] for a [constant TreeItem.CELL_MODE_CUSTOM] mode cell when it's pressed. + [StyleBox] for a [constant TreeItem.CELL_MODE_CUSTOM] mode button cell when it's pressed. The focused style for the [Tree], drawn on top of everything. diff --git a/doc/classes/TreeItem.xml b/doc/classes/TreeItem.xml index c679838ec55c..78a703c213ac 100644 --- a/doc/classes/TreeItem.xml +++ b/doc/classes/TreeItem.xml @@ -318,12 +318,14 @@ + Returns the BiDi algorithm override set for this cell. + Returns the additional BiDi options set for this cell. @@ -401,6 +403,7 @@ + Returns [code]true[/code] if the cell was made into a button with [method set_custom_as_button]. @@ -532,7 +535,7 @@ - Sets the given column's cell mode to [param mode]. See [enum TreeCellMode] constants. + Sets the given column's cell mode to [param mode]. This determines how the cell is displayed and edited. See [enum TreeCellMode] constants for details. @@ -555,6 +558,7 @@ + Makes a cell with [constant CELL_MODE_CUSTOM] display as a non-flat button with a [StyleBox]. @@ -589,7 +593,7 @@ - Sets the given column's custom draw callback. Use an empty [Callable] ([code skip-lint]Callable()[/code]) to clear the custom callback. + Sets the given column's custom draw callback. Use an empty [Callable] ([code skip-lint]Callable()[/code]) to clear the custom callback. The cell has to be in [constant CELL_MODE_CUSTOM] to use this feature. The [param callback] should accept two arguments: the [TreeItem] that is drawn and its position and size as a [Rect2]. @@ -639,7 +643,7 @@ - Sets the given column's icon [Texture2D]. + Sets the given cell's icon [Texture2D]. The cell has to be in [constant CELL_MODE_ICON] mode. @@ -724,6 +728,7 @@ + Set BiDi algorithm override for the structured text. Has effect for cells that display text. @@ -731,6 +736,7 @@ + Set additional options for BiDi override. Has effect for cells that display text. @@ -805,18 +811,21 @@ - Cell contains a string. + Cell shows a string label. When editable, the text can be edited using a [LineEdit], or a [TextEdit] popup if [method set_edit_multiline] is used. - Cell contains a checkbox. + Cell shows a checkbox, optionally with text. The checkbox can be pressed, released, or indeterminate (via [method set_indeterminate]). The checkbox can't be clicked unless the cell is editable. - Cell contains a range. + Cell shows a numeric range. When editable, it can be edited using a range slider. Use [method set_range] to set the value and [method set_range_config] to configure the range. + This cell can also be used in a text dropdown mode when you assign a text with [method set_text]. Separate options with a comma, e.g. [code]"Option1,Option2,Option3"[/code]. - Cell contains an icon. + Cell shows an icon. It can't be edited nor display text. + Cell shows as a clickable button. It will display an arrow similar to [OptionButton], but doesn't feature a dropdown (for that you can use [constant CELL_MODE_RANGE]). Clicking the button emits the [signal Tree.item_edited] signal. The button is flat by default, you can use [method set_custom_as_button] to display it with a [StyleBox]. + This mode also supports custom drawing using [method set_custom_draw_callback].