123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387 |
- .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
- .. DO NOT EDIT THIS FILE, but the ItemList.xml source instead.
- .. The source is found in doc/classes or modules/<name>/doc_classes.
- .. _class_ItemList:
- ItemList
- ========
- **Inherits:** :ref:`Control<class_control>` **<** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
- **Category:** Core
- Brief Description
- -----------------
- Control that provides a list of selectable items (and/or icons) in a single column, or optionally in multiple columns.
- Member Functions
- ----------------
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`add_icon_item<class_ItemList_add_icon_item>` **(** :ref:`Texture<class_texture>` icon, :ref:`bool<class_bool>` selectable=true **)** |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`add_item<class_ItemList_add_item>` **(** :ref:`String<class_string>` text, :ref:`Texture<class_texture>` icon=null, :ref:`bool<class_bool>` selectable=true **)** |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`clear<class_ItemList_clear>` **(** **)** |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`ensure_current_is_visible<class_ItemList_ensure_current_is_visible>` **(** **)** |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_item_at_position<class_ItemList_get_item_at_position>` **(** :ref:`Vector2<class_vector2>` position, :ref:`bool<class_bool>` exact=false **)** const |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`int<class_int>` | :ref:`get_item_count<class_ItemList_get_item_count>` **(** **)** const |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Color<class_color>` | :ref:`get_item_custom_bg_color<class_ItemList_get_item_custom_bg_color>` **(** :ref:`int<class_int>` idx **)** const |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Texture<class_texture>` | :ref:`get_item_icon<class_ItemList_get_item_icon>` **(** :ref:`int<class_int>` idx **)** const |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Rect2<class_rect2>` | :ref:`get_item_icon_region<class_ItemList_get_item_icon_region>` **(** :ref:`int<class_int>` idx **)** const |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`Variant<class_variant>` | :ref:`get_item_metadata<class_ItemList_get_item_metadata>` **(** :ref:`int<class_int>` idx **)** const |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`get_item_text<class_ItemList_get_item_text>` **(** :ref:`int<class_int>` idx **)** const |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`String<class_string>` | :ref:`get_item_tooltip<class_ItemList_get_item_tooltip>` **(** :ref:`int<class_int>` idx **)** const |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`PoolIntArray<class_poolintarray>` | :ref:`get_selected_items<class_ItemList_get_selected_items>` **(** **)** |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`VScrollBar<class_vscrollbar>` | :ref:`get_v_scroll<class_ItemList_get_v_scroll>` **(** **)** |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_item_disabled<class_ItemList_is_item_disabled>` **(** :ref:`int<class_int>` idx **)** const |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_item_selectable<class_ItemList_is_item_selectable>` **(** :ref:`int<class_int>` idx **)** const |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_item_tooltip_enabled<class_ItemList_is_item_tooltip_enabled>` **(** :ref:`int<class_int>` idx **)** const |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_selected<class_ItemList_is_selected>` **(** :ref:`int<class_int>` idx **)** const |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`remove_item<class_ItemList_remove_item>` **(** :ref:`int<class_int>` idx **)** |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`select<class_ItemList_select>` **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` single=true **)** |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_item_custom_bg_color<class_ItemList_set_item_custom_bg_color>` **(** :ref:`int<class_int>` idx, :ref:`Color<class_color>` custom_bg_color **)** |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_item_disabled<class_ItemList_set_item_disabled>` **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` disabled **)** |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_item_icon<class_ItemList_set_item_icon>` **(** :ref:`int<class_int>` idx, :ref:`Texture<class_texture>` icon **)** |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_item_icon_region<class_ItemList_set_item_icon_region>` **(** :ref:`int<class_int>` idx, :ref:`Rect2<class_rect2>` rect **)** |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_item_metadata<class_ItemList_set_item_metadata>` **(** :ref:`int<class_int>` idx, :ref:`Variant<class_variant>` metadata **)** |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_item_selectable<class_ItemList_set_item_selectable>` **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` selectable **)** |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_item_text<class_ItemList_set_item_text>` **(** :ref:`int<class_int>` idx, :ref:`String<class_string>` text **)** |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_item_tooltip<class_ItemList_set_item_tooltip>` **(** :ref:`int<class_int>` idx, :ref:`String<class_string>` tooltip **)** |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`set_item_tooltip_enabled<class_ItemList_set_item_tooltip_enabled>` **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` enable **)** |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`sort_items_by_text<class_ItemList_sort_items_by_text>` **(** **)** |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`unselect<class_ItemList_unselect>` **(** :ref:`int<class_int>` idx **)** |
- +------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- Signals
- -------
- .. _class_ItemList_item_activated:
- - **item_activated** **(** :ref:`int<class_int>` index **)**
- Fired when specified list item is activated via double click or Enter.
- .. _class_ItemList_item_rmb_selected:
- - **item_rmb_selected** **(** :ref:`int<class_int>` index, :ref:`Vector2<class_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.
- .. _class_ItemList_item_selected:
- - **item_selected** **(** :ref:`int<class_int>` index **)**
- Fired when specified item has been selected.
- .. _class_ItemList_multi_selected:
- - **multi_selected** **(** :ref:`int<class_int>` index, :ref:`bool<class_bool>` selected **)**
- Fired when a multiple selection is altered on a list allowing multiple selection.
- .. _class_ItemList_nothing_selected:
- - **nothing_selected** **(** **)**
- .. _class_ItemList_rmb_clicked:
- - **rmb_clicked** **(** :ref:`Vector2<class_vector2>` at_position **)**
- Member Variables
- ----------------
- .. _class_ItemList_allow_reselect:
- - :ref:`bool<class_bool>` **allow_reselect** - If ``true`` the currently selected item may be selected again.
- .. _class_ItemList_allow_rmb_select:
- - :ref:`bool<class_bool>` **allow_rmb_select** - If ``true`` a right mouse button click can select items.
- .. _class_ItemList_auto_height:
- - :ref:`bool<class_bool>` **auto_height**
- .. _class_ItemList_fixed_column_width:
- - :ref:`int<class_int>` **fixed_column_width**
- .. _class_ItemList_fixed_icon_size:
- - :ref:`Vector2<class_vector2>` **fixed_icon_size**
- .. _class_ItemList_icon_mode:
- - :ref:`IconMode<enum_itemlist_iconmode>` **icon_mode**
- .. _class_ItemList_icon_scale:
- - :ref:`float<class_float>` **icon_scale**
- .. _class_ItemList_max_columns:
- - :ref:`int<class_int>` **max_columns**
- .. _class_ItemList_max_text_lines:
- - :ref:`int<class_int>` **max_text_lines**
- .. _class_ItemList_same_column_width:
- - :ref:`bool<class_bool>` **same_column_width**
- .. _class_ItemList_select_mode:
- - :ref:`SelectMode<enum_itemlist_selectmode>` **select_mode** - Allow single or multiple selection. See the ``SELECT_*`` constants.
- Enums
- -----
- .. _enum_ItemList_IconMode:
- enum **IconMode**
- - **ICON_MODE_TOP** = **0**
- - **ICON_MODE_LEFT** = **1**
- .. _enum_ItemList_SelectMode:
- enum **SelectMode**
- - **SELECT_SINGLE** = **0**
- - **SELECT_MULTI** = **1**
- Description
- -----------
- 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).
- Member Function Description
- ---------------------------
- .. _class_ItemList_add_icon_item:
- - void **add_icon_item** **(** :ref:`Texture<class_texture>` icon, :ref:`bool<class_bool>` selectable=true **)**
- Adds an item to the item list with no text, only an icon.
- .. _class_ItemList_add_item:
- - void **add_item** **(** :ref:`String<class_string>` text, :ref:`Texture<class_texture>` icon=null, :ref:`bool<class_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.
- .. _class_ItemList_clear:
- - void **clear** **(** **)**
- Remove all items from the list.
- .. _class_ItemList_ensure_current_is_visible:
- - void **ensure_current_is_visible** **(** **)**
- Ensure selection is visible, adjusting the scroll position as necessary.
- .. _class_ItemList_get_item_at_position:
- - :ref:`int<class_int>` **get_item_at_position** **(** :ref:`Vector2<class_vector2>` position, :ref:`bool<class_bool>` exact=false **)** const
- Given a position within the control return the item (if any) at that point.
- .. _class_ItemList_get_item_count:
- - :ref:`int<class_int>` **get_item_count** **(** **)** const
- Return count of items currently in the item list.
- .. _class_ItemList_get_item_custom_bg_color:
- - :ref:`Color<class_color>` **get_item_custom_bg_color** **(** :ref:`int<class_int>` idx **)** const
- .. _class_ItemList_get_item_icon:
- - :ref:`Texture<class_texture>` **get_item_icon** **(** :ref:`int<class_int>` idx **)** const
- .. _class_ItemList_get_item_icon_region:
- - :ref:`Rect2<class_rect2>` **get_item_icon_region** **(** :ref:`int<class_int>` idx **)** const
- .. _class_ItemList_get_item_metadata:
- - :ref:`Variant<class_variant>` **get_item_metadata** **(** :ref:`int<class_int>` idx **)** const
- .. _class_ItemList_get_item_text:
- - :ref:`String<class_string>` **get_item_text** **(** :ref:`int<class_int>` idx **)** const
- Return the text for specified item index.
- .. _class_ItemList_get_item_tooltip:
- - :ref:`String<class_string>` **get_item_tooltip** **(** :ref:`int<class_int>` idx **)** const
- Return tooltip hint for specified item index.
- .. _class_ItemList_get_selected_items:
- - :ref:`PoolIntArray<class_poolintarray>` **get_selected_items** **(** **)**
- Returns the list of selected indexes.
- .. _class_ItemList_get_v_scroll:
- - :ref:`VScrollBar<class_vscrollbar>` **get_v_scroll** **(** **)**
- Returns the current vertical scroll bar for the List.
- .. _class_ItemList_is_item_disabled:
- - :ref:`bool<class_bool>` **is_item_disabled** **(** :ref:`int<class_int>` idx **)** const
- Returns whether or not the item at the specified index is disabled
- .. _class_ItemList_is_item_selectable:
- - :ref:`bool<class_bool>` **is_item_selectable** **(** :ref:`int<class_int>` idx **)** const
- Returns whether or not the item at the specified index is selectable.
- .. _class_ItemList_is_item_tooltip_enabled:
- - :ref:`bool<class_bool>` **is_item_tooltip_enabled** **(** :ref:`int<class_int>` idx **)** const
- Returns whether the tooltip is enabled for specified item index.
- .. _class_ItemList_is_selected:
- - :ref:`bool<class_bool>` **is_selected** **(** :ref:`int<class_int>` idx **)** const
- Returns whether or not item at the specified index is currently selected.
- .. _class_ItemList_remove_item:
- - void **remove_item** **(** :ref:`int<class_int>` idx **)**
- Remove item at specified index from the list.
- .. _class_ItemList_select:
- - void **select** **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` single=true **)**
- Select the item at the specified index.
- Note: This method does not trigger the item selection signal.
- .. _class_ItemList_set_item_custom_bg_color:
- - void **set_item_custom_bg_color** **(** :ref:`int<class_int>` idx, :ref:`Color<class_color>` custom_bg_color **)**
- .. _class_ItemList_set_item_disabled:
- - void **set_item_disabled** **(** :ref:`int<class_int>` idx, :ref:`bool<class_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.
- .. _class_ItemList_set_item_icon:
- - void **set_item_icon** **(** :ref:`int<class_int>` idx, :ref:`Texture<class_texture>` icon **)**
- Set (or replace) icon of the item at the specified index.
- .. _class_ItemList_set_item_icon_region:
- - void **set_item_icon_region** **(** :ref:`int<class_int>` idx, :ref:`Rect2<class_rect2>` rect **)**
- .. _class_ItemList_set_item_metadata:
- - void **set_item_metadata** **(** :ref:`int<class_int>` idx, :ref:`Variant<class_variant>` metadata **)**
- Sets a value (of any type) to be stored with the item at the specified index.
- .. _class_ItemList_set_item_selectable:
- - void **set_item_selectable** **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` selectable **)**
- Allow or disallow selection of the item at the specified index.
- .. _class_ItemList_set_item_text:
- - void **set_item_text** **(** :ref:`int<class_int>` idx, :ref:`String<class_string>` text **)**
- Sets text of item at specified index.
- .. _class_ItemList_set_item_tooltip:
- - void **set_item_tooltip** **(** :ref:`int<class_int>` idx, :ref:`String<class_string>` tooltip **)**
- Sets tooltip hint for item at specified index.
- .. _class_ItemList_set_item_tooltip_enabled:
- - void **set_item_tooltip_enabled** **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` enable **)**
- Sets whether the tooltip is enabled for specified item index.
- .. _class_ItemList_sort_items_by_text:
- - void **sort_items_by_text** **(** **)**
- Sorts items in the list by their text.
- .. _class_ItemList_unselect:
- - void **unselect** **(** :ref:`int<class_int>` idx **)**
- Ensure item at specified index is not selected.
|