class_itemlist.rst 62 KB

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