class_popupmenu.rst 127 KB

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