class_itemlist.rst 65 KB

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