class_popupmenu.rst 122 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/PopupMenu.xml.
  6. .. _class_PopupMenu:
  7. PopupMenu
  8. =========
  9. **Inherits:** :ref:`Popup<class_Popup>` **<** :ref:`Window<class_Window>` **<** :ref:`Viewport<class_Viewport>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. A modal window used to display a list of options.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. **PopupMenu** is a modal window used to display a list of options. Useful for toolbars and context menus.
  15. The size of a **PopupMenu** can be limited by using :ref:`Window.max_size<class_Window_property_max_size>`. If the height of the list of items is larger than the maximum height of the **PopupMenu**, a :ref:`ScrollContainer<class_ScrollContainer>` within the popup will allow the user to scroll the contents. If no maximum size is set, or if it is set to ``0``, the **PopupMenu** height will be limited by its parent rect.
  16. 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.
  17. \ **Incremental search:** Like :ref:`ItemList<class_ItemList>` and :ref:`Tree<class_Tree>`, **PopupMenu** 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>`.
  18. \ **Note:** The ID values used for items are limited to 32 bits, not full 64 bits of :ref:`int<class_int>`. This has a range of ``-2^32`` to ``2^32 - 1``, i.e. ``-2147483648`` to ``2147483647``.
  19. .. rst-class:: classref-reftable-group
  20. Properties
  21. ----------
  22. .. table::
  23. :widths: auto
  24. +-------------------------------------------------+----------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  25. | :ref:`bool<class_bool>` | :ref:`allow_search<class_PopupMenu_property_allow_search>` | ``true`` |
  26. +-------------------------------------------------+----------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  27. | :ref:`bool<class_bool>` | :ref:`hide_on_checkable_item_selection<class_PopupMenu_property_hide_on_checkable_item_selection>` | ``true`` |
  28. +-------------------------------------------------+----------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  29. | :ref:`bool<class_bool>` | :ref:`hide_on_item_selection<class_PopupMenu_property_hide_on_item_selection>` | ``true`` |
  30. +-------------------------------------------------+----------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  31. | :ref:`bool<class_bool>` | :ref:`hide_on_state_item_selection<class_PopupMenu_property_hide_on_state_item_selection>` | ``false`` |
  32. +-------------------------------------------------+----------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  33. | :ref:`int<class_int>` | :ref:`item_count<class_PopupMenu_property_item_count>` | ``0`` |
  34. +-------------------------------------------------+----------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  35. | :ref:`bool<class_bool>` | :ref:`prefer_native_menu<class_PopupMenu_property_prefer_native_menu>` | ``false`` |
  36. +-------------------------------------------------+----------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  37. | :ref:`float<class_float>` | :ref:`submenu_popup_delay<class_PopupMenu_property_submenu_popup_delay>` | ``0.3`` |
  38. +-------------------------------------------------+----------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  39. | :ref:`SystemMenus<enum_NativeMenu_SystemMenus>` | :ref:`system_menu_id<class_PopupMenu_property_system_menu_id>` | ``0`` |
  40. +-------------------------------------------------+----------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  41. | :ref:`bool<class_bool>` | transparent | ``true`` (overrides :ref:`Window<class_Window_property_transparent>`) |
  42. +-------------------------------------------------+----------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  43. | :ref:`bool<class_bool>` | transparent_bg | ``true`` (overrides :ref:`Viewport<class_Viewport_property_transparent_bg>`) |
  44. +-------------------------------------------------+----------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------+
  45. .. rst-class:: classref-reftable-group
  46. Methods
  47. -------
  48. .. table::
  49. :widths: auto
  50. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`bool<class_bool>` | :ref:`activate_item_by_event<class_PopupMenu_method_activate_item_by_event>`\ (\ event\: :ref:`InputEvent<class_InputEvent>`, for_global_only\: :ref:`bool<class_bool>` = false\ ) |
  52. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | |void| | :ref:`add_check_item<class_PopupMenu_method_add_check_item>`\ (\ label\: :ref:`String<class_String>`, id\: :ref:`int<class_int>` = -1, accel\: :ref:`Key<enum_@GlobalScope_Key>` = 0\ ) |
  54. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | |void| | :ref:`add_check_shortcut<class_PopupMenu_method_add_check_shortcut>`\ (\ shortcut\: :ref:`Shortcut<class_Shortcut>`, id\: :ref:`int<class_int>` = -1, global\: :ref:`bool<class_bool>` = false\ ) |
  56. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | |void| | :ref:`add_icon_check_item<class_PopupMenu_method_add_icon_check_item>`\ (\ texture\: :ref:`Texture2D<class_Texture2D>`, label\: :ref:`String<class_String>`, id\: :ref:`int<class_int>` = -1, accel\: :ref:`Key<enum_@GlobalScope_Key>` = 0\ ) |
  58. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | |void| | :ref:`add_icon_check_shortcut<class_PopupMenu_method_add_icon_check_shortcut>`\ (\ texture\: :ref:`Texture2D<class_Texture2D>`, shortcut\: :ref:`Shortcut<class_Shortcut>`, id\: :ref:`int<class_int>` = -1, global\: :ref:`bool<class_bool>` = false\ ) |
  60. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | |void| | :ref:`add_icon_item<class_PopupMenu_method_add_icon_item>`\ (\ texture\: :ref:`Texture2D<class_Texture2D>`, label\: :ref:`String<class_String>`, id\: :ref:`int<class_int>` = -1, accel\: :ref:`Key<enum_@GlobalScope_Key>` = 0\ ) |
  62. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | |void| | :ref:`add_icon_radio_check_item<class_PopupMenu_method_add_icon_radio_check_item>`\ (\ texture\: :ref:`Texture2D<class_Texture2D>`, label\: :ref:`String<class_String>`, id\: :ref:`int<class_int>` = -1, accel\: :ref:`Key<enum_@GlobalScope_Key>` = 0\ ) |
  64. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | |void| | :ref:`add_icon_radio_check_shortcut<class_PopupMenu_method_add_icon_radio_check_shortcut>`\ (\ texture\: :ref:`Texture2D<class_Texture2D>`, shortcut\: :ref:`Shortcut<class_Shortcut>`, id\: :ref:`int<class_int>` = -1, global\: :ref:`bool<class_bool>` = false\ ) |
  66. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | |void| | :ref:`add_icon_shortcut<class_PopupMenu_method_add_icon_shortcut>`\ (\ texture\: :ref:`Texture2D<class_Texture2D>`, shortcut\: :ref:`Shortcut<class_Shortcut>`, id\: :ref:`int<class_int>` = -1, global\: :ref:`bool<class_bool>` = false, allow_echo\: :ref:`bool<class_bool>` = false\ ) |
  68. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | |void| | :ref:`add_item<class_PopupMenu_method_add_item>`\ (\ label\: :ref:`String<class_String>`, id\: :ref:`int<class_int>` = -1, accel\: :ref:`Key<enum_@GlobalScope_Key>` = 0\ ) |
  70. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | |void| | :ref:`add_multistate_item<class_PopupMenu_method_add_multistate_item>`\ (\ label\: :ref:`String<class_String>`, max_states\: :ref:`int<class_int>`, default_state\: :ref:`int<class_int>` = 0, id\: :ref:`int<class_int>` = -1, accel\: :ref:`Key<enum_@GlobalScope_Key>` = 0\ ) |
  72. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | |void| | :ref:`add_radio_check_item<class_PopupMenu_method_add_radio_check_item>`\ (\ label\: :ref:`String<class_String>`, id\: :ref:`int<class_int>` = -1, accel\: :ref:`Key<enum_@GlobalScope_Key>` = 0\ ) |
  74. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | |void| | :ref:`add_radio_check_shortcut<class_PopupMenu_method_add_radio_check_shortcut>`\ (\ shortcut\: :ref:`Shortcut<class_Shortcut>`, id\: :ref:`int<class_int>` = -1, global\: :ref:`bool<class_bool>` = false\ ) |
  76. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | |void| | :ref:`add_separator<class_PopupMenu_method_add_separator>`\ (\ label\: :ref:`String<class_String>` = "", id\: :ref:`int<class_int>` = -1\ ) |
  78. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | |void| | :ref:`add_shortcut<class_PopupMenu_method_add_shortcut>`\ (\ shortcut\: :ref:`Shortcut<class_Shortcut>`, id\: :ref:`int<class_int>` = -1, global\: :ref:`bool<class_bool>` = false, allow_echo\: :ref:`bool<class_bool>` = false\ ) |
  80. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | |void| | :ref:`add_submenu_item<class_PopupMenu_method_add_submenu_item>`\ (\ label\: :ref:`String<class_String>`, submenu\: :ref:`String<class_String>`, id\: :ref:`int<class_int>` = -1\ ) |
  82. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | |void| | :ref:`add_submenu_node_item<class_PopupMenu_method_add_submenu_node_item>`\ (\ label\: :ref:`String<class_String>`, submenu\: :ref:`PopupMenu<class_PopupMenu>`, id\: :ref:`int<class_int>` = -1\ ) |
  84. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | |void| | :ref:`clear<class_PopupMenu_method_clear>`\ (\ free_submenus\: :ref:`bool<class_bool>` = false\ ) |
  86. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | :ref:`int<class_int>` | :ref:`get_focused_item<class_PopupMenu_method_get_focused_item>`\ (\ ) |const| |
  88. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | :ref:`Key<enum_@GlobalScope_Key>` | :ref:`get_item_accelerator<class_PopupMenu_method_get_item_accelerator>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  90. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | :ref:`Texture2D<class_Texture2D>` | :ref:`get_item_icon<class_PopupMenu_method_get_item_icon>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  92. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | :ref:`int<class_int>` | :ref:`get_item_icon_max_width<class_PopupMenu_method_get_item_icon_max_width>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  94. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | :ref:`Color<class_Color>` | :ref:`get_item_icon_modulate<class_PopupMenu_method_get_item_icon_modulate>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  96. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | :ref:`int<class_int>` | :ref:`get_item_id<class_PopupMenu_method_get_item_id>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  98. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | :ref:`int<class_int>` | :ref:`get_item_indent<class_PopupMenu_method_get_item_indent>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  100. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | :ref:`int<class_int>` | :ref:`get_item_index<class_PopupMenu_method_get_item_index>`\ (\ id\: :ref:`int<class_int>`\ ) |const| |
  102. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | :ref:`String<class_String>` | :ref:`get_item_language<class_PopupMenu_method_get_item_language>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  104. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | :ref:`Variant<class_Variant>` | :ref:`get_item_metadata<class_PopupMenu_method_get_item_metadata>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  106. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. | :ref:`int<class_int>` | :ref:`get_item_multistate<class_PopupMenu_method_get_item_multistate>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  108. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  109. | :ref:`int<class_int>` | :ref:`get_item_multistate_max<class_PopupMenu_method_get_item_multistate_max>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  110. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  111. | :ref:`Shortcut<class_Shortcut>` | :ref:`get_item_shortcut<class_PopupMenu_method_get_item_shortcut>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  112. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  113. | :ref:`String<class_String>` | :ref:`get_item_submenu<class_PopupMenu_method_get_item_submenu>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  114. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  115. | :ref:`PopupMenu<class_PopupMenu>` | :ref:`get_item_submenu_node<class_PopupMenu_method_get_item_submenu_node>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  116. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  117. | :ref:`String<class_String>` | :ref:`get_item_text<class_PopupMenu_method_get_item_text>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  118. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  119. | :ref:`TextDirection<enum_Control_TextDirection>` | :ref:`get_item_text_direction<class_PopupMenu_method_get_item_text_direction>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  120. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  121. | :ref:`String<class_String>` | :ref:`get_item_tooltip<class_PopupMenu_method_get_item_tooltip>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  122. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  123. | :ref:`bool<class_bool>` | :ref:`is_item_checkable<class_PopupMenu_method_is_item_checkable>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  124. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  125. | :ref:`bool<class_bool>` | :ref:`is_item_checked<class_PopupMenu_method_is_item_checked>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  126. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  127. | :ref:`bool<class_bool>` | :ref:`is_item_disabled<class_PopupMenu_method_is_item_disabled>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  128. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  129. | :ref:`bool<class_bool>` | :ref:`is_item_radio_checkable<class_PopupMenu_method_is_item_radio_checkable>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  130. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  131. | :ref:`bool<class_bool>` | :ref:`is_item_separator<class_PopupMenu_method_is_item_separator>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  132. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  133. | :ref:`bool<class_bool>` | :ref:`is_item_shortcut_disabled<class_PopupMenu_method_is_item_shortcut_disabled>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  134. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  135. | :ref:`bool<class_bool>` | :ref:`is_native_menu<class_PopupMenu_method_is_native_menu>`\ (\ ) |const| |
  136. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  137. | :ref:`bool<class_bool>` | :ref:`is_system_menu<class_PopupMenu_method_is_system_menu>`\ (\ ) |const| |
  138. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  139. | |void| | :ref:`remove_item<class_PopupMenu_method_remove_item>`\ (\ index\: :ref:`int<class_int>`\ ) |
  140. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  141. | |void| | :ref:`scroll_to_item<class_PopupMenu_method_scroll_to_item>`\ (\ index\: :ref:`int<class_int>`\ ) |
  142. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  143. | |void| | :ref:`set_focused_item<class_PopupMenu_method_set_focused_item>`\ (\ index\: :ref:`int<class_int>`\ ) |
  144. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  145. | |void| | :ref:`set_item_accelerator<class_PopupMenu_method_set_item_accelerator>`\ (\ index\: :ref:`int<class_int>`, accel\: :ref:`Key<enum_@GlobalScope_Key>`\ ) |
  146. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  147. | |void| | :ref:`set_item_as_checkable<class_PopupMenu_method_set_item_as_checkable>`\ (\ index\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) |
  148. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  149. | |void| | :ref:`set_item_as_radio_checkable<class_PopupMenu_method_set_item_as_radio_checkable>`\ (\ index\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) |
  150. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  151. | |void| | :ref:`set_item_as_separator<class_PopupMenu_method_set_item_as_separator>`\ (\ index\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) |
  152. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  153. | |void| | :ref:`set_item_checked<class_PopupMenu_method_set_item_checked>`\ (\ index\: :ref:`int<class_int>`, checked\: :ref:`bool<class_bool>`\ ) |
  154. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  155. | |void| | :ref:`set_item_disabled<class_PopupMenu_method_set_item_disabled>`\ (\ index\: :ref:`int<class_int>`, disabled\: :ref:`bool<class_bool>`\ ) |
  156. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  157. | |void| | :ref:`set_item_icon<class_PopupMenu_method_set_item_icon>`\ (\ index\: :ref:`int<class_int>`, icon\: :ref:`Texture2D<class_Texture2D>`\ ) |
  158. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  159. | |void| | :ref:`set_item_icon_max_width<class_PopupMenu_method_set_item_icon_max_width>`\ (\ index\: :ref:`int<class_int>`, width\: :ref:`int<class_int>`\ ) |
  160. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  161. | |void| | :ref:`set_item_icon_modulate<class_PopupMenu_method_set_item_icon_modulate>`\ (\ index\: :ref:`int<class_int>`, modulate\: :ref:`Color<class_Color>`\ ) |
  162. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  163. | |void| | :ref:`set_item_id<class_PopupMenu_method_set_item_id>`\ (\ index\: :ref:`int<class_int>`, id\: :ref:`int<class_int>`\ ) |
  164. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  165. | |void| | :ref:`set_item_indent<class_PopupMenu_method_set_item_indent>`\ (\ index\: :ref:`int<class_int>`, indent\: :ref:`int<class_int>`\ ) |
  166. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  167. | |void| | :ref:`set_item_language<class_PopupMenu_method_set_item_language>`\ (\ index\: :ref:`int<class_int>`, language\: :ref:`String<class_String>`\ ) |
  168. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  169. | |void| | :ref:`set_item_metadata<class_PopupMenu_method_set_item_metadata>`\ (\ index\: :ref:`int<class_int>`, metadata\: :ref:`Variant<class_Variant>`\ ) |
  170. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  171. | |void| | :ref:`set_item_multistate<class_PopupMenu_method_set_item_multistate>`\ (\ index\: :ref:`int<class_int>`, state\: :ref:`int<class_int>`\ ) |
  172. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  173. | |void| | :ref:`set_item_multistate_max<class_PopupMenu_method_set_item_multistate_max>`\ (\ index\: :ref:`int<class_int>`, max_states\: :ref:`int<class_int>`\ ) |
  174. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  175. | |void| | :ref:`set_item_shortcut<class_PopupMenu_method_set_item_shortcut>`\ (\ index\: :ref:`int<class_int>`, shortcut\: :ref:`Shortcut<class_Shortcut>`, global\: :ref:`bool<class_bool>` = false\ ) |
  176. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  177. | |void| | :ref:`set_item_shortcut_disabled<class_PopupMenu_method_set_item_shortcut_disabled>`\ (\ index\: :ref:`int<class_int>`, disabled\: :ref:`bool<class_bool>`\ ) |
  178. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  179. | |void| | :ref:`set_item_submenu<class_PopupMenu_method_set_item_submenu>`\ (\ index\: :ref:`int<class_int>`, submenu\: :ref:`String<class_String>`\ ) |
  180. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  181. | |void| | :ref:`set_item_submenu_node<class_PopupMenu_method_set_item_submenu_node>`\ (\ index\: :ref:`int<class_int>`, submenu\: :ref:`PopupMenu<class_PopupMenu>`\ ) |
  182. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  183. | |void| | :ref:`set_item_text<class_PopupMenu_method_set_item_text>`\ (\ index\: :ref:`int<class_int>`, text\: :ref:`String<class_String>`\ ) |
  184. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  185. | |void| | :ref:`set_item_text_direction<class_PopupMenu_method_set_item_text_direction>`\ (\ index\: :ref:`int<class_int>`, direction\: :ref:`TextDirection<enum_Control_TextDirection>`\ ) |
  186. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  187. | |void| | :ref:`set_item_tooltip<class_PopupMenu_method_set_item_tooltip>`\ (\ index\: :ref:`int<class_int>`, tooltip\: :ref:`String<class_String>`\ ) |
  188. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  189. | |void| | :ref:`toggle_item_checked<class_PopupMenu_method_toggle_item_checked>`\ (\ index\: :ref:`int<class_int>`\ ) |
  190. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  191. | |void| | :ref:`toggle_item_multistate<class_PopupMenu_method_toggle_item_multistate>`\ (\ index\: :ref:`int<class_int>`\ ) |
  192. +--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  193. .. rst-class:: classref-reftable-group
  194. Theme Properties
  195. ----------------
  196. .. table::
  197. :widths: auto
  198. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  199. | :ref:`Color<class_Color>` | :ref:`font_accelerator_color<class_PopupMenu_theme_color_font_accelerator_color>` | ``Color(0.7, 0.7, 0.7, 0.8)`` |
  200. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  201. | :ref:`Color<class_Color>` | :ref:`font_color<class_PopupMenu_theme_color_font_color>` | ``Color(0.875, 0.875, 0.875, 1)`` |
  202. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  203. | :ref:`Color<class_Color>` | :ref:`font_disabled_color<class_PopupMenu_theme_color_font_disabled_color>` | ``Color(0.4, 0.4, 0.4, 0.8)`` |
  204. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  205. | :ref:`Color<class_Color>` | :ref:`font_hover_color<class_PopupMenu_theme_color_font_hover_color>` | ``Color(0.875, 0.875, 0.875, 1)`` |
  206. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  207. | :ref:`Color<class_Color>` | :ref:`font_outline_color<class_PopupMenu_theme_color_font_outline_color>` | ``Color(0, 0, 0, 1)`` |
  208. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  209. | :ref:`Color<class_Color>` | :ref:`font_separator_color<class_PopupMenu_theme_color_font_separator_color>` | ``Color(0.875, 0.875, 0.875, 1)`` |
  210. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  211. | :ref:`Color<class_Color>` | :ref:`font_separator_outline_color<class_PopupMenu_theme_color_font_separator_outline_color>` | ``Color(0, 0, 0, 1)`` |
  212. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  213. | :ref:`int<class_int>` | :ref:`h_separation<class_PopupMenu_theme_constant_h_separation>` | ``4`` |
  214. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  215. | :ref:`int<class_int>` | :ref:`icon_max_width<class_PopupMenu_theme_constant_icon_max_width>` | ``0`` |
  216. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  217. | :ref:`int<class_int>` | :ref:`indent<class_PopupMenu_theme_constant_indent>` | ``10`` |
  218. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  219. | :ref:`int<class_int>` | :ref:`item_end_padding<class_PopupMenu_theme_constant_item_end_padding>` | ``2`` |
  220. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  221. | :ref:`int<class_int>` | :ref:`item_start_padding<class_PopupMenu_theme_constant_item_start_padding>` | ``2`` |
  222. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  223. | :ref:`int<class_int>` | :ref:`outline_size<class_PopupMenu_theme_constant_outline_size>` | ``0`` |
  224. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  225. | :ref:`int<class_int>` | :ref:`separator_outline_size<class_PopupMenu_theme_constant_separator_outline_size>` | ``0`` |
  226. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  227. | :ref:`int<class_int>` | :ref:`v_separation<class_PopupMenu_theme_constant_v_separation>` | ``4`` |
  228. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  229. | :ref:`Font<class_Font>` | :ref:`font<class_PopupMenu_theme_font_font>` | |
  230. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  231. | :ref:`Font<class_Font>` | :ref:`font_separator<class_PopupMenu_theme_font_font_separator>` | |
  232. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  233. | :ref:`int<class_int>` | :ref:`font_separator_size<class_PopupMenu_theme_font_size_font_separator_size>` | |
  234. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  235. | :ref:`int<class_int>` | :ref:`font_size<class_PopupMenu_theme_font_size_font_size>` | |
  236. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  237. | :ref:`Texture2D<class_Texture2D>` | :ref:`checked<class_PopupMenu_theme_icon_checked>` | |
  238. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  239. | :ref:`Texture2D<class_Texture2D>` | :ref:`checked_disabled<class_PopupMenu_theme_icon_checked_disabled>` | |
  240. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  241. | :ref:`Texture2D<class_Texture2D>` | :ref:`radio_checked<class_PopupMenu_theme_icon_radio_checked>` | |
  242. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  243. | :ref:`Texture2D<class_Texture2D>` | :ref:`radio_checked_disabled<class_PopupMenu_theme_icon_radio_checked_disabled>` | |
  244. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  245. | :ref:`Texture2D<class_Texture2D>` | :ref:`radio_unchecked<class_PopupMenu_theme_icon_radio_unchecked>` | |
  246. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  247. | :ref:`Texture2D<class_Texture2D>` | :ref:`radio_unchecked_disabled<class_PopupMenu_theme_icon_radio_unchecked_disabled>` | |
  248. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  249. | :ref:`Texture2D<class_Texture2D>` | :ref:`submenu<class_PopupMenu_theme_icon_submenu>` | |
  250. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  251. | :ref:`Texture2D<class_Texture2D>` | :ref:`submenu_mirrored<class_PopupMenu_theme_icon_submenu_mirrored>` | |
  252. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  253. | :ref:`Texture2D<class_Texture2D>` | :ref:`unchecked<class_PopupMenu_theme_icon_unchecked>` | |
  254. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  255. | :ref:`Texture2D<class_Texture2D>` | :ref:`unchecked_disabled<class_PopupMenu_theme_icon_unchecked_disabled>` | |
  256. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  257. | :ref:`StyleBox<class_StyleBox>` | :ref:`hover<class_PopupMenu_theme_style_hover>` | |
  258. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  259. | :ref:`StyleBox<class_StyleBox>` | :ref:`labeled_separator_left<class_PopupMenu_theme_style_labeled_separator_left>` | |
  260. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  261. | :ref:`StyleBox<class_StyleBox>` | :ref:`labeled_separator_right<class_PopupMenu_theme_style_labeled_separator_right>` | |
  262. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  263. | :ref:`StyleBox<class_StyleBox>` | :ref:`panel<class_PopupMenu_theme_style_panel>` | |
  264. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  265. | :ref:`StyleBox<class_StyleBox>` | :ref:`separator<class_PopupMenu_theme_style_separator>` | |
  266. +-----------------------------------+-----------------------------------------------------------------------------------------------+-----------------------------------+
  267. .. rst-class:: classref-section-separator
  268. ----
  269. .. rst-class:: classref-descriptions-group
  270. Signals
  271. -------
  272. .. _class_PopupMenu_signal_id_focused:
  273. .. rst-class:: classref-signal
  274. **id_focused**\ (\ id\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_signal_id_focused>`
  275. Emitted when the user navigated to an item of some ``id`` using the :ref:`ProjectSettings.input/ui_up<class_ProjectSettings_property_input/ui_up>` or :ref:`ProjectSettings.input/ui_down<class_ProjectSettings_property_input/ui_down>` input action.
  276. .. rst-class:: classref-item-separator
  277. ----
  278. .. _class_PopupMenu_signal_id_pressed:
  279. .. rst-class:: classref-signal
  280. **id_pressed**\ (\ id\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_signal_id_pressed>`
  281. Emitted when an item of some ``id`` is pressed or its accelerator is activated.
  282. \ **Note:** If ``id`` is negative (either explicitly or due to overflow), this will return the corresponding index instead.
  283. .. rst-class:: classref-item-separator
  284. ----
  285. .. _class_PopupMenu_signal_index_pressed:
  286. .. rst-class:: classref-signal
  287. **index_pressed**\ (\ index\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_signal_index_pressed>`
  288. Emitted when an item of some ``index`` is pressed or its accelerator is activated.
  289. .. rst-class:: classref-item-separator
  290. ----
  291. .. _class_PopupMenu_signal_menu_changed:
  292. .. rst-class:: classref-signal
  293. **menu_changed**\ (\ ) :ref:`๐Ÿ”—<class_PopupMenu_signal_menu_changed>`
  294. Emitted when any item is added, modified or removed.
  295. .. rst-class:: classref-section-separator
  296. ----
  297. .. rst-class:: classref-descriptions-group
  298. Property Descriptions
  299. ---------------------
  300. .. _class_PopupMenu_property_allow_search:
  301. .. rst-class:: classref-property
  302. :ref:`bool<class_bool>` **allow_search** = ``true`` :ref:`๐Ÿ”—<class_PopupMenu_property_allow_search>`
  303. .. rst-class:: classref-property-setget
  304. - |void| **set_allow_search**\ (\ value\: :ref:`bool<class_bool>`\ )
  305. - :ref:`bool<class_bool>` **get_allow_search**\ (\ )
  306. If ``true``, allows navigating **PopupMenu** with letter keys.
  307. .. rst-class:: classref-item-separator
  308. ----
  309. .. _class_PopupMenu_property_hide_on_checkable_item_selection:
  310. .. rst-class:: classref-property
  311. :ref:`bool<class_bool>` **hide_on_checkable_item_selection** = ``true`` :ref:`๐Ÿ”—<class_PopupMenu_property_hide_on_checkable_item_selection>`
  312. .. rst-class:: classref-property-setget
  313. - |void| **set_hide_on_checkable_item_selection**\ (\ value\: :ref:`bool<class_bool>`\ )
  314. - :ref:`bool<class_bool>` **is_hide_on_checkable_item_selection**\ (\ )
  315. If ``true``, hides the **PopupMenu** when a checkbox or radio button is selected.
  316. .. rst-class:: classref-item-separator
  317. ----
  318. .. _class_PopupMenu_property_hide_on_item_selection:
  319. .. rst-class:: classref-property
  320. :ref:`bool<class_bool>` **hide_on_item_selection** = ``true`` :ref:`๐Ÿ”—<class_PopupMenu_property_hide_on_item_selection>`
  321. .. rst-class:: classref-property-setget
  322. - |void| **set_hide_on_item_selection**\ (\ value\: :ref:`bool<class_bool>`\ )
  323. - :ref:`bool<class_bool>` **is_hide_on_item_selection**\ (\ )
  324. If ``true``, hides the **PopupMenu** when an item is selected.
  325. .. rst-class:: classref-item-separator
  326. ----
  327. .. _class_PopupMenu_property_hide_on_state_item_selection:
  328. .. rst-class:: classref-property
  329. :ref:`bool<class_bool>` **hide_on_state_item_selection** = ``false`` :ref:`๐Ÿ”—<class_PopupMenu_property_hide_on_state_item_selection>`
  330. .. rst-class:: classref-property-setget
  331. - |void| **set_hide_on_state_item_selection**\ (\ value\: :ref:`bool<class_bool>`\ )
  332. - :ref:`bool<class_bool>` **is_hide_on_state_item_selection**\ (\ )
  333. If ``true``, hides the **PopupMenu** when a state item is selected.
  334. .. rst-class:: classref-item-separator
  335. ----
  336. .. _class_PopupMenu_property_item_count:
  337. .. rst-class:: classref-property
  338. :ref:`int<class_int>` **item_count** = ``0`` :ref:`๐Ÿ”—<class_PopupMenu_property_item_count>`
  339. .. rst-class:: classref-property-setget
  340. - |void| **set_item_count**\ (\ value\: :ref:`int<class_int>`\ )
  341. - :ref:`int<class_int>` **get_item_count**\ (\ )
  342. The number of items currently in the list.
  343. .. rst-class:: classref-item-separator
  344. ----
  345. .. _class_PopupMenu_property_prefer_native_menu:
  346. .. rst-class:: classref-property
  347. :ref:`bool<class_bool>` **prefer_native_menu** = ``false`` :ref:`๐Ÿ”—<class_PopupMenu_property_prefer_native_menu>`
  348. .. rst-class:: classref-property-setget
  349. - |void| **set_prefer_native_menu**\ (\ value\: :ref:`bool<class_bool>`\ )
  350. - :ref:`bool<class_bool>` **is_prefer_native_menu**\ (\ )
  351. If ``true``, :ref:`MenuBar<class_MenuBar>` will use native menu when supported.
  352. \ **Note:** If **PopupMenu** is linked to :ref:`StatusIndicator<class_StatusIndicator>`, :ref:`MenuBar<class_MenuBar>`, or another **PopupMenu** item it can use native menu regardless of this property, use :ref:`is_native_menu()<class_PopupMenu_method_is_native_menu>` to check it.
  353. .. rst-class:: classref-item-separator
  354. ----
  355. .. _class_PopupMenu_property_submenu_popup_delay:
  356. .. rst-class:: classref-property
  357. :ref:`float<class_float>` **submenu_popup_delay** = ``0.3`` :ref:`๐Ÿ”—<class_PopupMenu_property_submenu_popup_delay>`
  358. .. rst-class:: classref-property-setget
  359. - |void| **set_submenu_popup_delay**\ (\ value\: :ref:`float<class_float>`\ )
  360. - :ref:`float<class_float>` **get_submenu_popup_delay**\ (\ )
  361. Sets the delay time in seconds for the submenu item to popup on mouse hovering. If the popup menu is added as a child of another (acting as a submenu), it will inherit the delay time of the parent menu item.
  362. .. rst-class:: classref-item-separator
  363. ----
  364. .. _class_PopupMenu_property_system_menu_id:
  365. .. rst-class:: classref-property
  366. :ref:`SystemMenus<enum_NativeMenu_SystemMenus>` **system_menu_id** = ``0`` :ref:`๐Ÿ”—<class_PopupMenu_property_system_menu_id>`
  367. .. rst-class:: classref-property-setget
  368. - |void| **set_system_menu**\ (\ value\: :ref:`SystemMenus<enum_NativeMenu_SystemMenus>`\ )
  369. - :ref:`SystemMenus<enum_NativeMenu_SystemMenus>` **get_system_menu**\ (\ )
  370. If set to one of the values of :ref:`SystemMenus<enum_NativeMenu_SystemMenus>`, this **PopupMenu** is bound to the special system menu. Only one **PopupMenu** can be bound to each special menu at a time.
  371. .. rst-class:: classref-section-separator
  372. ----
  373. .. rst-class:: classref-descriptions-group
  374. Method Descriptions
  375. -------------------
  376. .. _class_PopupMenu_method_activate_item_by_event:
  377. .. rst-class:: classref-method
  378. :ref:`bool<class_bool>` **activate_item_by_event**\ (\ event\: :ref:`InputEvent<class_InputEvent>`, for_global_only\: :ref:`bool<class_bool>` = false\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_activate_item_by_event>`
  379. Checks the provided ``event`` against the **PopupMenu**'s shortcuts and accelerators, and activates the first item with matching events. If ``for_global_only`` is ``true``, only shortcuts and accelerators with ``global`` set to ``true`` will be called.
  380. Returns ``true`` if an item was successfully activated.
  381. \ **Note:** Certain :ref:`Control<class_Control>`\ s, such as :ref:`MenuButton<class_MenuButton>`, will call this method automatically.
  382. .. rst-class:: classref-item-separator
  383. ----
  384. .. _class_PopupMenu_method_add_check_item:
  385. .. rst-class:: classref-method
  386. |void| **add_check_item**\ (\ label\: :ref:`String<class_String>`, id\: :ref:`int<class_int>` = -1, accel\: :ref:`Key<enum_@GlobalScope_Key>` = 0\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_add_check_item>`
  387. Adds a new checkable item with text ``label``.
  388. An ``id`` can optionally be provided, as well as an accelerator (``accel``). If no ``id`` is provided, one will be created from the index. If no ``accel`` is provided, then the default value of 0 (corresponding to :ref:`@GlobalScope.KEY_NONE<class_@GlobalScope_constant_KEY_NONE>`) will be assigned to the item (which means it won't have any accelerator). See :ref:`get_item_accelerator()<class_PopupMenu_method_get_item_accelerator>` for more info on accelerators.
  389. \ **Note:** Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See :ref:`set_item_checked()<class_PopupMenu_method_set_item_checked>` for more info on how to control it.
  390. .. rst-class:: classref-item-separator
  391. ----
  392. .. _class_PopupMenu_method_add_check_shortcut:
  393. .. rst-class:: classref-method
  394. |void| **add_check_shortcut**\ (\ shortcut\: :ref:`Shortcut<class_Shortcut>`, id\: :ref:`int<class_int>` = -1, global\: :ref:`bool<class_bool>` = false\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_add_check_shortcut>`
  395. Adds a new checkable item and assigns the specified :ref:`Shortcut<class_Shortcut>` to it. Sets the label of the checkbox to the :ref:`Shortcut<class_Shortcut>`'s name.
  396. An ``id`` can optionally be provided. If no ``id`` is provided, one will be created from the index.
  397. \ **Note:** Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See :ref:`set_item_checked()<class_PopupMenu_method_set_item_checked>` for more info on how to control it.
  398. .. rst-class:: classref-item-separator
  399. ----
  400. .. _class_PopupMenu_method_add_icon_check_item:
  401. .. rst-class:: classref-method
  402. |void| **add_icon_check_item**\ (\ texture\: :ref:`Texture2D<class_Texture2D>`, label\: :ref:`String<class_String>`, id\: :ref:`int<class_int>` = -1, accel\: :ref:`Key<enum_@GlobalScope_Key>` = 0\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_add_icon_check_item>`
  403. Adds a new checkable item with text ``label`` and icon ``texture``.
  404. An ``id`` can optionally be provided, as well as an accelerator (``accel``). If no ``id`` is provided, one will be created from the index. If no ``accel`` is provided, then the default value of 0 (corresponding to :ref:`@GlobalScope.KEY_NONE<class_@GlobalScope_constant_KEY_NONE>`) will be assigned to the item (which means it won't have any accelerator). See :ref:`get_item_accelerator()<class_PopupMenu_method_get_item_accelerator>` for more info on accelerators.
  405. \ **Note:** Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See :ref:`set_item_checked()<class_PopupMenu_method_set_item_checked>` for more info on how to control it.
  406. .. rst-class:: classref-item-separator
  407. ----
  408. .. _class_PopupMenu_method_add_icon_check_shortcut:
  409. .. rst-class:: classref-method
  410. |void| **add_icon_check_shortcut**\ (\ texture\: :ref:`Texture2D<class_Texture2D>`, shortcut\: :ref:`Shortcut<class_Shortcut>`, id\: :ref:`int<class_int>` = -1, global\: :ref:`bool<class_bool>` = false\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_add_icon_check_shortcut>`
  411. Adds a new checkable item and assigns the specified :ref:`Shortcut<class_Shortcut>` and icon ``texture`` to it. Sets the label of the checkbox to the :ref:`Shortcut<class_Shortcut>`'s name.
  412. An ``id`` can optionally be provided. If no ``id`` is provided, one will be created from the index.
  413. \ **Note:** Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See :ref:`set_item_checked()<class_PopupMenu_method_set_item_checked>` for more info on how to control it.
  414. .. rst-class:: classref-item-separator
  415. ----
  416. .. _class_PopupMenu_method_add_icon_item:
  417. .. rst-class:: classref-method
  418. |void| **add_icon_item**\ (\ texture\: :ref:`Texture2D<class_Texture2D>`, label\: :ref:`String<class_String>`, id\: :ref:`int<class_int>` = -1, accel\: :ref:`Key<enum_@GlobalScope_Key>` = 0\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_add_icon_item>`
  419. Adds a new item with text ``label`` and icon ``texture``.
  420. An ``id`` can optionally be provided, as well as an accelerator (``accel``). If no ``id`` is provided, one will be created from the index. If no ``accel`` is provided, then the default value of 0 (corresponding to :ref:`@GlobalScope.KEY_NONE<class_@GlobalScope_constant_KEY_NONE>`) will be assigned to the item (which means it won't have any accelerator). See :ref:`get_item_accelerator()<class_PopupMenu_method_get_item_accelerator>` for more info on accelerators.
  421. .. rst-class:: classref-item-separator
  422. ----
  423. .. _class_PopupMenu_method_add_icon_radio_check_item:
  424. .. rst-class:: classref-method
  425. |void| **add_icon_radio_check_item**\ (\ texture\: :ref:`Texture2D<class_Texture2D>`, label\: :ref:`String<class_String>`, id\: :ref:`int<class_int>` = -1, accel\: :ref:`Key<enum_@GlobalScope_Key>` = 0\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_add_icon_radio_check_item>`
  426. Same as :ref:`add_icon_check_item()<class_PopupMenu_method_add_icon_check_item>`, but uses a radio check button.
  427. .. rst-class:: classref-item-separator
  428. ----
  429. .. _class_PopupMenu_method_add_icon_radio_check_shortcut:
  430. .. rst-class:: classref-method
  431. |void| **add_icon_radio_check_shortcut**\ (\ texture\: :ref:`Texture2D<class_Texture2D>`, shortcut\: :ref:`Shortcut<class_Shortcut>`, id\: :ref:`int<class_int>` = -1, global\: :ref:`bool<class_bool>` = false\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_add_icon_radio_check_shortcut>`
  432. Same as :ref:`add_icon_check_shortcut()<class_PopupMenu_method_add_icon_check_shortcut>`, but uses a radio check button.
  433. .. rst-class:: classref-item-separator
  434. ----
  435. .. _class_PopupMenu_method_add_icon_shortcut:
  436. .. rst-class:: classref-method
  437. |void| **add_icon_shortcut**\ (\ texture\: :ref:`Texture2D<class_Texture2D>`, shortcut\: :ref:`Shortcut<class_Shortcut>`, id\: :ref:`int<class_int>` = -1, global\: :ref:`bool<class_bool>` = false, allow_echo\: :ref:`bool<class_bool>` = false\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_add_icon_shortcut>`
  438. Adds a new item and assigns the specified :ref:`Shortcut<class_Shortcut>` and icon ``texture`` to it. Sets the label of the checkbox to the :ref:`Shortcut<class_Shortcut>`'s name.
  439. An ``id`` can optionally be provided. If no ``id`` is provided, one will be created from the index.
  440. If ``allow_echo`` is ``true``, the shortcut can be activated with echo events.
  441. .. rst-class:: classref-item-separator
  442. ----
  443. .. _class_PopupMenu_method_add_item:
  444. .. rst-class:: classref-method
  445. |void| **add_item**\ (\ label\: :ref:`String<class_String>`, id\: :ref:`int<class_int>` = -1, accel\: :ref:`Key<enum_@GlobalScope_Key>` = 0\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_add_item>`
  446. Adds a new item with text ``label``.
  447. An ``id`` can optionally be provided, as well as an accelerator (``accel``). If no ``id`` is provided, one will be created from the index. If no ``accel`` is provided, then the default value of 0 (corresponding to :ref:`@GlobalScope.KEY_NONE<class_@GlobalScope_constant_KEY_NONE>`) will be assigned to the item (which means it won't have any accelerator). See :ref:`get_item_accelerator()<class_PopupMenu_method_get_item_accelerator>` for more info on accelerators.
  448. \ **Note:** The provided ``id`` is used only in :ref:`id_pressed<class_PopupMenu_signal_id_pressed>` and :ref:`id_focused<class_PopupMenu_signal_id_focused>` signals. It's not related to the ``index`` arguments in e.g. :ref:`set_item_checked()<class_PopupMenu_method_set_item_checked>`.
  449. .. rst-class:: classref-item-separator
  450. ----
  451. .. _class_PopupMenu_method_add_multistate_item:
  452. .. rst-class:: classref-method
  453. |void| **add_multistate_item**\ (\ label\: :ref:`String<class_String>`, max_states\: :ref:`int<class_int>`, default_state\: :ref:`int<class_int>` = 0, id\: :ref:`int<class_int>` = -1, accel\: :ref:`Key<enum_@GlobalScope_Key>` = 0\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_add_multistate_item>`
  454. Adds a new multistate item with text ``label``.
  455. Contrarily to normal binary items, multistate items can have more than two states, as defined by ``max_states``. The default value is defined by ``default_state``.
  456. An ``id`` can optionally be provided, as well as an accelerator (``accel``). If no ``id`` is provided, one will be created from the index. If no ``accel`` is provided, then the default value of 0 (corresponding to :ref:`@GlobalScope.KEY_NONE<class_@GlobalScope_constant_KEY_NONE>`) will be assigned to the item (which means it won't have any accelerator). See :ref:`get_item_accelerator()<class_PopupMenu_method_get_item_accelerator>` for more info on accelerators.
  457. ::
  458. func _ready():
  459. add_multistate_item("Item", 3, 0)
  460. index_pressed.connect(func(index: int):
  461. toggle_item_multistate(index)
  462. match get_item_multistate(index):
  463. 0:
  464. print("First state")
  465. 1:
  466. print("Second state")
  467. 2:
  468. print("Third state")
  469. )
  470. \ **Note:** Multistate items don't update their state automatically and must be done manually. See :ref:`toggle_item_multistate()<class_PopupMenu_method_toggle_item_multistate>`, :ref:`set_item_multistate()<class_PopupMenu_method_set_item_multistate>` and :ref:`get_item_multistate()<class_PopupMenu_method_get_item_multistate>` for more info on how to control it.
  471. .. rst-class:: classref-item-separator
  472. ----
  473. .. _class_PopupMenu_method_add_radio_check_item:
  474. .. rst-class:: classref-method
  475. |void| **add_radio_check_item**\ (\ label\: :ref:`String<class_String>`, id\: :ref:`int<class_int>` = -1, accel\: :ref:`Key<enum_@GlobalScope_Key>` = 0\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_add_radio_check_item>`
  476. Adds a new radio check button with text ``label``.
  477. An ``id`` can optionally be provided, as well as an accelerator (``accel``). If no ``id`` is provided, one will be created from the index. If no ``accel`` is provided, then the default value of 0 (corresponding to :ref:`@GlobalScope.KEY_NONE<class_@GlobalScope_constant_KEY_NONE>`) will be assigned to the item (which means it won't have any accelerator). See :ref:`get_item_accelerator()<class_PopupMenu_method_get_item_accelerator>` for more info on accelerators.
  478. \ **Note:** Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See :ref:`set_item_checked()<class_PopupMenu_method_set_item_checked>` for more info on how to control it.
  479. .. rst-class:: classref-item-separator
  480. ----
  481. .. _class_PopupMenu_method_add_radio_check_shortcut:
  482. .. rst-class:: classref-method
  483. |void| **add_radio_check_shortcut**\ (\ shortcut\: :ref:`Shortcut<class_Shortcut>`, id\: :ref:`int<class_int>` = -1, global\: :ref:`bool<class_bool>` = false\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_add_radio_check_shortcut>`
  484. Adds a new radio check button and assigns a :ref:`Shortcut<class_Shortcut>` to it. Sets the label of the checkbox to the :ref:`Shortcut<class_Shortcut>`'s name.
  485. An ``id`` can optionally be provided. If no ``id`` is provided, one will be created from the index.
  486. \ **Note:** Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See :ref:`set_item_checked()<class_PopupMenu_method_set_item_checked>` for more info on how to control it.
  487. .. rst-class:: classref-item-separator
  488. ----
  489. .. _class_PopupMenu_method_add_separator:
  490. .. rst-class:: classref-method
  491. |void| **add_separator**\ (\ label\: :ref:`String<class_String>` = "", id\: :ref:`int<class_int>` = -1\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_add_separator>`
  492. Adds a separator between items. Separators also occupy an index, which you can set by using the ``id`` parameter.
  493. A ``label`` can optionally be provided, which will appear at the center of the separator.
  494. .. rst-class:: classref-item-separator
  495. ----
  496. .. _class_PopupMenu_method_add_shortcut:
  497. .. rst-class:: classref-method
  498. |void| **add_shortcut**\ (\ shortcut\: :ref:`Shortcut<class_Shortcut>`, id\: :ref:`int<class_int>` = -1, global\: :ref:`bool<class_bool>` = false, allow_echo\: :ref:`bool<class_bool>` = false\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_add_shortcut>`
  499. Adds a :ref:`Shortcut<class_Shortcut>`.
  500. An ``id`` can optionally be provided. If no ``id`` is provided, one will be created from the index.
  501. If ``allow_echo`` is ``true``, the shortcut can be activated with echo events.
  502. .. rst-class:: classref-item-separator
  503. ----
  504. .. _class_PopupMenu_method_add_submenu_item:
  505. .. rst-class:: classref-method
  506. |void| **add_submenu_item**\ (\ label\: :ref:`String<class_String>`, submenu\: :ref:`String<class_String>`, id\: :ref:`int<class_int>` = -1\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_add_submenu_item>`
  507. **Deprecated:** Prefer using :ref:`add_submenu_node_item()<class_PopupMenu_method_add_submenu_node_item>` instead.
  508. Adds an item that will act as a submenu of the parent **PopupMenu** node when clicked. The ``submenu`` argument must be the name of an existing **PopupMenu** that has been added as a child to this node. This submenu will be shown when the item is clicked, hovered for long enough, or activated using the ``ui_select`` or ``ui_right`` input actions.
  509. An ``id`` can optionally be provided. If no ``id`` is provided, one will be created from the index.
  510. .. rst-class:: classref-item-separator
  511. ----
  512. .. _class_PopupMenu_method_add_submenu_node_item:
  513. .. rst-class:: classref-method
  514. |void| **add_submenu_node_item**\ (\ label\: :ref:`String<class_String>`, submenu\: :ref:`PopupMenu<class_PopupMenu>`, id\: :ref:`int<class_int>` = -1\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_add_submenu_node_item>`
  515. Adds an item that will act as a submenu of the parent **PopupMenu** node when clicked. This submenu will be shown when the item is clicked, hovered for long enough, or activated using the ``ui_select`` or ``ui_right`` input actions.
  516. \ ``submenu`` must be either child of this **PopupMenu** or has no parent node (in which case it will be automatically added as a child). If the ``submenu`` popup has another parent, this method will fail.
  517. An ``id`` can optionally be provided. If no ``id`` is provided, one will be created from the index.
  518. .. rst-class:: classref-item-separator
  519. ----
  520. .. _class_PopupMenu_method_clear:
  521. .. rst-class:: classref-method
  522. |void| **clear**\ (\ free_submenus\: :ref:`bool<class_bool>` = false\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_clear>`
  523. Removes all items from the **PopupMenu**. If ``free_submenus`` is ``true``, the submenu nodes are automatically freed.
  524. .. rst-class:: classref-item-separator
  525. ----
  526. .. _class_PopupMenu_method_get_focused_item:
  527. .. rst-class:: classref-method
  528. :ref:`int<class_int>` **get_focused_item**\ (\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_get_focused_item>`
  529. Returns the index of the currently focused item. Returns ``-1`` if no item is focused.
  530. .. rst-class:: classref-item-separator
  531. ----
  532. .. _class_PopupMenu_method_get_item_accelerator:
  533. .. rst-class:: classref-method
  534. :ref:`Key<enum_@GlobalScope_Key>` **get_item_accelerator**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_get_item_accelerator>`
  535. Returns the accelerator of the item at the given ``index``. An accelerator is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The return value is an integer which is generally a combination of :ref:`KeyModifierMask<enum_@GlobalScope_KeyModifierMask>`\ s and :ref:`Key<enum_@GlobalScope_Key>`\ s using bitwise OR such as ``KEY_MASK_CTRL | KEY_A`` (:kbd:`Ctrl + A`). If no accelerator is defined for the specified ``index``, :ref:`get_item_accelerator()<class_PopupMenu_method_get_item_accelerator>` returns ``0`` (corresponding to :ref:`@GlobalScope.KEY_NONE<class_@GlobalScope_constant_KEY_NONE>`).
  536. .. rst-class:: classref-item-separator
  537. ----
  538. .. _class_PopupMenu_method_get_item_icon:
  539. .. rst-class:: classref-method
  540. :ref:`Texture2D<class_Texture2D>` **get_item_icon**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_get_item_icon>`
  541. Returns the icon of the item at the given ``index``.
  542. .. rst-class:: classref-item-separator
  543. ----
  544. .. _class_PopupMenu_method_get_item_icon_max_width:
  545. .. rst-class:: classref-method
  546. :ref:`int<class_int>` **get_item_icon_max_width**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_get_item_icon_max_width>`
  547. Returns the maximum allowed width of the icon for the item at the given ``index``.
  548. .. rst-class:: classref-item-separator
  549. ----
  550. .. _class_PopupMenu_method_get_item_icon_modulate:
  551. .. rst-class:: classref-method
  552. :ref:`Color<class_Color>` **get_item_icon_modulate**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_get_item_icon_modulate>`
  553. Returns a :ref:`Color<class_Color>` modulating the item's icon at the given ``index``.
  554. .. rst-class:: classref-item-separator
  555. ----
  556. .. _class_PopupMenu_method_get_item_id:
  557. .. rst-class:: classref-method
  558. :ref:`int<class_int>` **get_item_id**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_get_item_id>`
  559. Returns the ID of the item at the given ``index``. ``id`` can be manually assigned, while index can not.
  560. .. rst-class:: classref-item-separator
  561. ----
  562. .. _class_PopupMenu_method_get_item_indent:
  563. .. rst-class:: classref-method
  564. :ref:`int<class_int>` **get_item_indent**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_get_item_indent>`
  565. Returns the horizontal offset of the item at the given ``index``.
  566. .. rst-class:: classref-item-separator
  567. ----
  568. .. _class_PopupMenu_method_get_item_index:
  569. .. rst-class:: classref-method
  570. :ref:`int<class_int>` **get_item_index**\ (\ id\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_get_item_index>`
  571. Returns the index of the item containing the specified ``id``. Index is automatically assigned to each item by the engine and can not be set manually.
  572. .. rst-class:: classref-item-separator
  573. ----
  574. .. _class_PopupMenu_method_get_item_language:
  575. .. rst-class:: classref-method
  576. :ref:`String<class_String>` **get_item_language**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_get_item_language>`
  577. Returns item's text language code.
  578. .. rst-class:: classref-item-separator
  579. ----
  580. .. _class_PopupMenu_method_get_item_metadata:
  581. .. rst-class:: classref-method
  582. :ref:`Variant<class_Variant>` **get_item_metadata**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_get_item_metadata>`
  583. Returns the metadata of the specified item, which might be of any type. You can set it with :ref:`set_item_metadata()<class_PopupMenu_method_set_item_metadata>`, which provides a simple way of assigning context data to items.
  584. .. rst-class:: classref-item-separator
  585. ----
  586. .. _class_PopupMenu_method_get_item_multistate:
  587. .. rst-class:: classref-method
  588. :ref:`int<class_int>` **get_item_multistate**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_get_item_multistate>`
  589. Returns the state of the item at the given ``index``.
  590. .. rst-class:: classref-item-separator
  591. ----
  592. .. _class_PopupMenu_method_get_item_multistate_max:
  593. .. rst-class:: classref-method
  594. :ref:`int<class_int>` **get_item_multistate_max**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_get_item_multistate_max>`
  595. Returns the max states of the item at the given ``index``.
  596. .. rst-class:: classref-item-separator
  597. ----
  598. .. _class_PopupMenu_method_get_item_shortcut:
  599. .. rst-class:: classref-method
  600. :ref:`Shortcut<class_Shortcut>` **get_item_shortcut**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_get_item_shortcut>`
  601. Returns the :ref:`Shortcut<class_Shortcut>` associated with the item at the given ``index``.
  602. .. rst-class:: classref-item-separator
  603. ----
  604. .. _class_PopupMenu_method_get_item_submenu:
  605. .. rst-class:: classref-method
  606. :ref:`String<class_String>` **get_item_submenu**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_get_item_submenu>`
  607. **Deprecated:** Prefer using :ref:`get_item_submenu_node()<class_PopupMenu_method_get_item_submenu_node>` instead.
  608. Returns the submenu name of the item at the given ``index``. See :ref:`add_submenu_item()<class_PopupMenu_method_add_submenu_item>` for more info on how to add a submenu.
  609. .. rst-class:: classref-item-separator
  610. ----
  611. .. _class_PopupMenu_method_get_item_submenu_node:
  612. .. rst-class:: classref-method
  613. :ref:`PopupMenu<class_PopupMenu>` **get_item_submenu_node**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_get_item_submenu_node>`
  614. Returns the submenu of the item at the given ``index``, or ``null`` if no submenu was added. See :ref:`add_submenu_node_item()<class_PopupMenu_method_add_submenu_node_item>` for more info on how to add a submenu.
  615. .. rst-class:: classref-item-separator
  616. ----
  617. .. _class_PopupMenu_method_get_item_text:
  618. .. rst-class:: classref-method
  619. :ref:`String<class_String>` **get_item_text**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_get_item_text>`
  620. Returns the text of the item at the given ``index``.
  621. .. rst-class:: classref-item-separator
  622. ----
  623. .. _class_PopupMenu_method_get_item_text_direction:
  624. .. rst-class:: classref-method
  625. :ref:`TextDirection<enum_Control_TextDirection>` **get_item_text_direction**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_get_item_text_direction>`
  626. Returns item's text base writing direction.
  627. .. rst-class:: classref-item-separator
  628. ----
  629. .. _class_PopupMenu_method_get_item_tooltip:
  630. .. rst-class:: classref-method
  631. :ref:`String<class_String>` **get_item_tooltip**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_get_item_tooltip>`
  632. Returns the tooltip associated with the item at the given ``index``.
  633. .. rst-class:: classref-item-separator
  634. ----
  635. .. _class_PopupMenu_method_is_item_checkable:
  636. .. rst-class:: classref-method
  637. :ref:`bool<class_bool>` **is_item_checkable**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_is_item_checkable>`
  638. Returns ``true`` if the item at the given ``index`` is checkable in some way, i.e. if it has a checkbox or radio button.
  639. \ **Note:** Checkable items just display a checkmark or radio button, but don't have any built-in checking behavior and must be checked/unchecked manually.
  640. .. rst-class:: classref-item-separator
  641. ----
  642. .. _class_PopupMenu_method_is_item_checked:
  643. .. rst-class:: classref-method
  644. :ref:`bool<class_bool>` **is_item_checked**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_is_item_checked>`
  645. Returns ``true`` if the item at the given ``index`` is checked.
  646. .. rst-class:: classref-item-separator
  647. ----
  648. .. _class_PopupMenu_method_is_item_disabled:
  649. .. rst-class:: classref-method
  650. :ref:`bool<class_bool>` **is_item_disabled**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_is_item_disabled>`
  651. Returns ``true`` if the item at the given ``index`` is disabled. When it is disabled it can't be selected, or its action invoked.
  652. See :ref:`set_item_disabled()<class_PopupMenu_method_set_item_disabled>` for more info on how to disable an item.
  653. .. rst-class:: classref-item-separator
  654. ----
  655. .. _class_PopupMenu_method_is_item_radio_checkable:
  656. .. rst-class:: classref-method
  657. :ref:`bool<class_bool>` **is_item_radio_checkable**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_is_item_radio_checkable>`
  658. Returns ``true`` if the item at the given ``index`` has radio button-style checkability.
  659. \ **Note:** This is purely cosmetic; you must add the logic for checking/unchecking items in radio groups.
  660. .. rst-class:: classref-item-separator
  661. ----
  662. .. _class_PopupMenu_method_is_item_separator:
  663. .. rst-class:: classref-method
  664. :ref:`bool<class_bool>` **is_item_separator**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_is_item_separator>`
  665. Returns ``true`` if the item is a separator. If it is, it will be displayed as a line. See :ref:`add_separator()<class_PopupMenu_method_add_separator>` for more info on how to add a separator.
  666. .. rst-class:: classref-item-separator
  667. ----
  668. .. _class_PopupMenu_method_is_item_shortcut_disabled:
  669. .. rst-class:: classref-method
  670. :ref:`bool<class_bool>` **is_item_shortcut_disabled**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_is_item_shortcut_disabled>`
  671. Returns ``true`` if the specified item's shortcut is disabled.
  672. .. rst-class:: classref-item-separator
  673. ----
  674. .. _class_PopupMenu_method_is_native_menu:
  675. .. rst-class:: classref-method
  676. :ref:`bool<class_bool>` **is_native_menu**\ (\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_is_native_menu>`
  677. Returns ``true`` if the system native menu is supported and currently used by this **PopupMenu**.
  678. .. rst-class:: classref-item-separator
  679. ----
  680. .. _class_PopupMenu_method_is_system_menu:
  681. .. rst-class:: classref-method
  682. :ref:`bool<class_bool>` **is_system_menu**\ (\ ) |const| :ref:`๐Ÿ”—<class_PopupMenu_method_is_system_menu>`
  683. Returns ``true`` if the menu is bound to the special system menu.
  684. .. rst-class:: classref-item-separator
  685. ----
  686. .. _class_PopupMenu_method_remove_item:
  687. .. rst-class:: classref-method
  688. |void| **remove_item**\ (\ index\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_remove_item>`
  689. Removes the item at the given ``index`` from the menu.
  690. \ **Note:** The indices of items after the removed item will be shifted by one.
  691. .. rst-class:: classref-item-separator
  692. ----
  693. .. _class_PopupMenu_method_scroll_to_item:
  694. .. rst-class:: classref-method
  695. |void| **scroll_to_item**\ (\ index\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_scroll_to_item>`
  696. Moves the scroll view to make the item at the given ``index`` visible.
  697. .. rst-class:: classref-item-separator
  698. ----
  699. .. _class_PopupMenu_method_set_focused_item:
  700. .. rst-class:: classref-method
  701. |void| **set_focused_item**\ (\ index\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_focused_item>`
  702. Sets the currently focused item as the given ``index``.
  703. Passing ``-1`` as the index makes so that no item is focused.
  704. .. rst-class:: classref-item-separator
  705. ----
  706. .. _class_PopupMenu_method_set_item_accelerator:
  707. .. rst-class:: classref-method
  708. |void| **set_item_accelerator**\ (\ index\: :ref:`int<class_int>`, accel\: :ref:`Key<enum_@GlobalScope_Key>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_item_accelerator>`
  709. Sets the accelerator of the item at the given ``index``. An accelerator is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. ``accel`` is generally a combination of :ref:`KeyModifierMask<enum_@GlobalScope_KeyModifierMask>`\ s and :ref:`Key<enum_@GlobalScope_Key>`\ s using bitwise OR such as ``KEY_MASK_CTRL | KEY_A`` (:kbd:`Ctrl + A`).
  710. .. rst-class:: classref-item-separator
  711. ----
  712. .. _class_PopupMenu_method_set_item_as_checkable:
  713. .. rst-class:: classref-method
  714. |void| **set_item_as_checkable**\ (\ index\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_item_as_checkable>`
  715. Sets whether the item at the given ``index`` has a checkbox. If ``false``, sets the type of the item to plain text.
  716. \ **Note:** Checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually.
  717. .. rst-class:: classref-item-separator
  718. ----
  719. .. _class_PopupMenu_method_set_item_as_radio_checkable:
  720. .. rst-class:: classref-method
  721. |void| **set_item_as_radio_checkable**\ (\ index\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_item_as_radio_checkable>`
  722. Sets the type of the item at the given ``index`` to radio button. If ``false``, sets the type of the item to plain text.
  723. .. rst-class:: classref-item-separator
  724. ----
  725. .. _class_PopupMenu_method_set_item_as_separator:
  726. .. rst-class:: classref-method
  727. |void| **set_item_as_separator**\ (\ index\: :ref:`int<class_int>`, enable\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_item_as_separator>`
  728. Mark the item at the given ``index`` as a separator, which means that it would be displayed as a line. If ``false``, sets the type of the item to plain text.
  729. .. rst-class:: classref-item-separator
  730. ----
  731. .. _class_PopupMenu_method_set_item_checked:
  732. .. rst-class:: classref-method
  733. |void| **set_item_checked**\ (\ index\: :ref:`int<class_int>`, checked\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_item_checked>`
  734. Sets the checkstate status of the item at the given ``index``.
  735. .. rst-class:: classref-item-separator
  736. ----
  737. .. _class_PopupMenu_method_set_item_disabled:
  738. .. rst-class:: classref-method
  739. |void| **set_item_disabled**\ (\ index\: :ref:`int<class_int>`, disabled\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_item_disabled>`
  740. Enables/disables the item at the given ``index``. When it is disabled, it can't be selected and its action can't be invoked.
  741. .. rst-class:: classref-item-separator
  742. ----
  743. .. _class_PopupMenu_method_set_item_icon:
  744. .. rst-class:: classref-method
  745. |void| **set_item_icon**\ (\ index\: :ref:`int<class_int>`, icon\: :ref:`Texture2D<class_Texture2D>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_item_icon>`
  746. Replaces the :ref:`Texture2D<class_Texture2D>` icon of the item at the given ``index``.
  747. .. rst-class:: classref-item-separator
  748. ----
  749. .. _class_PopupMenu_method_set_item_icon_max_width:
  750. .. rst-class:: classref-method
  751. |void| **set_item_icon_max_width**\ (\ index\: :ref:`int<class_int>`, width\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_item_icon_max_width>`
  752. Sets the maximum allowed width of the icon for the item at the given ``index``. This limit is applied on top of the default size of the icon and on top of :ref:`icon_max_width<class_PopupMenu_theme_constant_icon_max_width>`. The height is adjusted according to the icon's ratio.
  753. .. rst-class:: classref-item-separator
  754. ----
  755. .. _class_PopupMenu_method_set_item_icon_modulate:
  756. .. rst-class:: classref-method
  757. |void| **set_item_icon_modulate**\ (\ index\: :ref:`int<class_int>`, modulate\: :ref:`Color<class_Color>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_item_icon_modulate>`
  758. Sets a modulating :ref:`Color<class_Color>` of the item's icon at the given ``index``.
  759. .. rst-class:: classref-item-separator
  760. ----
  761. .. _class_PopupMenu_method_set_item_id:
  762. .. rst-class:: classref-method
  763. |void| **set_item_id**\ (\ index\: :ref:`int<class_int>`, id\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_item_id>`
  764. Sets the ``id`` of the item at the given ``index``.
  765. The ``id`` is used in :ref:`id_pressed<class_PopupMenu_signal_id_pressed>` and :ref:`id_focused<class_PopupMenu_signal_id_focused>` signals.
  766. .. rst-class:: classref-item-separator
  767. ----
  768. .. _class_PopupMenu_method_set_item_indent:
  769. .. rst-class:: classref-method
  770. |void| **set_item_indent**\ (\ index\: :ref:`int<class_int>`, indent\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_item_indent>`
  771. Sets the horizontal offset of the item at the given ``index``.
  772. .. rst-class:: classref-item-separator
  773. ----
  774. .. _class_PopupMenu_method_set_item_language:
  775. .. rst-class:: classref-method
  776. |void| **set_item_language**\ (\ index\: :ref:`int<class_int>`, language\: :ref:`String<class_String>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_item_language>`
  777. Sets language code of item's text used for line-breaking and text shaping algorithms, if left empty current locale is used instead.
  778. .. rst-class:: classref-item-separator
  779. ----
  780. .. _class_PopupMenu_method_set_item_metadata:
  781. .. rst-class:: classref-method
  782. |void| **set_item_metadata**\ (\ index\: :ref:`int<class_int>`, metadata\: :ref:`Variant<class_Variant>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_item_metadata>`
  783. Sets the metadata of an item, which may be of any type. You can later get it with :ref:`get_item_metadata()<class_PopupMenu_method_get_item_metadata>`, which provides a simple way of assigning context data to items.
  784. .. rst-class:: classref-item-separator
  785. ----
  786. .. _class_PopupMenu_method_set_item_multistate:
  787. .. rst-class:: classref-method
  788. |void| **set_item_multistate**\ (\ index\: :ref:`int<class_int>`, state\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_item_multistate>`
  789. Sets the state of a multistate item. See :ref:`add_multistate_item()<class_PopupMenu_method_add_multistate_item>` for details.
  790. .. rst-class:: classref-item-separator
  791. ----
  792. .. _class_PopupMenu_method_set_item_multistate_max:
  793. .. rst-class:: classref-method
  794. |void| **set_item_multistate_max**\ (\ index\: :ref:`int<class_int>`, max_states\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_item_multistate_max>`
  795. Sets the max states of a multistate item. See :ref:`add_multistate_item()<class_PopupMenu_method_add_multistate_item>` for details.
  796. .. rst-class:: classref-item-separator
  797. ----
  798. .. _class_PopupMenu_method_set_item_shortcut:
  799. .. rst-class:: classref-method
  800. |void| **set_item_shortcut**\ (\ index\: :ref:`int<class_int>`, shortcut\: :ref:`Shortcut<class_Shortcut>`, global\: :ref:`bool<class_bool>` = false\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_item_shortcut>`
  801. Sets a :ref:`Shortcut<class_Shortcut>` for the item at the given ``index``.
  802. .. rst-class:: classref-item-separator
  803. ----
  804. .. _class_PopupMenu_method_set_item_shortcut_disabled:
  805. .. rst-class:: classref-method
  806. |void| **set_item_shortcut_disabled**\ (\ index\: :ref:`int<class_int>`, disabled\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_item_shortcut_disabled>`
  807. Disables the :ref:`Shortcut<class_Shortcut>` of the item at the given ``index``.
  808. .. rst-class:: classref-item-separator
  809. ----
  810. .. _class_PopupMenu_method_set_item_submenu:
  811. .. rst-class:: classref-method
  812. |void| **set_item_submenu**\ (\ index\: :ref:`int<class_int>`, submenu\: :ref:`String<class_String>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_item_submenu>`
  813. **Deprecated:** Prefer using :ref:`set_item_submenu_node()<class_PopupMenu_method_set_item_submenu_node>` instead.
  814. Sets the submenu of the item at the given ``index``. The submenu is the name of a child **PopupMenu** node that would be shown when the item is clicked.
  815. .. rst-class:: classref-item-separator
  816. ----
  817. .. _class_PopupMenu_method_set_item_submenu_node:
  818. .. rst-class:: classref-method
  819. |void| **set_item_submenu_node**\ (\ index\: :ref:`int<class_int>`, submenu\: :ref:`PopupMenu<class_PopupMenu>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_item_submenu_node>`
  820. Sets the submenu of the item at the given ``index``. The submenu is a **PopupMenu** node that would be shown when the item is clicked. It must either be a child of this **PopupMenu** or has no parent (in which case it will be automatically added as a child). If the ``submenu`` popup has another parent, this method will fail.
  821. .. rst-class:: classref-item-separator
  822. ----
  823. .. _class_PopupMenu_method_set_item_text:
  824. .. rst-class:: classref-method
  825. |void| **set_item_text**\ (\ index\: :ref:`int<class_int>`, text\: :ref:`String<class_String>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_item_text>`
  826. Sets the text of the item at the given ``index``.
  827. .. rst-class:: classref-item-separator
  828. ----
  829. .. _class_PopupMenu_method_set_item_text_direction:
  830. .. rst-class:: classref-method
  831. |void| **set_item_text_direction**\ (\ index\: :ref:`int<class_int>`, direction\: :ref:`TextDirection<enum_Control_TextDirection>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_item_text_direction>`
  832. Sets item's text base writing direction.
  833. .. rst-class:: classref-item-separator
  834. ----
  835. .. _class_PopupMenu_method_set_item_tooltip:
  836. .. rst-class:: classref-method
  837. |void| **set_item_tooltip**\ (\ index\: :ref:`int<class_int>`, tooltip\: :ref:`String<class_String>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_set_item_tooltip>`
  838. Sets the :ref:`String<class_String>` tooltip of the item at the given ``index``.
  839. .. rst-class:: classref-item-separator
  840. ----
  841. .. _class_PopupMenu_method_toggle_item_checked:
  842. .. rst-class:: classref-method
  843. |void| **toggle_item_checked**\ (\ index\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_toggle_item_checked>`
  844. Toggles the check state of the item at the given ``index``.
  845. .. rst-class:: classref-item-separator
  846. ----
  847. .. _class_PopupMenu_method_toggle_item_multistate:
  848. .. rst-class:: classref-method
  849. |void| **toggle_item_multistate**\ (\ index\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_PopupMenu_method_toggle_item_multistate>`
  850. Cycle to the next state of a multistate item. See :ref:`add_multistate_item()<class_PopupMenu_method_add_multistate_item>` for details.
  851. .. rst-class:: classref-section-separator
  852. ----
  853. .. rst-class:: classref-descriptions-group
  854. Theme Property Descriptions
  855. ---------------------------
  856. .. _class_PopupMenu_theme_color_font_accelerator_color:
  857. .. rst-class:: classref-themeproperty
  858. :ref:`Color<class_Color>` **font_accelerator_color** = ``Color(0.7, 0.7, 0.7, 0.8)`` :ref:`๐Ÿ”—<class_PopupMenu_theme_color_font_accelerator_color>`
  859. The text :ref:`Color<class_Color>` used for shortcuts and accelerators that show next to the menu item name when defined. See :ref:`get_item_accelerator()<class_PopupMenu_method_get_item_accelerator>` for more info on accelerators.
  860. .. rst-class:: classref-item-separator
  861. ----
  862. .. _class_PopupMenu_theme_color_font_color:
  863. .. rst-class:: classref-themeproperty
  864. :ref:`Color<class_Color>` **font_color** = ``Color(0.875, 0.875, 0.875, 1)`` :ref:`๐Ÿ”—<class_PopupMenu_theme_color_font_color>`
  865. The default text :ref:`Color<class_Color>` for menu items' names.
  866. .. rst-class:: classref-item-separator
  867. ----
  868. .. _class_PopupMenu_theme_color_font_disabled_color:
  869. .. rst-class:: classref-themeproperty
  870. :ref:`Color<class_Color>` **font_disabled_color** = ``Color(0.4, 0.4, 0.4, 0.8)`` :ref:`๐Ÿ”—<class_PopupMenu_theme_color_font_disabled_color>`
  871. :ref:`Color<class_Color>` used for disabled menu items' text.
  872. .. rst-class:: classref-item-separator
  873. ----
  874. .. _class_PopupMenu_theme_color_font_hover_color:
  875. .. rst-class:: classref-themeproperty
  876. :ref:`Color<class_Color>` **font_hover_color** = ``Color(0.875, 0.875, 0.875, 1)`` :ref:`๐Ÿ”—<class_PopupMenu_theme_color_font_hover_color>`
  877. :ref:`Color<class_Color>` used for the hovered text.
  878. .. rst-class:: classref-item-separator
  879. ----
  880. .. _class_PopupMenu_theme_color_font_outline_color:
  881. .. rst-class:: classref-themeproperty
  882. :ref:`Color<class_Color>` **font_outline_color** = ``Color(0, 0, 0, 1)`` :ref:`๐Ÿ”—<class_PopupMenu_theme_color_font_outline_color>`
  883. The tint of text outline of the menu item.
  884. .. rst-class:: classref-item-separator
  885. ----
  886. .. _class_PopupMenu_theme_color_font_separator_color:
  887. .. rst-class:: classref-themeproperty
  888. :ref:`Color<class_Color>` **font_separator_color** = ``Color(0.875, 0.875, 0.875, 1)`` :ref:`๐Ÿ”—<class_PopupMenu_theme_color_font_separator_color>`
  889. :ref:`Color<class_Color>` used for labeled separators' text. See :ref:`add_separator()<class_PopupMenu_method_add_separator>`.
  890. .. rst-class:: classref-item-separator
  891. ----
  892. .. _class_PopupMenu_theme_color_font_separator_outline_color:
  893. .. rst-class:: classref-themeproperty
  894. :ref:`Color<class_Color>` **font_separator_outline_color** = ``Color(0, 0, 0, 1)`` :ref:`๐Ÿ”—<class_PopupMenu_theme_color_font_separator_outline_color>`
  895. The tint of text outline of the labeled separator.
  896. .. rst-class:: classref-item-separator
  897. ----
  898. .. _class_PopupMenu_theme_constant_h_separation:
  899. .. rst-class:: classref-themeproperty
  900. :ref:`int<class_int>` **h_separation** = ``4`` :ref:`๐Ÿ”—<class_PopupMenu_theme_constant_h_separation>`
  901. The horizontal space between the item's elements.
  902. .. rst-class:: classref-item-separator
  903. ----
  904. .. _class_PopupMenu_theme_constant_icon_max_width:
  905. .. rst-class:: classref-themeproperty
  906. :ref:`int<class_int>` **icon_max_width** = ``0`` :ref:`๐Ÿ”—<class_PopupMenu_theme_constant_icon_max_width>`
  907. The maximum allowed width of the item's icon. This limit is applied on top of the default size of the icon, but before the value set with :ref:`set_item_icon_max_width()<class_PopupMenu_method_set_item_icon_max_width>`. The height is adjusted according to the icon's ratio.
  908. .. rst-class:: classref-item-separator
  909. ----
  910. .. _class_PopupMenu_theme_constant_indent:
  911. .. rst-class:: classref-themeproperty
  912. :ref:`int<class_int>` **indent** = ``10`` :ref:`๐Ÿ”—<class_PopupMenu_theme_constant_indent>`
  913. Width of the single indentation level.
  914. .. rst-class:: classref-item-separator
  915. ----
  916. .. _class_PopupMenu_theme_constant_item_end_padding:
  917. .. rst-class:: classref-themeproperty
  918. :ref:`int<class_int>` **item_end_padding** = ``2`` :ref:`๐Ÿ”—<class_PopupMenu_theme_constant_item_end_padding>`
  919. Horizontal padding to the right of the items (or left, in RTL layout).
  920. .. rst-class:: classref-item-separator
  921. ----
  922. .. _class_PopupMenu_theme_constant_item_start_padding:
  923. .. rst-class:: classref-themeproperty
  924. :ref:`int<class_int>` **item_start_padding** = ``2`` :ref:`๐Ÿ”—<class_PopupMenu_theme_constant_item_start_padding>`
  925. Horizontal padding to the left of the items (or right, in RTL layout).
  926. .. rst-class:: classref-item-separator
  927. ----
  928. .. _class_PopupMenu_theme_constant_outline_size:
  929. .. rst-class:: classref-themeproperty
  930. :ref:`int<class_int>` **outline_size** = ``0`` :ref:`๐Ÿ”—<class_PopupMenu_theme_constant_outline_size>`
  931. The size of the item text outline.
  932. \ **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_PopupMenu_theme_constant_outline_size>` for outline rendering to look correct. Otherwise, the outline may appear to be cut off earlier than intended.
  933. .. rst-class:: classref-item-separator
  934. ----
  935. .. _class_PopupMenu_theme_constant_separator_outline_size:
  936. .. rst-class:: classref-themeproperty
  937. :ref:`int<class_int>` **separator_outline_size** = ``0`` :ref:`๐Ÿ”—<class_PopupMenu_theme_constant_separator_outline_size>`
  938. The size of the labeled separator text outline.
  939. .. rst-class:: classref-item-separator
  940. ----
  941. .. _class_PopupMenu_theme_constant_v_separation:
  942. .. rst-class:: classref-themeproperty
  943. :ref:`int<class_int>` **v_separation** = ``4`` :ref:`๐Ÿ”—<class_PopupMenu_theme_constant_v_separation>`
  944. The vertical space between each menu item.
  945. .. rst-class:: classref-item-separator
  946. ----
  947. .. _class_PopupMenu_theme_font_font:
  948. .. rst-class:: classref-themeproperty
  949. :ref:`Font<class_Font>` **font** :ref:`๐Ÿ”—<class_PopupMenu_theme_font_font>`
  950. :ref:`Font<class_Font>` used for the menu items.
  951. .. rst-class:: classref-item-separator
  952. ----
  953. .. _class_PopupMenu_theme_font_font_separator:
  954. .. rst-class:: classref-themeproperty
  955. :ref:`Font<class_Font>` **font_separator** :ref:`๐Ÿ”—<class_PopupMenu_theme_font_font_separator>`
  956. :ref:`Font<class_Font>` used for the labeled separator.
  957. .. rst-class:: classref-item-separator
  958. ----
  959. .. _class_PopupMenu_theme_font_size_font_separator_size:
  960. .. rst-class:: classref-themeproperty
  961. :ref:`int<class_int>` **font_separator_size** :ref:`๐Ÿ”—<class_PopupMenu_theme_font_size_font_separator_size>`
  962. Font size of the labeled separator.
  963. .. rst-class:: classref-item-separator
  964. ----
  965. .. _class_PopupMenu_theme_font_size_font_size:
  966. .. rst-class:: classref-themeproperty
  967. :ref:`int<class_int>` **font_size** :ref:`๐Ÿ”—<class_PopupMenu_theme_font_size_font_size>`
  968. Font size of the menu items.
  969. .. rst-class:: classref-item-separator
  970. ----
  971. .. _class_PopupMenu_theme_icon_checked:
  972. .. rst-class:: classref-themeproperty
  973. :ref:`Texture2D<class_Texture2D>` **checked** :ref:`๐Ÿ”—<class_PopupMenu_theme_icon_checked>`
  974. :ref:`Texture2D<class_Texture2D>` icon for the checked checkbox items.
  975. .. rst-class:: classref-item-separator
  976. ----
  977. .. _class_PopupMenu_theme_icon_checked_disabled:
  978. .. rst-class:: classref-themeproperty
  979. :ref:`Texture2D<class_Texture2D>` **checked_disabled** :ref:`๐Ÿ”—<class_PopupMenu_theme_icon_checked_disabled>`
  980. :ref:`Texture2D<class_Texture2D>` icon for the checked checkbox items when they are disabled.
  981. .. rst-class:: classref-item-separator
  982. ----
  983. .. _class_PopupMenu_theme_icon_radio_checked:
  984. .. rst-class:: classref-themeproperty
  985. :ref:`Texture2D<class_Texture2D>` **radio_checked** :ref:`๐Ÿ”—<class_PopupMenu_theme_icon_radio_checked>`
  986. :ref:`Texture2D<class_Texture2D>` icon for the checked radio button items.
  987. .. rst-class:: classref-item-separator
  988. ----
  989. .. _class_PopupMenu_theme_icon_radio_checked_disabled:
  990. .. rst-class:: classref-themeproperty
  991. :ref:`Texture2D<class_Texture2D>` **radio_checked_disabled** :ref:`๐Ÿ”—<class_PopupMenu_theme_icon_radio_checked_disabled>`
  992. :ref:`Texture2D<class_Texture2D>` icon for the checked radio button items when they are disabled.
  993. .. rst-class:: classref-item-separator
  994. ----
  995. .. _class_PopupMenu_theme_icon_radio_unchecked:
  996. .. rst-class:: classref-themeproperty
  997. :ref:`Texture2D<class_Texture2D>` **radio_unchecked** :ref:`๐Ÿ”—<class_PopupMenu_theme_icon_radio_unchecked>`
  998. :ref:`Texture2D<class_Texture2D>` icon for the unchecked radio button items.
  999. .. rst-class:: classref-item-separator
  1000. ----
  1001. .. _class_PopupMenu_theme_icon_radio_unchecked_disabled:
  1002. .. rst-class:: classref-themeproperty
  1003. :ref:`Texture2D<class_Texture2D>` **radio_unchecked_disabled** :ref:`๐Ÿ”—<class_PopupMenu_theme_icon_radio_unchecked_disabled>`
  1004. :ref:`Texture2D<class_Texture2D>` icon for the unchecked radio button items when they are disabled.
  1005. .. rst-class:: classref-item-separator
  1006. ----
  1007. .. _class_PopupMenu_theme_icon_submenu:
  1008. .. rst-class:: classref-themeproperty
  1009. :ref:`Texture2D<class_Texture2D>` **submenu** :ref:`๐Ÿ”—<class_PopupMenu_theme_icon_submenu>`
  1010. :ref:`Texture2D<class_Texture2D>` icon for the submenu arrow (for left-to-right layouts).
  1011. .. rst-class:: classref-item-separator
  1012. ----
  1013. .. _class_PopupMenu_theme_icon_submenu_mirrored:
  1014. .. rst-class:: classref-themeproperty
  1015. :ref:`Texture2D<class_Texture2D>` **submenu_mirrored** :ref:`๐Ÿ”—<class_PopupMenu_theme_icon_submenu_mirrored>`
  1016. :ref:`Texture2D<class_Texture2D>` icon for the submenu arrow (for right-to-left layouts).
  1017. .. rst-class:: classref-item-separator
  1018. ----
  1019. .. _class_PopupMenu_theme_icon_unchecked:
  1020. .. rst-class:: classref-themeproperty
  1021. :ref:`Texture2D<class_Texture2D>` **unchecked** :ref:`๐Ÿ”—<class_PopupMenu_theme_icon_unchecked>`
  1022. :ref:`Texture2D<class_Texture2D>` icon for the unchecked checkbox items.
  1023. .. rst-class:: classref-item-separator
  1024. ----
  1025. .. _class_PopupMenu_theme_icon_unchecked_disabled:
  1026. .. rst-class:: classref-themeproperty
  1027. :ref:`Texture2D<class_Texture2D>` **unchecked_disabled** :ref:`๐Ÿ”—<class_PopupMenu_theme_icon_unchecked_disabled>`
  1028. :ref:`Texture2D<class_Texture2D>` icon for the unchecked checkbox items when they are disabled.
  1029. .. rst-class:: classref-item-separator
  1030. ----
  1031. .. _class_PopupMenu_theme_style_hover:
  1032. .. rst-class:: classref-themeproperty
  1033. :ref:`StyleBox<class_StyleBox>` **hover** :ref:`๐Ÿ”—<class_PopupMenu_theme_style_hover>`
  1034. :ref:`StyleBox<class_StyleBox>` displayed when the **PopupMenu** item is hovered.
  1035. .. rst-class:: classref-item-separator
  1036. ----
  1037. .. _class_PopupMenu_theme_style_labeled_separator_left:
  1038. .. rst-class:: classref-themeproperty
  1039. :ref:`StyleBox<class_StyleBox>` **labeled_separator_left** :ref:`๐Ÿ”—<class_PopupMenu_theme_style_labeled_separator_left>`
  1040. :ref:`StyleBox<class_StyleBox>` for the left side of labeled separator. See :ref:`add_separator()<class_PopupMenu_method_add_separator>`.
  1041. .. rst-class:: classref-item-separator
  1042. ----
  1043. .. _class_PopupMenu_theme_style_labeled_separator_right:
  1044. .. rst-class:: classref-themeproperty
  1045. :ref:`StyleBox<class_StyleBox>` **labeled_separator_right** :ref:`๐Ÿ”—<class_PopupMenu_theme_style_labeled_separator_right>`
  1046. :ref:`StyleBox<class_StyleBox>` for the right side of labeled separator. See :ref:`add_separator()<class_PopupMenu_method_add_separator>`.
  1047. .. rst-class:: classref-item-separator
  1048. ----
  1049. .. _class_PopupMenu_theme_style_panel:
  1050. .. rst-class:: classref-themeproperty
  1051. :ref:`StyleBox<class_StyleBox>` **panel** :ref:`๐Ÿ”—<class_PopupMenu_theme_style_panel>`
  1052. :ref:`StyleBox<class_StyleBox>` for the background panel.
  1053. .. rst-class:: classref-item-separator
  1054. ----
  1055. .. _class_PopupMenu_theme_style_separator:
  1056. .. rst-class:: classref-themeproperty
  1057. :ref:`StyleBox<class_StyleBox>` **separator** :ref:`๐Ÿ”—<class_PopupMenu_theme_style_separator>`
  1058. :ref:`StyleBox<class_StyleBox>` used for the separators. See :ref:`add_separator()<class_PopupMenu_method_add_separator>`.
  1059. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  1060. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  1061. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  1062. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  1063. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  1064. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  1065. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  1066. .. |void| replace:: :abbr:`void (No return value.)`