Control that provides a list of selectable items (and/or icons) in a single column, or optionally in multiple columns.
    public class ItemList : Control

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’ with a double click (or Enter key).

Inheritance Chain

Constructors

    public ItemList()

Signals

    "item_activated" (int index)

Fired when specified list item is activated via double click or Enter.

    "item_rmb_selected" (int index, Vector2 at_position)

Fired 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.

    "item_selected" (int index)

Fired when specified item has been selected.

    "multi_selected" (int index, bool selected)

Fired when a multiple selection is altered on a list allowing multiple selection.

    "nothing_selected" ()

    "rmb_clicked" (Vector2 at_position)

Properties

    public bool AllowRmbSelect { get; set; }

    public bool AutoHeight { get; set; }

    public int FixedColumnWidth { get; set; }

    public Vector2 FixedIconSize { get; set; }

    public IconModeEnum IconMode { get; set; }

    public float IconScale { get; set; }

    public object[] Items { get; set; }

    public int MaxColumns { get; set; }

    public int MaxTextLines { get; set; }

    public bool SameColumnWidth { get; set; }

    public SelectModeEnum SelectMode { get; set; }

Methods

    public void AddIconItem(Texture icon, bool selectable = true)

Adds an item to the item list with no text, only an icon.

    public void AddItem(string text, Texture icon = null, bool selectable = true)

Adds an item to the item list with specified text. Specify an icon of null for a list item with no icon.

If selectable is true the list item will be selectable.

    public void Clear()

Remove all items from the list.

    public void EnsureCurrentIsVisible()

Ensure selection is visible, adjusting the scroll position as necessary.

    public bool GetAllowRmbSelect()

Getter for AllowRmbSelect

    public int GetFixedColumnWidth()

Getter for FixedColumnWidth

    public Vector2 GetFixedIconSize()

Getter for FixedIconSize

    public IconModeEnum GetIconMode()

Getter for IconMode

    public float GetIconScale()

Getter for IconScale

    public int GetItemAtPosition(Vector2 position, bool exact = false)

Given a position within the control return the item (if any) at that point.

    public int GetItemCount()

Return count of items currently in the item list.

    public Color GetItemCustomBgColor(int idx)

    public Texture GetItemIcon(int idx)

    public Rect2 GetItemIconRegion(int idx)

    public object GetItemMetadata(int idx)

    public string GetItemText(int idx)

Return the text for specified item index.

    public string GetItemTooltip(int idx)

Return tooltip hint for specified item index.

    public int GetMaxColumns()

Getter for MaxColumns

    public int GetMaxTextLines()

Getter for MaxTextLines

    public int[] GetSelectedItems()

Returns the list of selected indexes.

    public SelectModeEnum GetSelectMode()

Getter for SelectMode

    public VScrollBar GetVScroll()

Returns the current vertical scroll bar for the List.

    public bool HasAutoHeight()

Getter for AutoHeight

    public bool IsItemDisabled(int idx)

Returns whether or not the item at the specified index is disabled

    public bool IsItemSelectable(int idx)

Returns whether or not the item at the specified index is selectable.

    public bool IsItemTooltipEnabled(int idx)

Returns whether the tooltip is enabled for specified item index.

    public bool IsSameColumnWidth()

Getter for SameColumnWidth

    public bool IsSelected(int idx)

Returns whether or not item at the specified index is currently selected.

    public void RemoveItem(int idx)

Remove item at specified index from the list.

    public void Select(int idx, bool single = true)

Select the item at the specified index.

Note: This method does not trigger the item selection signal.

    public void SetAllowRmbSelect(bool allow)

Setter for AllowRmbSelect

    public void SetAutoHeight(bool enable)

Setter for AutoHeight

    public void SetFixedColumnWidth(int width)

Setter for FixedColumnWidth

    public void SetFixedIconSize(Vector2 size)

Setter for FixedIconSize

    public void SetIconMode(IconModeEnum mode)

Setter for IconMode

    public void SetIconScale(float scale)

Setter for IconScale

    public void SetItemCustomBgColor(int idx, Color customBgColor)

    public void SetItemDisabled(int idx, bool disabled)

Disable (or enable) item at specified index.

Disabled items are not be selectable and do not fire activation (Enter or double-click) signals.

    public void SetItemIcon(int idx, Texture icon)

Set (or replace) icon of the item at the specified index.

    public void SetItemIconRegion(int idx, Rect2 rect)

    public void SetItemMetadata(int idx, object metadata)

Sets a value (of any type) to be stored with the item at the specified index.

    public void SetItemSelectable(int idx, bool selectable)

Allow or disallow selection of the item at the specified index.

    public void SetItemText(int idx, string text)

Sets text of item at specified index.

    public void SetItemTooltip(int idx, string tooltip)

Sets tooltip hint for item at specified index.

    public void SetItemTooltipEnabled(int idx, bool enable)

Sets whether the tooltip is enabled for specified item index.

    public void SetMaxColumns(int amount)

Setter for MaxColumns

    public void SetMaxTextLines(int lines)

Setter for MaxTextLines

    public void SetSameColumnWidth(bool enable)

Setter for SameColumnWidth

    public void SetSelectMode(SelectModeEnum mode)

Setter for SelectMode

    public void SortItemsByText()

Sorts items in the list by their text.

    public void Unselect(int idx)

Ensure item at specified index is not selected.

Inner Types

IconModeEnum

Name Value Description
Top 0  
Left 1  

SelectModeEnum

Name Value Description
Single 0  
Multi 1  
Tags: