class_popupmenu.rst 126 KB

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