class_popupmenu.rst 127 KB

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