Control that provides a list of selectable items (and/or icons) in a single column, or optionally in multiple columns.
This control provides a selectable list of items that may be in a single (or multiple columns) with option of text, icons, or both text and icon. Tooltips are supported and may be different for every item in the list.
Selectable items in the list may be selected or deselected and multiple selection may be enabled. Selection with right mouse button may also be enabled to allow use of popup context menus. Items may also be "activated" by double-clicking them or by pressing [kbd]Enter[/kbd].
Item text only supports single-line strings, newline characters (e.g. [code]\n[/code]) in the string won't produce a newline. Text wrapping is enabled in [constant ICON_MODE_TOP] mode, but column's width is adjusted to fully fit its content by default. You need to set [member fixed_column_width] greater than zero to wrap the text.
Adds an item to the item list with no text, only an icon.
Adds an item to the item list with specified text. Specify an [code]icon[/code], or use [code]null[/code] as the [code]icon[/code] for a list item with no icon.
If selectable is [code]true[/code], the list item will be selectable.
Removes all items from the list.
Removes all OpenType features from the item's text.
Ensures the item associated with the specified index is not selected.
Ensures there are no items selected.
Ensure current selection is visible, adjusting the scroll position as necessary.
Returns the item index at the given [code]position[/code].
When there is no item at that point, -1 will be returned if [code]exact[/code] is [code]true[/code], and the closest item index will be returned otherwise.
Returns the number of items currently in the list.
Returns the custom background color of the item specified by [code]idx[/code] index.
Returns the custom foreground color of the item specified by [code]idx[/code] index.
Returns the icon associated with the specified index.
Returns a [Color] modulating item's icon at the specified index.
Returns the region of item's icon used. The whole icon will be used if the region has no area.
Returns item's text language code.
Returns the metadata value of the specified index.
Returns OpenType feature [code]tag[/code] of the item's text.
Returns the text associated with the specified index.
Returns item's text base writing direction.
Returns the tooltip hint associated with the specified index.
Returns an array with the indexes of the selected items.
Returns the [Object] ID associated with the list.
Returns [code]true[/code] if one or more items are selected.
Returns [code]true[/code] if the item at the specified index is disabled.
Returns [code]true[/code] if the item icon will be drawn transposed, i.e. the X and Y axes are swapped.
Returns [code]true[/code] if the item at the specified index is selectable.
Returns [code]true[/code] if the tooltip is enabled for specified item index.
Returns [code]true[/code] if the item at the specified index is currently selected.
Moves item from index [code]from_idx[/code] to [code]to_idx[/code].
Removes the item specified by [code]idx[/code] index from the list.
Select the item at the specified index.
[b]Note:[/b] This method does not trigger the item selection signal.
[codeblocks]
[gdscript]
var itemList = ItemList.new()
some_string.set_item_custom_bg_color(0, Color.red) # This will set the background color of the first item of the control to red.
[/gdscript]
[csharp]
var itemList = new ItemList();
itemList.SetItemCustomBgColor(0, Colors.Red); // This will set the background color of the first item of the control to red.
[/csharp]
[/codeblocks]
Sets the foreground color of the item specified by [code]idx[/code] index to the specified [Color].
[codeblocks]
[gdscript]
var item_list = ItemList.new()
item_list.set_item_custom_fg_color(0, Color.red) # This will set the foreground color of the first item of the control to red.
[/gdscript]
[csharp]
var itemList = new ItemList();
itemList.SetItemCustomFgColor(0, Colors.Red); // This will set the foreground color of the first item of the control to red.
[/csharp]
[/codeblocks]
Disables (or enables) the item at the specified index.
Disabled items cannot be selected and do not trigger activation signals (when double-clicking or pressing [kbd]Enter[/kbd]).
Sets (or replaces) the icon's [Texture2D] associated with the specified index.
Sets a modulating [Color] of the item associated with the specified index.
Sets the region of item's icon used. The whole icon will be used if the region has no area.
Sets whether the item icon will be drawn transposed.
Sets language code of item's text used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
Sets a value (of any type) to be stored with the item associated with the specified index.
Sets OpenType feature [code]tag[/code] for the item's text. More info: [url=https://docs.microsoft.com/en-us/typography/opentype/spec/featuretags]OpenType feature tags[/url].
Allows or disallows selection of the item associated with the specified index.
Sets text of the item associated with the specified index.
Sets item's text base writing direction.
Sets the tooltip hint for the item associated with the specified index.
Sets whether the tooltip hint is enabled for specified item index.
Sorts items in the list by their text.
If [code]true[/code], the currently selected item can be selected again.
If [code]true[/code], right mouse button click can select items.
If [code]true[/code], the control will automatically resize the height to fit its content.
The width all columns will be adjusted to.
A value of zero disables the adjustment, each item will have a width equal to the width of its content and the columns will have an uneven width.
The size all icons will be adjusted to.
If either X or Y component is not greater than zero, icon size won't be affected.
The icon position, whether above or to the left of the text. See the [enum IconMode] constants.
The scale of icon applied after [member fixed_icon_size] and transposing takes effect.
Maximum columns the list will have.
If greater than zero, the content will be split among the specified columns.
A value of zero means unlimited columns, i.e. all items will be put in the same row.
Maximum lines of text allowed in each item. Space will be reserved even when there is not enough lines of text to display.
[b]Note:[/b] This property takes effect only when [member icon_mode] is [constant ICON_MODE_TOP]. To make the text wrap, [member fixed_column_width] should be greater than zero.
Whether all columns will have the same width.
If [code]true[/code], the width is equal to the largest column width of all columns.
Allows single or multiple item selection. See the [enum SelectMode] constants.
Triggered when specified list item is activated via double-clicking or by pressing [kbd]Enter[/kbd].
Triggered when specified list item has been selected via right mouse clicking.
The click position is also provided to allow appropriate popup of context menus at the correct location.
[member allow_rmb_select] must be enabled.
Triggered when specified item has been selected.
[member allow_reselect] must be enabled to reselect an item.
Triggered when a multiple selection is altered on a list allowing multiple selection.
Triggered when a left mouse click is issued within the rect of the list but on empty space.
Triggered when a right mouse click is issued within the rect of the list but on empty space.
[member allow_rmb_select] must be enabled.
Icon is drawn above the text.
Icon is drawn to the left of the text.
Only allow selecting a single item.
Allows selecting multiple items by holding [kbd]Ctrl[/kbd] or [kbd]Shift[/kbd].
Default [StyleBox] for the [ItemList], i.e. used when the control is not being focused.
[StyleBox] used when the [ItemList] is being focused.
[StyleBox] used for the cursor, when the [ItemList] is being focused.
[StyleBox] used for the cursor, when the [ItemList] is not being focused.
[Font] of the item's text.
Default text [Color] of the item.
Text [Color] used when the item is selected.
Font size of the item's text.
[Color] of the guideline. The guideline is a line drawn between each row of items.
The horizontal spacing between items.
The spacing between item's icon and text.
The vertical spacing between each line of text.
[StyleBox] for the selected items, used when the [ItemList] is not being focused.
[StyleBox] for the selected items, used when the [ItemList] is being focused.
The vertical spacing between items.