class_popupmenu.rst 120 KB

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