class_popupmenu.rst 98 KB

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