class_itemlist.rst 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/ItemList.xml.
  6. .. _class_ItemList:
  7. ItemList
  8. ========
  9. **Inherits:** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. A vertical list of selectable items with one or multiple columns.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. This control provides a vertical list of selectable items that may be in a single or in multiple columns, with each item having options for text and an icon. Tooltips are supported and may be different for every item in the list.
  15. 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`.
  16. Item text only supports single-line strings. Newline characters (e.g. ``\n``) in the string won't produce a newline. Text wrapping is enabled in :ref:`ICON_MODE_TOP<class_ItemList_constant_ICON_MODE_TOP>` mode, but the column's width is adjusted to fully fit its content by default. You need to set :ref:`fixed_column_width<class_ItemList_property_fixed_column_width>` greater than zero to wrap the text.
  17. All ``set_*`` methods allow negative item indices, i.e. ``-1`` to access the last item, ``-2`` to select the second-to-last item, and so on.
  18. \ **Incremental search:** Like :ref:`PopupMenu<class_PopupMenu>` and :ref:`Tree<class_Tree>`, **ItemList** supports searching within the list while the control is focused. Press a key that matches the first letter of an item's name to select the first item starting with the given letter. After that point, there are two ways to perform incremental search: 1) Press the same key again before the timeout duration to select the next item starting with the same letter. 2) Press letter keys that match the rest of the word before the timeout duration to match to select the item in question directly. Both of these actions will be reset to the beginning of the list if the timeout duration has passed since the last keystroke was registered. You can adjust the timeout duration by changing :ref:`ProjectSettings.gui/timers/incremental_search_max_interval_msec<class_ProjectSettings_property_gui/timers/incremental_search_max_interval_msec>`.
  19. .. rst-class:: classref-reftable-group
  20. Properties
  21. ----------
  22. .. table::
  23. :widths: auto
  24. +---------------------------------------------------------+-----------------------------------------------------------------------------+---------------------------------------------------------------------------+
  25. | :ref:`bool<class_bool>` | :ref:`allow_reselect<class_ItemList_property_allow_reselect>` | ``false`` |
  26. +---------------------------------------------------------+-----------------------------------------------------------------------------+---------------------------------------------------------------------------+
  27. | :ref:`bool<class_bool>` | :ref:`allow_rmb_select<class_ItemList_property_allow_rmb_select>` | ``false`` |
  28. +---------------------------------------------------------+-----------------------------------------------------------------------------+---------------------------------------------------------------------------+
  29. | :ref:`bool<class_bool>` | :ref:`allow_search<class_ItemList_property_allow_search>` | ``true`` |
  30. +---------------------------------------------------------+-----------------------------------------------------------------------------+---------------------------------------------------------------------------+
  31. | :ref:`bool<class_bool>` | :ref:`auto_height<class_ItemList_property_auto_height>` | ``false`` |
  32. +---------------------------------------------------------+-----------------------------------------------------------------------------+---------------------------------------------------------------------------+
  33. | :ref:`bool<class_bool>` | clip_contents | ``true`` (overrides :ref:`Control<class_Control_property_clip_contents>`) |
  34. +---------------------------------------------------------+-----------------------------------------------------------------------------+---------------------------------------------------------------------------+
  35. | :ref:`int<class_int>` | :ref:`fixed_column_width<class_ItemList_property_fixed_column_width>` | ``0`` |
  36. +---------------------------------------------------------+-----------------------------------------------------------------------------+---------------------------------------------------------------------------+
  37. | :ref:`Vector2i<class_Vector2i>` | :ref:`fixed_icon_size<class_ItemList_property_fixed_icon_size>` | ``Vector2i(0, 0)`` |
  38. +---------------------------------------------------------+-----------------------------------------------------------------------------+---------------------------------------------------------------------------+
  39. | :ref:`FocusMode<enum_Control_FocusMode>` | focus_mode | ``2`` (overrides :ref:`Control<class_Control_property_focus_mode>`) |
  40. +---------------------------------------------------------+-----------------------------------------------------------------------------+---------------------------------------------------------------------------+
  41. | :ref:`IconMode<enum_ItemList_IconMode>` | :ref:`icon_mode<class_ItemList_property_icon_mode>` | ``1`` |
  42. +---------------------------------------------------------+-----------------------------------------------------------------------------+---------------------------------------------------------------------------+
  43. | :ref:`float<class_float>` | :ref:`icon_scale<class_ItemList_property_icon_scale>` | ``1.0`` |
  44. +---------------------------------------------------------+-----------------------------------------------------------------------------+---------------------------------------------------------------------------+
  45. | :ref:`int<class_int>` | :ref:`item_count<class_ItemList_property_item_count>` | ``0`` |
  46. +---------------------------------------------------------+-----------------------------------------------------------------------------+---------------------------------------------------------------------------+
  47. | :ref:`int<class_int>` | :ref:`max_columns<class_ItemList_property_max_columns>` | ``1`` |
  48. +---------------------------------------------------------+-----------------------------------------------------------------------------+---------------------------------------------------------------------------+
  49. | :ref:`int<class_int>` | :ref:`max_text_lines<class_ItemList_property_max_text_lines>` | ``1`` |
  50. +---------------------------------------------------------+-----------------------------------------------------------------------------+---------------------------------------------------------------------------+
  51. | :ref:`bool<class_bool>` | :ref:`same_column_width<class_ItemList_property_same_column_width>` | ``false`` |
  52. +---------------------------------------------------------+-----------------------------------------------------------------------------+---------------------------------------------------------------------------+
  53. | :ref:`SelectMode<enum_ItemList_SelectMode>` | :ref:`select_mode<class_ItemList_property_select_mode>` | ``0`` |
  54. +---------------------------------------------------------+-----------------------------------------------------------------------------+---------------------------------------------------------------------------+
  55. | :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` | :ref:`text_overrun_behavior<class_ItemList_property_text_overrun_behavior>` | ``3`` |
  56. +---------------------------------------------------------+-----------------------------------------------------------------------------+---------------------------------------------------------------------------+
  57. .. rst-class:: classref-reftable-group
  58. Methods
  59. -------
  60. .. table::
  61. :widths: auto
  62. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`int<class_int>` | :ref:`add_icon_item<class_ItemList_method_add_icon_item>`\ (\ icon\: :ref:`Texture2D<class_Texture2D>`, selectable\: :ref:`bool<class_bool>` = true\ ) |
  64. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | :ref:`int<class_int>` | :ref:`add_item<class_ItemList_method_add_item>`\ (\ text\: :ref:`String<class_String>`, icon\: :ref:`Texture2D<class_Texture2D>` = null, selectable\: :ref:`bool<class_bool>` = true\ ) |
  66. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | |void| | :ref:`clear<class_ItemList_method_clear>`\ (\ ) |
  68. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | |void| | :ref:`deselect<class_ItemList_method_deselect>`\ (\ idx\: :ref:`int<class_int>`\ ) |
  70. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | |void| | :ref:`deselect_all<class_ItemList_method_deselect_all>`\ (\ ) |
  72. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | |void| | :ref:`ensure_current_is_visible<class_ItemList_method_ensure_current_is_visible>`\ (\ ) |
  74. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | |void| | :ref:`force_update_list_size<class_ItemList_method_force_update_list_size>`\ (\ ) |
  76. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | :ref:`int<class_int>` | :ref:`get_item_at_position<class_ItemList_method_get_item_at_position>`\ (\ position\: :ref:`Vector2<class_Vector2>`, exact\: :ref:`bool<class_bool>` = false\ ) |const| |
  78. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | :ref:`Color<class_Color>` | :ref:`get_item_custom_bg_color<class_ItemList_method_get_item_custom_bg_color>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  80. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | :ref:`Color<class_Color>` | :ref:`get_item_custom_fg_color<class_ItemList_method_get_item_custom_fg_color>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  82. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | :ref:`Texture2D<class_Texture2D>` | :ref:`get_item_icon<class_ItemList_method_get_item_icon>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  84. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | :ref:`Color<class_Color>` | :ref:`get_item_icon_modulate<class_ItemList_method_get_item_icon_modulate>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  86. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | :ref:`Rect2<class_Rect2>` | :ref:`get_item_icon_region<class_ItemList_method_get_item_icon_region>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  88. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | :ref:`String<class_String>` | :ref:`get_item_language<class_ItemList_method_get_item_language>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  90. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | :ref:`Variant<class_Variant>` | :ref:`get_item_metadata<class_ItemList_method_get_item_metadata>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  92. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | :ref:`Rect2<class_Rect2>` | :ref:`get_item_rect<class_ItemList_method_get_item_rect>`\ (\ idx\: :ref:`int<class_int>`, expand\: :ref:`bool<class_bool>` = true\ ) |const| |
  94. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | :ref:`String<class_String>` | :ref:`get_item_text<class_ItemList_method_get_item_text>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  96. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | :ref:`TextDirection<enum_Control_TextDirection>` | :ref:`get_item_text_direction<class_ItemList_method_get_item_text_direction>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  98. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | :ref:`String<class_String>` | :ref:`get_item_tooltip<class_ItemList_method_get_item_tooltip>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  100. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`get_selected_items<class_ItemList_method_get_selected_items>`\ (\ ) |
  102. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | :ref:`VScrollBar<class_VScrollBar>` | :ref:`get_v_scroll_bar<class_ItemList_method_get_v_scroll_bar>`\ (\ ) |
  104. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | :ref:`bool<class_bool>` | :ref:`is_anything_selected<class_ItemList_method_is_anything_selected>`\ (\ ) |
  106. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. | :ref:`bool<class_bool>` | :ref:`is_item_disabled<class_ItemList_method_is_item_disabled>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  108. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  109. | :ref:`bool<class_bool>` | :ref:`is_item_icon_transposed<class_ItemList_method_is_item_icon_transposed>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  110. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  111. | :ref:`bool<class_bool>` | :ref:`is_item_selectable<class_ItemList_method_is_item_selectable>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  112. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  113. | :ref:`bool<class_bool>` | :ref:`is_item_tooltip_enabled<class_ItemList_method_is_item_tooltip_enabled>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  114. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  115. | :ref:`bool<class_bool>` | :ref:`is_selected<class_ItemList_method_is_selected>`\ (\ idx\: :ref:`int<class_int>`\ ) |const| |
  116. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  117. | |void| | :ref:`move_item<class_ItemList_method_move_item>`\ (\ from_idx\: :ref:`int<class_int>`, to_idx\: :ref:`int<class_int>`\ ) |
  118. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  119. | |void| | :ref:`remove_item<class_ItemList_method_remove_item>`\ (\ idx\: :ref:`int<class_int>`\ ) |
  120. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  121. | |void| | :ref:`select<class_ItemList_method_select>`\ (\ idx\: :ref:`int<class_int>`, single\: :ref:`bool<class_bool>` = true\ ) |
  122. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  123. | |void| | :ref:`set_item_custom_bg_color<class_ItemList_method_set_item_custom_bg_color>`\ (\ idx\: :ref:`int<class_int>`, custom_bg_color\: :ref:`Color<class_Color>`\ ) |
  124. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  125. | |void| | :ref:`set_item_custom_fg_color<class_ItemList_method_set_item_custom_fg_color>`\ (\ idx\: :ref:`int<class_int>`, custom_fg_color\: :ref:`Color<class_Color>`\ ) |
  126. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  127. | |void| | :ref:`set_item_disabled<class_ItemList_method_set_item_disabled>`\ (\ idx\: :ref:`int<class_int>`, disabled\: :ref:`bool<class_bool>`\ ) |
  128. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  129. | |void| | :ref:`set_item_icon<class_ItemList_method_set_item_icon>`\ (\ idx\: :ref:`int<class_int>`, icon\: :ref:`Texture2D<class_Texture2D>`\ ) |
  130. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  131. | |void| | :ref:`set_item_icon_modulate<class_ItemList_method_set_item_icon_modulate>`\ (\ idx\: :ref:`int<class_int>`, modulate\: :ref:`Color<class_Color>`\ ) |
  132. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  133. | |void| | :ref:`set_item_icon_region<class_ItemList_method_set_item_icon_region>`\ (\ idx\: :ref:`int<class_int>`, rect\: :ref:`Rect2<class_Rect2>`\ ) |
  134. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  135. | |void| | :ref:`set_item_icon_transposed<class_ItemList_method_set_item_icon_transposed>`\ (\ idx\: :ref:`int<class_int>`, transposed\: :ref:`bool<class_bool>`\ ) |
  136. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  137. | |void| | :ref:`set_item_language<class_ItemList_method_set_item_language>`\ (\ idx\: :ref:`int<class_int>`, language\: :ref:`String<class_String>`\ ) |
  138. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  139. | |void| | :ref:`set_item_metadata<class_ItemList_method_set_item_metadata>`\ (\ idx\: :ref:`int<class_int>`, metadata\: :ref:`Variant<class_Variant>`\ ) |
  140. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  141. | |void| | :ref:`set_item_selectable<class_ItemList_method_set_item_selectable>`\ (\ idx\: :ref:`int<class_int>`, selectable\: :ref:`bool<class_bool>`\ ) |
  142. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  143. | |void| | :ref:`set_item_text<class_ItemList_method_set_item_text>`\ (\ idx\: :ref:`int<class_int>`, text\: :ref:`String<class_String>`\ ) |
  144. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  145. | |void| | :ref:`set_item_text_direction<class_ItemList_method_set_item_text_direction>`\ (\ idx\: :ref:`int<class_int>`, direction\: :ref:`TextDirection<enum_Control_TextDirection>`\ ) |
  146. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  147. | |void| | :ref:`set_item_tooltip<class_ItemList_method_set_item_tooltip>`\ (\ idx\: :ref:`int<class_int>`, tooltip\: :ref:`String<class_String>`\ ) |
  148. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  149. | |void| | :ref:`set_item_tooltip_enabled<class_ItemList_method_set_item_tooltip_enabled>`\ (\ idx\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) |
  150. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  151. | |void| | :ref:`sort_items_by_text<class_ItemList_method_sort_items_by_text>`\ (\ ) |
  152. +--------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  153. .. rst-class:: classref-reftable-group
  154. Theme Properties
  155. ----------------
  156. .. table::
  157. :widths: auto
  158. +---------------------------------+----------------------------------------------------------------------------+--------------------------------+
  159. | :ref:`Color<class_Color>` | :ref:`font_color<class_ItemList_theme_color_font_color>` | ``Color(0.65, 0.65, 0.65, 1)`` |
  160. +---------------------------------+----------------------------------------------------------------------------+--------------------------------+
  161. | :ref:`Color<class_Color>` | :ref:`font_hovered_color<class_ItemList_theme_color_font_hovered_color>` | ``Color(0.95, 0.95, 0.95, 1)`` |
  162. +---------------------------------+----------------------------------------------------------------------------+--------------------------------+
  163. | :ref:`Color<class_Color>` | :ref:`font_outline_color<class_ItemList_theme_color_font_outline_color>` | ``Color(0, 0, 0, 1)`` |
  164. +---------------------------------+----------------------------------------------------------------------------+--------------------------------+
  165. | :ref:`Color<class_Color>` | :ref:`font_selected_color<class_ItemList_theme_color_font_selected_color>` | ``Color(1, 1, 1, 1)`` |
  166. +---------------------------------+----------------------------------------------------------------------------+--------------------------------+
  167. | :ref:`Color<class_Color>` | :ref:`guide_color<class_ItemList_theme_color_guide_color>` | ``Color(0.7, 0.7, 0.7, 0.25)`` |
  168. +---------------------------------+----------------------------------------------------------------------------+--------------------------------+
  169. | :ref:`int<class_int>` | :ref:`h_separation<class_ItemList_theme_constant_h_separation>` | ``4`` |
  170. +---------------------------------+----------------------------------------------------------------------------+--------------------------------+
  171. | :ref:`int<class_int>` | :ref:`icon_margin<class_ItemList_theme_constant_icon_margin>` | ``4`` |
  172. +---------------------------------+----------------------------------------------------------------------------+--------------------------------+
  173. | :ref:`int<class_int>` | :ref:`line_separation<class_ItemList_theme_constant_line_separation>` | ``2`` |
  174. +---------------------------------+----------------------------------------------------------------------------+--------------------------------+
  175. | :ref:`int<class_int>` | :ref:`outline_size<class_ItemList_theme_constant_outline_size>` | ``0`` |
  176. +---------------------------------+----------------------------------------------------------------------------+--------------------------------+
  177. | :ref:`int<class_int>` | :ref:`v_separation<class_ItemList_theme_constant_v_separation>` | ``4`` |
  178. +---------------------------------+----------------------------------------------------------------------------+--------------------------------+
  179. | :ref:`Font<class_Font>` | :ref:`font<class_ItemList_theme_font_font>` | |
  180. +---------------------------------+----------------------------------------------------------------------------+--------------------------------+
  181. | :ref:`int<class_int>` | :ref:`font_size<class_ItemList_theme_font_size_font_size>` | |
  182. +---------------------------------+----------------------------------------------------------------------------+--------------------------------+
  183. | :ref:`StyleBox<class_StyleBox>` | :ref:`cursor<class_ItemList_theme_style_cursor>` | |
  184. +---------------------------------+----------------------------------------------------------------------------+--------------------------------+
  185. | :ref:`StyleBox<class_StyleBox>` | :ref:`cursor_unfocused<class_ItemList_theme_style_cursor_unfocused>` | |
  186. +---------------------------------+----------------------------------------------------------------------------+--------------------------------+
  187. | :ref:`StyleBox<class_StyleBox>` | :ref:`focus<class_ItemList_theme_style_focus>` | |
  188. +---------------------------------+----------------------------------------------------------------------------+--------------------------------+
  189. | :ref:`StyleBox<class_StyleBox>` | :ref:`hovered<class_ItemList_theme_style_hovered>` | |
  190. +---------------------------------+----------------------------------------------------------------------------+--------------------------------+
  191. | :ref:`StyleBox<class_StyleBox>` | :ref:`panel<class_ItemList_theme_style_panel>` | |
  192. +---------------------------------+----------------------------------------------------------------------------+--------------------------------+
  193. | :ref:`StyleBox<class_StyleBox>` | :ref:`selected<class_ItemList_theme_style_selected>` | |
  194. +---------------------------------+----------------------------------------------------------------------------+--------------------------------+
  195. | :ref:`StyleBox<class_StyleBox>` | :ref:`selected_focus<class_ItemList_theme_style_selected_focus>` | |
  196. +---------------------------------+----------------------------------------------------------------------------+--------------------------------+
  197. .. rst-class:: classref-section-separator
  198. ----
  199. .. rst-class:: classref-descriptions-group
  200. Signals
  201. -------
  202. .. _class_ItemList_signal_empty_clicked:
  203. .. rst-class:: classref-signal
  204. **empty_clicked**\ (\ at_position\: :ref:`Vector2<class_Vector2>`, mouse_button_index\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_ItemList_signal_empty_clicked>`
  205. Triggered when any mouse click is issued within the rect of the list but on empty space.
  206. .. rst-class:: classref-item-separator
  207. ----
  208. .. _class_ItemList_signal_item_activated:
  209. .. rst-class:: classref-signal
  210. **item_activated**\ (\ index\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_ItemList_signal_item_activated>`
  211. Triggered when specified list item is activated via double-clicking or by pressing :kbd:`Enter`.
  212. .. rst-class:: classref-item-separator
  213. ----
  214. .. _class_ItemList_signal_item_clicked:
  215. .. rst-class:: classref-signal
  216. **item_clicked**\ (\ index\: :ref:`int<class_int>`, at_position\: :ref:`Vector2<class_Vector2>`, mouse_button_index\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_ItemList_signal_item_clicked>`
  217. Triggered when specified list item has been clicked with any mouse button.
  218. The click position is also provided to allow appropriate popup of context menus at the correct location.
  219. .. rst-class:: classref-item-separator
  220. ----
  221. .. _class_ItemList_signal_item_selected:
  222. .. rst-class:: classref-signal
  223. **item_selected**\ (\ index\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_ItemList_signal_item_selected>`
  224. Triggered when specified item has been selected.
  225. \ :ref:`allow_reselect<class_ItemList_property_allow_reselect>` must be enabled to reselect an item.
  226. .. rst-class:: classref-item-separator
  227. ----
  228. .. _class_ItemList_signal_multi_selected:
  229. .. rst-class:: classref-signal
  230. **multi_selected**\ (\ index\: :ref:`int<class_int>`, selected\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_ItemList_signal_multi_selected>`
  231. Triggered when a multiple selection is altered on a list allowing multiple selection.
  232. .. rst-class:: classref-section-separator
  233. ----
  234. .. rst-class:: classref-descriptions-group
  235. Enumerations
  236. ------------
  237. .. _enum_ItemList_IconMode:
  238. .. rst-class:: classref-enumeration
  239. enum **IconMode**: :ref:`๐Ÿ”—<enum_ItemList_IconMode>`
  240. .. _class_ItemList_constant_ICON_MODE_TOP:
  241. .. rst-class:: classref-enumeration-constant
  242. :ref:`IconMode<enum_ItemList_IconMode>` **ICON_MODE_TOP** = ``0``
  243. Icon is drawn above the text.
  244. .. _class_ItemList_constant_ICON_MODE_LEFT:
  245. .. rst-class:: classref-enumeration-constant
  246. :ref:`IconMode<enum_ItemList_IconMode>` **ICON_MODE_LEFT** = ``1``
  247. Icon is drawn to the left of the text.
  248. .. rst-class:: classref-item-separator
  249. ----
  250. .. _enum_ItemList_SelectMode:
  251. .. rst-class:: classref-enumeration
  252. enum **SelectMode**: :ref:`๐Ÿ”—<enum_ItemList_SelectMode>`
  253. .. _class_ItemList_constant_SELECT_SINGLE:
  254. .. rst-class:: classref-enumeration-constant
  255. :ref:`SelectMode<enum_ItemList_SelectMode>` **SELECT_SINGLE** = ``0``
  256. Only allow selecting a single item.
  257. .. _class_ItemList_constant_SELECT_MULTI:
  258. .. rst-class:: classref-enumeration-constant
  259. :ref:`SelectMode<enum_ItemList_SelectMode>` **SELECT_MULTI** = ``1``
  260. Allows selecting multiple items by holding :kbd:`Ctrl` or :kbd:`Shift`.
  261. .. rst-class:: classref-section-separator
  262. ----
  263. .. rst-class:: classref-descriptions-group
  264. Property Descriptions
  265. ---------------------
  266. .. _class_ItemList_property_allow_reselect:
  267. .. rst-class:: classref-property
  268. :ref:`bool<class_bool>` **allow_reselect** = ``false`` :ref:`๐Ÿ”—<class_ItemList_property_allow_reselect>`
  269. .. rst-class:: classref-property-setget
  270. - |void| **set_allow_reselect**\ (\ value\: :ref:`bool<class_bool>`\ )
  271. - :ref:`bool<class_bool>` **get_allow_reselect**\ (\ )
  272. If ``true``, the currently selected item can be selected again.
  273. .. rst-class:: classref-item-separator
  274. ----
  275. .. _class_ItemList_property_allow_rmb_select:
  276. .. rst-class:: classref-property
  277. :ref:`bool<class_bool>` **allow_rmb_select** = ``false`` :ref:`๐Ÿ”—<class_ItemList_property_allow_rmb_select>`
  278. .. rst-class:: classref-property-setget
  279. - |void| **set_allow_rmb_select**\ (\ value\: :ref:`bool<class_bool>`\ )
  280. - :ref:`bool<class_bool>` **get_allow_rmb_select**\ (\ )
  281. If ``true``, right mouse button click can select items.
  282. .. rst-class:: classref-item-separator
  283. ----
  284. .. _class_ItemList_property_allow_search:
  285. .. rst-class:: classref-property
  286. :ref:`bool<class_bool>` **allow_search** = ``true`` :ref:`๐Ÿ”—<class_ItemList_property_allow_search>`
  287. .. rst-class:: classref-property-setget
  288. - |void| **set_allow_search**\ (\ value\: :ref:`bool<class_bool>`\ )
  289. - :ref:`bool<class_bool>` **get_allow_search**\ (\ )
  290. If ``true``, allows navigating the **ItemList** with letter keys through incremental search.
  291. .. rst-class:: classref-item-separator
  292. ----
  293. .. _class_ItemList_property_auto_height:
  294. .. rst-class:: classref-property
  295. :ref:`bool<class_bool>` **auto_height** = ``false`` :ref:`๐Ÿ”—<class_ItemList_property_auto_height>`
  296. .. rst-class:: classref-property-setget
  297. - |void| **set_auto_height**\ (\ value\: :ref:`bool<class_bool>`\ )
  298. - :ref:`bool<class_bool>` **has_auto_height**\ (\ )
  299. If ``true``, the control will automatically resize the height to fit its content.
  300. .. rst-class:: classref-item-separator
  301. ----
  302. .. _class_ItemList_property_fixed_column_width:
  303. .. rst-class:: classref-property
  304. :ref:`int<class_int>` **fixed_column_width** = ``0`` :ref:`๐Ÿ”—<class_ItemList_property_fixed_column_width>`
  305. .. rst-class:: classref-property-setget
  306. - |void| **set_fixed_column_width**\ (\ value\: :ref:`int<class_int>`\ )
  307. - :ref:`int<class_int>` **get_fixed_column_width**\ (\ )
  308. The width all columns will be adjusted to.
  309. 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.
  310. .. rst-class:: classref-item-separator
  311. ----
  312. .. _class_ItemList_property_fixed_icon_size:
  313. .. rst-class:: classref-property
  314. :ref:`Vector2i<class_Vector2i>` **fixed_icon_size** = ``Vector2i(0, 0)`` :ref:`๐Ÿ”—<class_ItemList_property_fixed_icon_size>`
  315. .. rst-class:: classref-property-setget
  316. - |void| **set_fixed_icon_size**\ (\ value\: :ref:`Vector2i<class_Vector2i>`\ )
  317. - :ref:`Vector2i<class_Vector2i>` **get_fixed_icon_size**\ (\ )
  318. The size all icons will be adjusted to.
  319. If either X or Y component is not greater than zero, icon size won't be affected.
  320. .. rst-class:: classref-item-separator
  321. ----
  322. .. _class_ItemList_property_icon_mode:
  323. .. rst-class:: classref-property
  324. :ref:`IconMode<enum_ItemList_IconMode>` **icon_mode** = ``1`` :ref:`๐Ÿ”—<class_ItemList_property_icon_mode>`
  325. .. rst-class:: classref-property-setget
  326. - |void| **set_icon_mode**\ (\ value\: :ref:`IconMode<enum_ItemList_IconMode>`\ )
  327. - :ref:`IconMode<enum_ItemList_IconMode>` **get_icon_mode**\ (\ )
  328. The icon position, whether above or to the left of the text. See the :ref:`IconMode<enum_ItemList_IconMode>` constants.
  329. .. rst-class:: classref-item-separator
  330. ----
  331. .. _class_ItemList_property_icon_scale:
  332. .. rst-class:: classref-property
  333. :ref:`float<class_float>` **icon_scale** = ``1.0`` :ref:`๐Ÿ”—<class_ItemList_property_icon_scale>`
  334. .. rst-class:: classref-property-setget
  335. - |void| **set_icon_scale**\ (\ value\: :ref:`float<class_float>`\ )
  336. - :ref:`float<class_float>` **get_icon_scale**\ (\ )
  337. The scale of icon applied after :ref:`fixed_icon_size<class_ItemList_property_fixed_icon_size>` and transposing takes effect.
  338. .. rst-class:: classref-item-separator
  339. ----
  340. .. _class_ItemList_property_item_count:
  341. .. rst-class:: classref-property
  342. :ref:`int<class_int>` **item_count** = ``0`` :ref:`๐Ÿ”—<class_ItemList_property_item_count>`
  343. .. rst-class:: classref-property-setget
  344. - |void| **set_item_count**\ (\ value\: :ref:`int<class_int>`\ )
  345. - :ref:`int<class_int>` **get_item_count**\ (\ )
  346. The number of items currently in the list.
  347. .. rst-class:: classref-item-separator
  348. ----
  349. .. _class_ItemList_property_max_columns:
  350. .. rst-class:: classref-property
  351. :ref:`int<class_int>` **max_columns** = ``1`` :ref:`๐Ÿ”—<class_ItemList_property_max_columns>`
  352. .. rst-class:: classref-property-setget
  353. - |void| **set_max_columns**\ (\ value\: :ref:`int<class_int>`\ )
  354. - :ref:`int<class_int>` **get_max_columns**\ (\ )
  355. Maximum columns the list will have.
  356. If greater than zero, the content will be split among the specified columns.
  357. A value of zero means unlimited columns, i.e. all items will be put in the same row.
  358. .. rst-class:: classref-item-separator
  359. ----
  360. .. _class_ItemList_property_max_text_lines:
  361. .. rst-class:: classref-property
  362. :ref:`int<class_int>` **max_text_lines** = ``1`` :ref:`๐Ÿ”—<class_ItemList_property_max_text_lines>`
  363. .. rst-class:: classref-property-setget
  364. - |void| **set_max_text_lines**\ (\ value\: :ref:`int<class_int>`\ )
  365. - :ref:`int<class_int>` **get_max_text_lines**\ (\ )
  366. Maximum lines of text allowed in each item. Space will be reserved even when there is not enough lines of text to display.
  367. \ **Note:** This property takes effect only when :ref:`icon_mode<class_ItemList_property_icon_mode>` is :ref:`ICON_MODE_TOP<class_ItemList_constant_ICON_MODE_TOP>`. To make the text wrap, :ref:`fixed_column_width<class_ItemList_property_fixed_column_width>` should be greater than zero.
  368. .. rst-class:: classref-item-separator
  369. ----
  370. .. _class_ItemList_property_same_column_width:
  371. .. rst-class:: classref-property
  372. :ref:`bool<class_bool>` **same_column_width** = ``false`` :ref:`๐Ÿ”—<class_ItemList_property_same_column_width>`
  373. .. rst-class:: classref-property-setget
  374. - |void| **set_same_column_width**\ (\ value\: :ref:`bool<class_bool>`\ )
  375. - :ref:`bool<class_bool>` **is_same_column_width**\ (\ )
  376. Whether all columns will have the same width.
  377. If ``true``, the width is equal to the largest column width of all columns.
  378. .. rst-class:: classref-item-separator
  379. ----
  380. .. _class_ItemList_property_select_mode:
  381. .. rst-class:: classref-property
  382. :ref:`SelectMode<enum_ItemList_SelectMode>` **select_mode** = ``0`` :ref:`๐Ÿ”—<class_ItemList_property_select_mode>`
  383. .. rst-class:: classref-property-setget
  384. - |void| **set_select_mode**\ (\ value\: :ref:`SelectMode<enum_ItemList_SelectMode>`\ )
  385. - :ref:`SelectMode<enum_ItemList_SelectMode>` **get_select_mode**\ (\ )
  386. Allows single or multiple item selection. See the :ref:`SelectMode<enum_ItemList_SelectMode>` constants.
  387. .. rst-class:: classref-item-separator
  388. ----
  389. .. _class_ItemList_property_text_overrun_behavior:
  390. .. rst-class:: classref-property
  391. :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` **text_overrun_behavior** = ``3`` :ref:`๐Ÿ”—<class_ItemList_property_text_overrun_behavior>`
  392. .. rst-class:: classref-property-setget
  393. - |void| **set_text_overrun_behavior**\ (\ value\: :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>`\ )
  394. - :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` **get_text_overrun_behavior**\ (\ )
  395. Sets the clipping behavior when the text exceeds an item's bounding rectangle. See :ref:`OverrunBehavior<enum_TextServer_OverrunBehavior>` for a description of all modes.
  396. .. rst-class:: classref-section-separator
  397. ----
  398. .. rst-class:: classref-descriptions-group
  399. Method Descriptions
  400. -------------------
  401. .. _class_ItemList_method_add_icon_item:
  402. .. rst-class:: classref-method
  403. :ref:`int<class_int>` **add_icon_item**\ (\ icon\: :ref:`Texture2D<class_Texture2D>`, selectable\: :ref:`bool<class_bool>` = true\ ) :ref:`๐Ÿ”—<class_ItemList_method_add_icon_item>`
  404. Adds an item to the item list with no text, only an icon. Returns the index of an added item.
  405. .. rst-class:: classref-item-separator
  406. ----
  407. .. _class_ItemList_method_add_item:
  408. .. rst-class:: classref-method
  409. :ref:`int<class_int>` **add_item**\ (\ text\: :ref:`String<class_String>`, icon\: :ref:`Texture2D<class_Texture2D>` = null, selectable\: :ref:`bool<class_bool>` = true\ ) :ref:`๐Ÿ”—<class_ItemList_method_add_item>`
  410. Adds an item to the item list with specified text. Returns the index of an added item.
  411. Specify an ``icon``, or use ``null`` as the ``icon`` for a list item with no icon.
  412. If selectable is ``true``, the list item will be selectable.
  413. .. rst-class:: classref-item-separator
  414. ----
  415. .. _class_ItemList_method_clear:
  416. .. rst-class:: classref-method
  417. |void| **clear**\ (\ ) :ref:`๐Ÿ”—<class_ItemList_method_clear>`
  418. Removes all items from the list.
  419. .. rst-class:: classref-item-separator
  420. ----
  421. .. _class_ItemList_method_deselect:
  422. .. rst-class:: classref-method
  423. |void| **deselect**\ (\ idx\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_ItemList_method_deselect>`
  424. Ensures the item associated with the specified index is not selected.
  425. .. rst-class:: classref-item-separator
  426. ----
  427. .. _class_ItemList_method_deselect_all:
  428. .. rst-class:: classref-method
  429. |void| **deselect_all**\ (\ ) :ref:`๐Ÿ”—<class_ItemList_method_deselect_all>`
  430. Ensures there are no items selected.
  431. .. rst-class:: classref-item-separator
  432. ----
  433. .. _class_ItemList_method_ensure_current_is_visible:
  434. .. rst-class:: classref-method
  435. |void| **ensure_current_is_visible**\ (\ ) :ref:`๐Ÿ”—<class_ItemList_method_ensure_current_is_visible>`
  436. Ensure current selection is visible, adjusting the scroll position as necessary.
  437. .. rst-class:: classref-item-separator
  438. ----
  439. .. _class_ItemList_method_force_update_list_size:
  440. .. rst-class:: classref-method
  441. |void| **force_update_list_size**\ (\ ) :ref:`๐Ÿ”—<class_ItemList_method_force_update_list_size>`
  442. Forces an update to the list size based on its items. This happens automatically whenever size of the items, or other relevant settings like :ref:`auto_height<class_ItemList_property_auto_height>`, change. The method can be used to trigger the update ahead of next drawing pass.
  443. .. rst-class:: classref-item-separator
  444. ----
  445. .. _class_ItemList_method_get_item_at_position:
  446. .. rst-class:: classref-method
  447. :ref:`int<class_int>` **get_item_at_position**\ (\ position\: :ref:`Vector2<class_Vector2>`, exact\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`๐Ÿ”—<class_ItemList_method_get_item_at_position>`
  448. Returns the item index at the given ``position``.
  449. When there is no item at that point, -1 will be returned if ``exact`` is ``true``, and the closest item index will be returned otherwise.
  450. \ **Note:** The returned value is unreliable if called right after modifying the **ItemList**, before it redraws in the next frame.
  451. .. rst-class:: classref-item-separator
  452. ----
  453. .. _class_ItemList_method_get_item_custom_bg_color:
  454. .. rst-class:: classref-method
  455. :ref:`Color<class_Color>` **get_item_custom_bg_color**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_ItemList_method_get_item_custom_bg_color>`
  456. Returns the custom background color of the item specified by ``idx`` index.
  457. .. rst-class:: classref-item-separator
  458. ----
  459. .. _class_ItemList_method_get_item_custom_fg_color:
  460. .. rst-class:: classref-method
  461. :ref:`Color<class_Color>` **get_item_custom_fg_color**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_ItemList_method_get_item_custom_fg_color>`
  462. Returns the custom foreground color of the item specified by ``idx`` index.
  463. .. rst-class:: classref-item-separator
  464. ----
  465. .. _class_ItemList_method_get_item_icon:
  466. .. rst-class:: classref-method
  467. :ref:`Texture2D<class_Texture2D>` **get_item_icon**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_ItemList_method_get_item_icon>`
  468. Returns the icon associated with the specified index.
  469. .. rst-class:: classref-item-separator
  470. ----
  471. .. _class_ItemList_method_get_item_icon_modulate:
  472. .. rst-class:: classref-method
  473. :ref:`Color<class_Color>` **get_item_icon_modulate**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_ItemList_method_get_item_icon_modulate>`
  474. Returns a :ref:`Color<class_Color>` modulating item's icon at the specified index.
  475. .. rst-class:: classref-item-separator
  476. ----
  477. .. _class_ItemList_method_get_item_icon_region:
  478. .. rst-class:: classref-method
  479. :ref:`Rect2<class_Rect2>` **get_item_icon_region**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_ItemList_method_get_item_icon_region>`
  480. Returns the region of item's icon used. The whole icon will be used if the region has no area.
  481. .. rst-class:: classref-item-separator
  482. ----
  483. .. _class_ItemList_method_get_item_language:
  484. .. rst-class:: classref-method
  485. :ref:`String<class_String>` **get_item_language**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_ItemList_method_get_item_language>`
  486. Returns item's text language code.
  487. .. rst-class:: classref-item-separator
  488. ----
  489. .. _class_ItemList_method_get_item_metadata:
  490. .. rst-class:: classref-method
  491. :ref:`Variant<class_Variant>` **get_item_metadata**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_ItemList_method_get_item_metadata>`
  492. Returns the metadata value of the specified index.
  493. .. rst-class:: classref-item-separator
  494. ----
  495. .. _class_ItemList_method_get_item_rect:
  496. .. rst-class:: classref-method
  497. :ref:`Rect2<class_Rect2>` **get_item_rect**\ (\ idx\: :ref:`int<class_int>`, expand\: :ref:`bool<class_bool>` = true\ ) |const| :ref:`๐Ÿ”—<class_ItemList_method_get_item_rect>`
  498. Returns the position and size of the item with the specified index, in the coordinate system of the **ItemList** node. If ``expand`` is ``true`` the last column expands to fill the rest of the row.
  499. \ **Note:** The returned value is unreliable if called right after modifying the **ItemList**, before it redraws in the next frame.
  500. .. rst-class:: classref-item-separator
  501. ----
  502. .. _class_ItemList_method_get_item_text:
  503. .. rst-class:: classref-method
  504. :ref:`String<class_String>` **get_item_text**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_ItemList_method_get_item_text>`
  505. Returns the text associated with the specified index.
  506. .. rst-class:: classref-item-separator
  507. ----
  508. .. _class_ItemList_method_get_item_text_direction:
  509. .. rst-class:: classref-method
  510. :ref:`TextDirection<enum_Control_TextDirection>` **get_item_text_direction**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_ItemList_method_get_item_text_direction>`
  511. Returns item's text base writing direction.
  512. .. rst-class:: classref-item-separator
  513. ----
  514. .. _class_ItemList_method_get_item_tooltip:
  515. .. rst-class:: classref-method
  516. :ref:`String<class_String>` **get_item_tooltip**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_ItemList_method_get_item_tooltip>`
  517. Returns the tooltip hint associated with the specified index.
  518. .. rst-class:: classref-item-separator
  519. ----
  520. .. _class_ItemList_method_get_selected_items:
  521. .. rst-class:: classref-method
  522. :ref:`PackedInt32Array<class_PackedInt32Array>` **get_selected_items**\ (\ ) :ref:`๐Ÿ”—<class_ItemList_method_get_selected_items>`
  523. Returns an array with the indexes of the selected items.
  524. .. rst-class:: classref-item-separator
  525. ----
  526. .. _class_ItemList_method_get_v_scroll_bar:
  527. .. rst-class:: classref-method
  528. :ref:`VScrollBar<class_VScrollBar>` **get_v_scroll_bar**\ (\ ) :ref:`๐Ÿ”—<class_ItemList_method_get_v_scroll_bar>`
  529. Returns the vertical scrollbar.
  530. \ **Warning:** This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their :ref:`CanvasItem.visible<class_CanvasItem_property_visible>` property.
  531. .. rst-class:: classref-item-separator
  532. ----
  533. .. _class_ItemList_method_is_anything_selected:
  534. .. rst-class:: classref-method
  535. :ref:`bool<class_bool>` **is_anything_selected**\ (\ ) :ref:`๐Ÿ”—<class_ItemList_method_is_anything_selected>`
  536. Returns ``true`` if one or more items are selected.
  537. .. rst-class:: classref-item-separator
  538. ----
  539. .. _class_ItemList_method_is_item_disabled:
  540. .. rst-class:: classref-method
  541. :ref:`bool<class_bool>` **is_item_disabled**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_ItemList_method_is_item_disabled>`
  542. Returns ``true`` if the item at the specified index is disabled.
  543. .. rst-class:: classref-item-separator
  544. ----
  545. .. _class_ItemList_method_is_item_icon_transposed:
  546. .. rst-class:: classref-method
  547. :ref:`bool<class_bool>` **is_item_icon_transposed**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_ItemList_method_is_item_icon_transposed>`
  548. Returns ``true`` if the item icon will be drawn transposed, i.e. the X and Y axes are swapped.
  549. .. rst-class:: classref-item-separator
  550. ----
  551. .. _class_ItemList_method_is_item_selectable:
  552. .. rst-class:: classref-method
  553. :ref:`bool<class_bool>` **is_item_selectable**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_ItemList_method_is_item_selectable>`
  554. Returns ``true`` if the item at the specified index is selectable.
  555. .. rst-class:: classref-item-separator
  556. ----
  557. .. _class_ItemList_method_is_item_tooltip_enabled:
  558. .. rst-class:: classref-method
  559. :ref:`bool<class_bool>` **is_item_tooltip_enabled**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_ItemList_method_is_item_tooltip_enabled>`
  560. Returns ``true`` if the tooltip is enabled for specified item index.
  561. .. rst-class:: classref-item-separator
  562. ----
  563. .. _class_ItemList_method_is_selected:
  564. .. rst-class:: classref-method
  565. :ref:`bool<class_bool>` **is_selected**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_ItemList_method_is_selected>`
  566. Returns ``true`` if the item at the specified index is currently selected.
  567. .. rst-class:: classref-item-separator
  568. ----
  569. .. _class_ItemList_method_move_item:
  570. .. rst-class:: classref-method
  571. |void| **move_item**\ (\ from_idx\: :ref:`int<class_int>`, to_idx\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_ItemList_method_move_item>`
  572. Moves item from index ``from_idx`` to ``to_idx``.
  573. .. rst-class:: classref-item-separator
  574. ----
  575. .. _class_ItemList_method_remove_item:
  576. .. rst-class:: classref-method
  577. |void| **remove_item**\ (\ idx\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_ItemList_method_remove_item>`
  578. Removes the item specified by ``idx`` index from the list.
  579. .. rst-class:: classref-item-separator
  580. ----
  581. .. _class_ItemList_method_select:
  582. .. rst-class:: classref-method
  583. |void| **select**\ (\ idx\: :ref:`int<class_int>`, single\: :ref:`bool<class_bool>` = true\ ) :ref:`๐Ÿ”—<class_ItemList_method_select>`
  584. Select the item at the specified index.
  585. \ **Note:** This method does not trigger the item selection signal.
  586. .. rst-class:: classref-item-separator
  587. ----
  588. .. _class_ItemList_method_set_item_custom_bg_color:
  589. .. rst-class:: classref-method
  590. |void| **set_item_custom_bg_color**\ (\ idx\: :ref:`int<class_int>`, custom_bg_color\: :ref:`Color<class_Color>`\ ) :ref:`๐Ÿ”—<class_ItemList_method_set_item_custom_bg_color>`
  591. Sets the background color of the item specified by ``idx`` index to the specified :ref:`Color<class_Color>`.
  592. .. rst-class:: classref-item-separator
  593. ----
  594. .. _class_ItemList_method_set_item_custom_fg_color:
  595. .. rst-class:: classref-method
  596. |void| **set_item_custom_fg_color**\ (\ idx\: :ref:`int<class_int>`, custom_fg_color\: :ref:`Color<class_Color>`\ ) :ref:`๐Ÿ”—<class_ItemList_method_set_item_custom_fg_color>`
  597. Sets the foreground color of the item specified by ``idx`` index to the specified :ref:`Color<class_Color>`.
  598. .. rst-class:: classref-item-separator
  599. ----
  600. .. _class_ItemList_method_set_item_disabled:
  601. .. rst-class:: classref-method
  602. |void| **set_item_disabled**\ (\ idx\: :ref:`int<class_int>`, disabled\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_ItemList_method_set_item_disabled>`
  603. Disables (or enables) the item at the specified index.
  604. Disabled items cannot be selected and do not trigger activation signals (when double-clicking or pressing :kbd:`Enter`).
  605. .. rst-class:: classref-item-separator
  606. ----
  607. .. _class_ItemList_method_set_item_icon:
  608. .. rst-class:: classref-method
  609. |void| **set_item_icon**\ (\ idx\: :ref:`int<class_int>`, icon\: :ref:`Texture2D<class_Texture2D>`\ ) :ref:`๐Ÿ”—<class_ItemList_method_set_item_icon>`
  610. Sets (or replaces) the icon's :ref:`Texture2D<class_Texture2D>` associated with the specified index.
  611. .. rst-class:: classref-item-separator
  612. ----
  613. .. _class_ItemList_method_set_item_icon_modulate:
  614. .. rst-class:: classref-method
  615. |void| **set_item_icon_modulate**\ (\ idx\: :ref:`int<class_int>`, modulate\: :ref:`Color<class_Color>`\ ) :ref:`๐Ÿ”—<class_ItemList_method_set_item_icon_modulate>`
  616. Sets a modulating :ref:`Color<class_Color>` of the item associated with the specified index.
  617. .. rst-class:: classref-item-separator
  618. ----
  619. .. _class_ItemList_method_set_item_icon_region:
  620. .. rst-class:: classref-method
  621. |void| **set_item_icon_region**\ (\ idx\: :ref:`int<class_int>`, rect\: :ref:`Rect2<class_Rect2>`\ ) :ref:`๐Ÿ”—<class_ItemList_method_set_item_icon_region>`
  622. Sets the region of item's icon used. The whole icon will be used if the region has no area.
  623. .. rst-class:: classref-item-separator
  624. ----
  625. .. _class_ItemList_method_set_item_icon_transposed:
  626. .. rst-class:: classref-method
  627. |void| **set_item_icon_transposed**\ (\ idx\: :ref:`int<class_int>`, transposed\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_ItemList_method_set_item_icon_transposed>`
  628. Sets whether the item icon will be drawn transposed.
  629. .. rst-class:: classref-item-separator
  630. ----
  631. .. _class_ItemList_method_set_item_language:
  632. .. rst-class:: classref-method
  633. |void| **set_item_language**\ (\ idx\: :ref:`int<class_int>`, language\: :ref:`String<class_String>`\ ) :ref:`๐Ÿ”—<class_ItemList_method_set_item_language>`
  634. Sets language code of item's text used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
  635. .. rst-class:: classref-item-separator
  636. ----
  637. .. _class_ItemList_method_set_item_metadata:
  638. .. rst-class:: classref-method
  639. |void| **set_item_metadata**\ (\ idx\: :ref:`int<class_int>`, metadata\: :ref:`Variant<class_Variant>`\ ) :ref:`๐Ÿ”—<class_ItemList_method_set_item_metadata>`
  640. Sets a value (of any type) to be stored with the item associated with the specified index.
  641. .. rst-class:: classref-item-separator
  642. ----
  643. .. _class_ItemList_method_set_item_selectable:
  644. .. rst-class:: classref-method
  645. |void| **set_item_selectable**\ (\ idx\: :ref:`int<class_int>`, selectable\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_ItemList_method_set_item_selectable>`
  646. Allows or disallows selection of the item associated with the specified index.
  647. .. rst-class:: classref-item-separator
  648. ----
  649. .. _class_ItemList_method_set_item_text:
  650. .. rst-class:: classref-method
  651. |void| **set_item_text**\ (\ idx\: :ref:`int<class_int>`, text\: :ref:`String<class_String>`\ ) :ref:`๐Ÿ”—<class_ItemList_method_set_item_text>`
  652. Sets text of the item associated with the specified index.
  653. .. rst-class:: classref-item-separator
  654. ----
  655. .. _class_ItemList_method_set_item_text_direction:
  656. .. rst-class:: classref-method
  657. |void| **set_item_text_direction**\ (\ idx\: :ref:`int<class_int>`, direction\: :ref:`TextDirection<enum_Control_TextDirection>`\ ) :ref:`๐Ÿ”—<class_ItemList_method_set_item_text_direction>`
  658. Sets item's text base writing direction.
  659. .. rst-class:: classref-item-separator
  660. ----
  661. .. _class_ItemList_method_set_item_tooltip:
  662. .. rst-class:: classref-method
  663. |void| **set_item_tooltip**\ (\ idx\: :ref:`int<class_int>`, tooltip\: :ref:`String<class_String>`\ ) :ref:`๐Ÿ”—<class_ItemList_method_set_item_tooltip>`
  664. Sets the tooltip hint for the item associated with the specified index.
  665. .. rst-class:: classref-item-separator
  666. ----
  667. .. _class_ItemList_method_set_item_tooltip_enabled:
  668. .. rst-class:: classref-method
  669. |void| **set_item_tooltip_enabled**\ (\ idx\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_ItemList_method_set_item_tooltip_enabled>`
  670. Sets whether the tooltip hint is enabled for specified item index.
  671. .. rst-class:: classref-item-separator
  672. ----
  673. .. _class_ItemList_method_sort_items_by_text:
  674. .. rst-class:: classref-method
  675. |void| **sort_items_by_text**\ (\ ) :ref:`๐Ÿ”—<class_ItemList_method_sort_items_by_text>`
  676. Sorts items in the list by their text.
  677. .. rst-class:: classref-section-separator
  678. ----
  679. .. rst-class:: classref-descriptions-group
  680. Theme Property Descriptions
  681. ---------------------------
  682. .. _class_ItemList_theme_color_font_color:
  683. .. rst-class:: classref-themeproperty
  684. :ref:`Color<class_Color>` **font_color** = ``Color(0.65, 0.65, 0.65, 1)`` :ref:`๐Ÿ”—<class_ItemList_theme_color_font_color>`
  685. Default text :ref:`Color<class_Color>` of the item.
  686. .. rst-class:: classref-item-separator
  687. ----
  688. .. _class_ItemList_theme_color_font_hovered_color:
  689. .. rst-class:: classref-themeproperty
  690. :ref:`Color<class_Color>` **font_hovered_color** = ``Color(0.95, 0.95, 0.95, 1)`` :ref:`๐Ÿ”—<class_ItemList_theme_color_font_hovered_color>`
  691. Text :ref:`Color<class_Color>` used when the item is hovered and not selected yet.
  692. .. rst-class:: classref-item-separator
  693. ----
  694. .. _class_ItemList_theme_color_font_outline_color:
  695. .. rst-class:: classref-themeproperty
  696. :ref:`Color<class_Color>` **font_outline_color** = ``Color(0, 0, 0, 1)`` :ref:`๐Ÿ”—<class_ItemList_theme_color_font_outline_color>`
  697. The tint of text outline of the item.
  698. .. rst-class:: classref-item-separator
  699. ----
  700. .. _class_ItemList_theme_color_font_selected_color:
  701. .. rst-class:: classref-themeproperty
  702. :ref:`Color<class_Color>` **font_selected_color** = ``Color(1, 1, 1, 1)`` :ref:`๐Ÿ”—<class_ItemList_theme_color_font_selected_color>`
  703. Text :ref:`Color<class_Color>` used when the item is selected.
  704. .. rst-class:: classref-item-separator
  705. ----
  706. .. _class_ItemList_theme_color_guide_color:
  707. .. rst-class:: classref-themeproperty
  708. :ref:`Color<class_Color>` **guide_color** = ``Color(0.7, 0.7, 0.7, 0.25)`` :ref:`๐Ÿ”—<class_ItemList_theme_color_guide_color>`
  709. :ref:`Color<class_Color>` of the guideline. The guideline is a line drawn between each row of items.
  710. .. rst-class:: classref-item-separator
  711. ----
  712. .. _class_ItemList_theme_constant_h_separation:
  713. .. rst-class:: classref-themeproperty
  714. :ref:`int<class_int>` **h_separation** = ``4`` :ref:`๐Ÿ”—<class_ItemList_theme_constant_h_separation>`
  715. The horizontal spacing between items.
  716. .. rst-class:: classref-item-separator
  717. ----
  718. .. _class_ItemList_theme_constant_icon_margin:
  719. .. rst-class:: classref-themeproperty
  720. :ref:`int<class_int>` **icon_margin** = ``4`` :ref:`๐Ÿ”—<class_ItemList_theme_constant_icon_margin>`
  721. The spacing between item's icon and text.
  722. .. rst-class:: classref-item-separator
  723. ----
  724. .. _class_ItemList_theme_constant_line_separation:
  725. .. rst-class:: classref-themeproperty
  726. :ref:`int<class_int>` **line_separation** = ``2`` :ref:`๐Ÿ”—<class_ItemList_theme_constant_line_separation>`
  727. The vertical spacing between each line of text.
  728. .. rst-class:: classref-item-separator
  729. ----
  730. .. _class_ItemList_theme_constant_outline_size:
  731. .. rst-class:: classref-themeproperty
  732. :ref:`int<class_int>` **outline_size** = ``0`` :ref:`๐Ÿ”—<class_ItemList_theme_constant_outline_size>`
  733. The size of the item text outline.
  734. \ **Note:** If using a font with :ref:`FontFile.multichannel_signed_distance_field<class_FontFile_property_multichannel_signed_distance_field>` enabled, its :ref:`FontFile.msdf_pixel_range<class_FontFile_property_msdf_pixel_range>` must be set to at least *twice* the value of :ref:`outline_size<class_ItemList_theme_constant_outline_size>` for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended.
  735. .. rst-class:: classref-item-separator
  736. ----
  737. .. _class_ItemList_theme_constant_v_separation:
  738. .. rst-class:: classref-themeproperty
  739. :ref:`int<class_int>` **v_separation** = ``4`` :ref:`๐Ÿ”—<class_ItemList_theme_constant_v_separation>`
  740. The vertical spacing between items.
  741. .. rst-class:: classref-item-separator
  742. ----
  743. .. _class_ItemList_theme_font_font:
  744. .. rst-class:: classref-themeproperty
  745. :ref:`Font<class_Font>` **font** :ref:`๐Ÿ”—<class_ItemList_theme_font_font>`
  746. :ref:`Font<class_Font>` of the item's text.
  747. .. rst-class:: classref-item-separator
  748. ----
  749. .. _class_ItemList_theme_font_size_font_size:
  750. .. rst-class:: classref-themeproperty
  751. :ref:`int<class_int>` **font_size** :ref:`๐Ÿ”—<class_ItemList_theme_font_size_font_size>`
  752. Font size of the item's text.
  753. .. rst-class:: classref-item-separator
  754. ----
  755. .. _class_ItemList_theme_style_cursor:
  756. .. rst-class:: classref-themeproperty
  757. :ref:`StyleBox<class_StyleBox>` **cursor** :ref:`๐Ÿ”—<class_ItemList_theme_style_cursor>`
  758. :ref:`StyleBox<class_StyleBox>` used for the cursor, when the **ItemList** is being focused.
  759. .. rst-class:: classref-item-separator
  760. ----
  761. .. _class_ItemList_theme_style_cursor_unfocused:
  762. .. rst-class:: classref-themeproperty
  763. :ref:`StyleBox<class_StyleBox>` **cursor_unfocused** :ref:`๐Ÿ”—<class_ItemList_theme_style_cursor_unfocused>`
  764. :ref:`StyleBox<class_StyleBox>` used for the cursor, when the **ItemList** is not being focused.
  765. .. rst-class:: classref-item-separator
  766. ----
  767. .. _class_ItemList_theme_style_focus:
  768. .. rst-class:: classref-themeproperty
  769. :ref:`StyleBox<class_StyleBox>` **focus** :ref:`๐Ÿ”—<class_ItemList_theme_style_focus>`
  770. The focused style for the **ItemList**, drawn on top of the background, but below everything else.
  771. .. rst-class:: classref-item-separator
  772. ----
  773. .. _class_ItemList_theme_style_hovered:
  774. .. rst-class:: classref-themeproperty
  775. :ref:`StyleBox<class_StyleBox>` **hovered** :ref:`๐Ÿ”—<class_ItemList_theme_style_hovered>`
  776. :ref:`StyleBox<class_StyleBox>` for the hovered, but not selected items.
  777. .. rst-class:: classref-item-separator
  778. ----
  779. .. _class_ItemList_theme_style_panel:
  780. .. rst-class:: classref-themeproperty
  781. :ref:`StyleBox<class_StyleBox>` **panel** :ref:`๐Ÿ”—<class_ItemList_theme_style_panel>`
  782. The background style for the **ItemList**.
  783. .. rst-class:: classref-item-separator
  784. ----
  785. .. _class_ItemList_theme_style_selected:
  786. .. rst-class:: classref-themeproperty
  787. :ref:`StyleBox<class_StyleBox>` **selected** :ref:`๐Ÿ”—<class_ItemList_theme_style_selected>`
  788. :ref:`StyleBox<class_StyleBox>` for the selected items, used when the **ItemList** is not being focused.
  789. .. rst-class:: classref-item-separator
  790. ----
  791. .. _class_ItemList_theme_style_selected_focus:
  792. .. rst-class:: classref-themeproperty
  793. :ref:`StyleBox<class_StyleBox>` **selected_focus** :ref:`๐Ÿ”—<class_ItemList_theme_style_selected_focus>`
  794. :ref:`StyleBox<class_StyleBox>` for the selected items, used when the **ItemList** is being focused.
  795. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  796. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  797. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  798. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  799. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  800. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  801. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  802. .. |void| replace:: :abbr:`void (No return value.)`