class_popupmenu.rst 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the PopupMenu.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_PopupMenu:
  5. PopupMenu
  6. =========
  7. **Inherits:** :ref:`Popup<class_popup>` **<** :ref:`Control<class_control>` **<** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. PopupMenu displays a list of options.
  12. Member Functions
  13. ----------------
  14. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | void | :ref:`add_check_item<class_PopupMenu_add_check_item>` **(** :ref:`String<class_string>` label, :ref:`int<class_int>` id=-1, :ref:`int<class_int>` accel=0 **)** |
  16. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | void | :ref:`add_radio_check_item<class_PopupMenu_add_radio_check_item>` **(** :ref:`String<class_string>` label, :ref:`int<class_int>` id=-1, :ref:`int<class_int>` accel=0 **)** |
  18. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | void | :ref:`add_check_shortcut<class_PopupMenu_add_check_shortcut>` **(** :ref:`ShortCut<class_shortcut>` shortcut, :ref:`int<class_int>` id=-1, :ref:`bool<class_bool>` global=false **)** |
  20. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | void | :ref:`add_radio_check_shortcut<class_PopupMenu_add_radio_check_shortcut>` **(** :ref:`ShortCut<class_shortcut>` shortcut, :ref:`int<class_int>` id=-1, :ref:`bool<class_bool>` global=false **)** |
  22. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | void | :ref:`add_icon_check_item<class_PopupMenu_add_icon_check_item>` **(** :ref:`Texture<class_texture>` texture, :ref:`String<class_string>` label, :ref:`int<class_int>` id=-1, :ref:`int<class_int>` accel=0 **)** |
  24. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | void | :ref:`add_icon_radio_check_item<class_PopupMenu_add_icon_radio_check_item>` **(** :ref:`Texture<class_texture>` texture, :ref:`String<class_string>` label, :ref:`int<class_int>` id=-1, :ref:`int<class_int>` accel=0 **)** |
  26. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`add_icon_check_shortcut<class_PopupMenu_add_icon_check_shortcut>` **(** :ref:`Texture<class_texture>` texture, :ref:`ShortCut<class_shortcut>` shortcut, :ref:`int<class_int>` id=-1, :ref:`bool<class_bool>` global=false **)** |
  28. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | void | :ref:`add_icon_item<class_PopupMenu_add_icon_item>` **(** :ref:`Texture<class_texture>` texture, :ref:`String<class_string>` label, :ref:`int<class_int>` id=-1, :ref:`int<class_int>` accel=0 **)** |
  30. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | void | :ref:`add_icon_shortcut<class_PopupMenu_add_icon_shortcut>` **(** :ref:`Texture<class_texture>` texture, :ref:`ShortCut<class_shortcut>` shortcut, :ref:`int<class_int>` id=-1, :ref:`bool<class_bool>` global=false **)** |
  32. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`add_item<class_PopupMenu_add_item>` **(** :ref:`String<class_string>` label, :ref:`int<class_int>` id=-1, :ref:`int<class_int>` accel=0 **)** |
  34. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`add_separator<class_PopupMenu_add_separator>` **(** **)** |
  36. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | void | :ref:`add_shortcut<class_PopupMenu_add_shortcut>` **(** :ref:`ShortCut<class_shortcut>` shortcut, :ref:`int<class_int>` id=-1, :ref:`bool<class_bool>` global=false **)** |
  38. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | void | :ref:`add_submenu_item<class_PopupMenu_add_submenu_item>` **(** :ref:`String<class_string>` label, :ref:`String<class_string>` submenu, :ref:`int<class_int>` id=-1 **)** |
  40. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | void | :ref:`clear<class_PopupMenu_clear>` **(** **)** |
  42. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`int<class_int>` | :ref:`get_item_accelerator<class_PopupMenu_get_item_accelerator>` **(** :ref:`int<class_int>` idx **)** const |
  44. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`int<class_int>` | :ref:`get_item_count<class_PopupMenu_get_item_count>` **(** **)** const |
  46. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`Texture<class_texture>` | :ref:`get_item_icon<class_PopupMenu_get_item_icon>` **(** :ref:`int<class_int>` idx **)** const |
  48. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`int<class_int>` | :ref:`get_item_id<class_PopupMenu_get_item_id>` **(** :ref:`int<class_int>` idx **)** const |
  50. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`int<class_int>` | :ref:`get_item_index<class_PopupMenu_get_item_index>` **(** :ref:`int<class_int>` id **)** const |
  52. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`Variant<class_variant>` | :ref:`get_item_metadata<class_PopupMenu_get_item_metadata>` **(** :ref:`int<class_int>` idx **)** const |
  54. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`ShortCut<class_shortcut>` | :ref:`get_item_shortcut<class_PopupMenu_get_item_shortcut>` **(** :ref:`int<class_int>` idx **)** const |
  56. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`String<class_string>` | :ref:`get_item_submenu<class_PopupMenu_get_item_submenu>` **(** :ref:`int<class_int>` idx **)** const |
  58. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`String<class_string>` | :ref:`get_item_text<class_PopupMenu_get_item_text>` **(** :ref:`int<class_int>` idx **)** const |
  60. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`String<class_string>` | :ref:`get_item_tooltip<class_PopupMenu_get_item_tooltip>` **(** :ref:`int<class_int>` idx **)** const |
  62. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`bool<class_bool>` | :ref:`is_item_checkable<class_PopupMenu_is_item_checkable>` **(** :ref:`int<class_int>` idx **)** const |
  64. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | :ref:`bool<class_bool>` | :ref:`is_item_radio_checkable<class_PopupMenu_is_item_radio_checkable>` **(** :ref:`int<class_int>` idx **)** const |
  66. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | :ref:`bool<class_bool>` | :ref:`is_item_checked<class_PopupMenu_is_item_checked>` **(** :ref:`int<class_int>` idx **)** const |
  68. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | :ref:`bool<class_bool>` | :ref:`is_item_disabled<class_PopupMenu_is_item_disabled>` **(** :ref:`int<class_int>` idx **)** const |
  70. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | :ref:`bool<class_bool>` | :ref:`is_item_separator<class_PopupMenu_is_item_separator>` **(** :ref:`int<class_int>` idx **)** const |
  72. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | void | :ref:`remove_item<class_PopupMenu_remove_item>` **(** :ref:`int<class_int>` idx **)** |
  74. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | void | :ref:`set_item_accelerator<class_PopupMenu_set_item_accelerator>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` accel **)** |
  76. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | void | :ref:`set_item_as_checkable<class_PopupMenu_set_item_as_checkable>` **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` enable **)** |
  78. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | void | :ref:`set_item_as_radio_checkable<class_PopupMenu_set_item_as_radio_checkable>` **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` enable **)** |
  80. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | void | :ref:`set_item_as_separator<class_PopupMenu_set_item_as_separator>` **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` enable **)** |
  82. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | void | :ref:`set_item_checked<class_PopupMenu_set_item_checked>` **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` checked **)** |
  84. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | void | :ref:`set_item_disabled<class_PopupMenu_set_item_disabled>` **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` disabled **)** |
  86. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | void | :ref:`set_item_icon<class_PopupMenu_set_item_icon>` **(** :ref:`int<class_int>` idx, :ref:`Texture<class_texture>` icon **)** |
  88. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | void | :ref:`set_item_id<class_PopupMenu_set_item_id>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` id **)** |
  90. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | void | :ref:`set_item_metadata<class_PopupMenu_set_item_metadata>` **(** :ref:`int<class_int>` idx, :ref:`Variant<class_variant>` metadata **)** |
  92. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | void | :ref:`set_item_multistate<class_PopupMenu_set_item_multistate>` **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` state **)** |
  94. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | void | :ref:`set_item_shortcut<class_PopupMenu_set_item_shortcut>` **(** :ref:`int<class_int>` idx, :ref:`ShortCut<class_shortcut>` shortcut, :ref:`bool<class_bool>` global=false **)** |
  96. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | void | :ref:`set_item_submenu<class_PopupMenu_set_item_submenu>` **(** :ref:`int<class_int>` idx, :ref:`String<class_string>` submenu **)** |
  98. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | void | :ref:`set_item_text<class_PopupMenu_set_item_text>` **(** :ref:`int<class_int>` idx, :ref:`String<class_string>` text **)** |
  100. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | void | :ref:`set_item_tooltip<class_PopupMenu_set_item_tooltip>` **(** :ref:`int<class_int>` idx, :ref:`String<class_string>` tooltip **)** |
  102. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | void | :ref:`toggle_item_checked<class_PopupMenu_toggle_item_checked>` **(** :ref:`int<class_int>` idx **)** |
  104. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | void | :ref:`toggle_item_multistate<class_PopupMenu_toggle_item_multistate>` **(** :ref:`int<class_int>` idx **)** |
  106. +----------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. Signals
  108. -------
  109. .. _class_PopupMenu_id_pressed:
  110. - **id_pressed** **(** :ref:`int<class_int>` ID **)**
  111. This event is emitted when an item of some id is pressed or its accelerator is activated.
  112. .. _class_PopupMenu_index_pressed:
  113. - **index_pressed** **(** :ref:`int<class_int>` index **)**
  114. This event is emitted when an item of some index is pressed or its accelerator is activated.
  115. Member Variables
  116. ----------------
  117. .. _class_PopupMenu_hide_on_checkable_item_selection:
  118. - :ref:`bool<class_bool>` **hide_on_checkable_item_selection**
  119. .. _class_PopupMenu_hide_on_item_selection:
  120. - :ref:`bool<class_bool>` **hide_on_item_selection**
  121. .. _class_PopupMenu_hide_on_state_item_selection:
  122. - :ref:`bool<class_bool>` **hide_on_state_item_selection**
  123. Description
  124. -----------
  125. PopupMenu is the typical Control that displays a list of options. They are popular in toolbars or context menus.
  126. Member Function Description
  127. ---------------------------
  128. .. _class_PopupMenu_add_check_item:
  129. - void **add_check_item** **(** :ref:`String<class_string>` label, :ref:`int<class_int>` id=-1, :ref:`int<class_int>` accel=0 **)**
  130. Add a new checkable item with text "label". An id can optionally be provided, as well as an accelerator. If no id is provided, one will be created from the index. Note that checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually.
  131. .. _class_PopupMenu_add_radio_check_item:
  132. - void **add_radio_check_item** **(** :ref:`String<class_string>` label, :ref:`int<class_int>` id=-1, :ref:`int<class_int>` accel=0 **)**
  133. The same as :ref:`add_check_item<class_PopupMenu_add_check_item>` but the inserted item will look as a radio button. Remember this is just cosmetic and you have to add the logic for checking/unchecking items in radio groups.
  134. .. _class_PopupMenu_add_check_shortcut:
  135. - void **add_check_shortcut** **(** :ref:`ShortCut<class_shortcut>` shortcut, :ref:`int<class_int>` id=-1, :ref:`bool<class_bool>` global=false **)**
  136. .. _class_PopupMenu_add_radio_check_shortcut:
  137. - void **add_radio_check_shortcut** **(** :ref:`ShortCut<class_shortcut>` shortcut, :ref:`int<class_int>` id=-1, :ref:`bool<class_bool>` global=false **)**
  138. .. _class_PopupMenu_add_icon_check_item:
  139. - void **add_icon_check_item** **(** :ref:`Texture<class_texture>` texture, :ref:`String<class_string>` label, :ref:`int<class_int>` id=-1, :ref:`int<class_int>` accel=0 **)**
  140. Add a new checkable item with text "label" and icon "texture". An id can optionally be provided, as well as an accelerator. If no id is provided, one will be
  141. created from the index. Note that checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually.
  142. .. _class_PopupMenu_add_icon_radio_check_item:
  143. - void **add_icon_radio_check_item** **(** :ref:`Texture<class_texture>` texture, :ref:`String<class_string>` label, :ref:`int<class_int>` id=-1, :ref:`int<class_int>` accel=0 **)**
  144. The same as :ref:`add_icon_check_item<class_PopupMenu_add_icon_check_item>` but the inserted item will look as a radio button. Remember this is just cosmetic and you have to add the logic for checking/unchecking items in radio groups.
  145. .. _class_PopupMenu_add_icon_check_shortcut:
  146. - void **add_icon_check_shortcut** **(** :ref:`Texture<class_texture>` texture, :ref:`ShortCut<class_shortcut>` shortcut, :ref:`int<class_int>` id=-1, :ref:`bool<class_bool>` global=false **)**
  147. .. _class_PopupMenu_add_icon_item:
  148. - void **add_icon_item** **(** :ref:`Texture<class_texture>` texture, :ref:`String<class_string>` label, :ref:`int<class_int>` id=-1, :ref:`int<class_int>` accel=0 **)**
  149. Add a new item with text "label" and icon "texture". An id can optionally be provided, as well as an accelerator keybinding. If no id is provided, one will be created from the index.
  150. .. _class_PopupMenu_add_icon_shortcut:
  151. - void **add_icon_shortcut** **(** :ref:`Texture<class_texture>` texture, :ref:`ShortCut<class_shortcut>` shortcut, :ref:`int<class_int>` id=-1, :ref:`bool<class_bool>` global=false **)**
  152. .. _class_PopupMenu_add_item:
  153. - void **add_item** **(** :ref:`String<class_string>` label, :ref:`int<class_int>` id=-1, :ref:`int<class_int>` accel=0 **)**
  154. Add a new item with text "label". An id can optionally be provided, as well as an accelerator keybinding. If no id is provided, one will be created from the index.
  155. .. _class_PopupMenu_add_separator:
  156. - void **add_separator** **(** **)**
  157. Add a separator between items. Separators also occupy an index.
  158. .. _class_PopupMenu_add_shortcut:
  159. - void **add_shortcut** **(** :ref:`ShortCut<class_shortcut>` shortcut, :ref:`int<class_int>` id=-1, :ref:`bool<class_bool>` global=false **)**
  160. .. _class_PopupMenu_add_submenu_item:
  161. - void **add_submenu_item** **(** :ref:`String<class_string>` label, :ref:`String<class_string>` submenu, :ref:`int<class_int>` id=-1 **)**
  162. Adds an item with a submenu. The submenu is the name of a child PopupMenu node that would be shown when the item is clicked. An id can optionally be provided, but if is isn't provided, one will be created from the index.
  163. .. _class_PopupMenu_clear:
  164. - void **clear** **(** **)**
  165. Clear the popup menu, in effect removing all items.
  166. .. _class_PopupMenu_get_item_accelerator:
  167. - :ref:`int<class_int>` **get_item_accelerator** **(** :ref:`int<class_int>` idx **)** const
  168. Return the accelerator of the item at index "idx". Accelerators are special combinations of keys that activate the item, no matter which control is focused.
  169. .. _class_PopupMenu_get_item_count:
  170. - :ref:`int<class_int>` **get_item_count** **(** **)** const
  171. Return the amount of items.
  172. .. _class_PopupMenu_get_item_icon:
  173. - :ref:`Texture<class_texture>` **get_item_icon** **(** :ref:`int<class_int>` idx **)** const
  174. Return the icon of the item at index "idx".
  175. .. _class_PopupMenu_get_item_id:
  176. - :ref:`int<class_int>` **get_item_id** **(** :ref:`int<class_int>` idx **)** const
  177. Return the id of the item at index "idx".
  178. .. _class_PopupMenu_get_item_index:
  179. - :ref:`int<class_int>` **get_item_index** **(** :ref:`int<class_int>` id **)** const
  180. Find and return the index of the item containing a given id.
  181. .. _class_PopupMenu_get_item_metadata:
  182. - :ref:`Variant<class_variant>` **get_item_metadata** **(** :ref:`int<class_int>` idx **)** const
  183. Return the metadata of an item, which might be of any type. You can set it with :ref:`set_item_metadata<class_PopupMenu_set_item_metadata>`, which provides a simple way of assigning context data to items.
  184. .. _class_PopupMenu_get_item_shortcut:
  185. - :ref:`ShortCut<class_shortcut>` **get_item_shortcut** **(** :ref:`int<class_int>` idx **)** const
  186. .. _class_PopupMenu_get_item_submenu:
  187. - :ref:`String<class_string>` **get_item_submenu** **(** :ref:`int<class_int>` idx **)** const
  188. Return the submenu name of the item at index "idx".
  189. .. _class_PopupMenu_get_item_text:
  190. - :ref:`String<class_string>` **get_item_text** **(** :ref:`int<class_int>` idx **)** const
  191. Return the text of the item at index "idx".
  192. .. _class_PopupMenu_get_item_tooltip:
  193. - :ref:`String<class_string>` **get_item_tooltip** **(** :ref:`int<class_int>` idx **)** const
  194. .. _class_PopupMenu_is_item_checkable:
  195. - :ref:`bool<class_bool>` **is_item_checkable** **(** :ref:`int<class_int>` idx **)** const
  196. Return whether the item at index "idx" is checkable in some way, i.e., whether has a checkbox or radio button. Note that checkable items just display a checkmark or radio button, but don't have any built-in checking behavior and must be checked/unchecked manually.
  197. .. _class_PopupMenu_is_item_radio_checkable:
  198. - :ref:`bool<class_bool>` **is_item_radio_checkable** **(** :ref:`int<class_int>` idx **)** const
  199. Return whether the item at index "idx" has radio-button-style checkability. Remember this is just cosmetic and you have to add the logic for checking/unchecking items in radio groups.
  200. .. _class_PopupMenu_is_item_checked:
  201. - :ref:`bool<class_bool>` **is_item_checked** **(** :ref:`int<class_int>` idx **)** const
  202. Return whether the item at index "idx" is checked.
  203. .. _class_PopupMenu_is_item_disabled:
  204. - :ref:`bool<class_bool>` **is_item_disabled** **(** :ref:`int<class_int>` idx **)** const
  205. Return whether the item at index "idx" is disabled. When it is disabled it can't be selected, or its action invoked.
  206. .. _class_PopupMenu_is_item_separator:
  207. - :ref:`bool<class_bool>` **is_item_separator** **(** :ref:`int<class_int>` idx **)** const
  208. Return whether the item is a separator. If it is, it would be displayed as a line.
  209. .. _class_PopupMenu_remove_item:
  210. - void **remove_item** **(** :ref:`int<class_int>` idx **)**
  211. Removes the item at index "idx" from the menu. Note that the indexes of items after the removed item are going to be shifted by one.
  212. .. _class_PopupMenu_set_item_accelerator:
  213. - void **set_item_accelerator** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` accel **)**
  214. Set the accelerator of the item at index "idx". Accelerators are special combinations of keys that activate the item, no matter which control is focused.
  215. .. _class_PopupMenu_set_item_as_checkable:
  216. - void **set_item_as_checkable** **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` enable **)**
  217. Set whether the item at index "idx" has a checkbox. Note that checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually.
  218. .. _class_PopupMenu_set_item_as_radio_checkable:
  219. - void **set_item_as_radio_checkable** **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` enable **)**
  220. The same as :ref:`set_item_as_checkable<class_PopupMenu_set_item_as_checkable>` but placing a radio button in case of enabling. If used for disabling, it's the same.
  221. Remember this is just cosmetic and you have to add the logic for checking/unchecking items in radio groups.
  222. .. _class_PopupMenu_set_item_as_separator:
  223. - void **set_item_as_separator** **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` enable **)**
  224. Mark the item at index "idx" as a separator, which means that it would be displayed as a mere line.
  225. .. _class_PopupMenu_set_item_checked:
  226. - void **set_item_checked** **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` checked **)**
  227. Set the checkstate status of the item at index "idx".
  228. .. _class_PopupMenu_set_item_disabled:
  229. - void **set_item_disabled** **(** :ref:`int<class_int>` idx, :ref:`bool<class_bool>` disabled **)**
  230. Sets whether the item at index "idx" is disabled or not. When it is disabled it can't be selected, or its action invoked.
  231. .. _class_PopupMenu_set_item_icon:
  232. - void **set_item_icon** **(** :ref:`int<class_int>` idx, :ref:`Texture<class_texture>` icon **)**
  233. .. _class_PopupMenu_set_item_id:
  234. - void **set_item_id** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` id **)**
  235. Set the id of the item at index "idx".
  236. .. _class_PopupMenu_set_item_metadata:
  237. - void **set_item_metadata** **(** :ref:`int<class_int>` idx, :ref:`Variant<class_variant>` metadata **)**
  238. Sets the metadata of an item, which might be of any type. You can later get it with :ref:`get_item_metadata<class_PopupMenu_get_item_metadata>`, which provides a simple way of assigning context data to items.
  239. .. _class_PopupMenu_set_item_multistate:
  240. - void **set_item_multistate** **(** :ref:`int<class_int>` idx, :ref:`int<class_int>` state **)**
  241. .. _class_PopupMenu_set_item_shortcut:
  242. - void **set_item_shortcut** **(** :ref:`int<class_int>` idx, :ref:`ShortCut<class_shortcut>` shortcut, :ref:`bool<class_bool>` global=false **)**
  243. .. _class_PopupMenu_set_item_submenu:
  244. - void **set_item_submenu** **(** :ref:`int<class_int>` idx, :ref:`String<class_string>` submenu **)**
  245. Sets the submenu of the item at index "idx". The submenu is the name of a child PopupMenu node that would be shown when the item is clicked.
  246. .. _class_PopupMenu_set_item_text:
  247. - void **set_item_text** **(** :ref:`int<class_int>` idx, :ref:`String<class_string>` text **)**
  248. Set the text of the item at index "idx".
  249. .. _class_PopupMenu_set_item_tooltip:
  250. - void **set_item_tooltip** **(** :ref:`int<class_int>` idx, :ref:`String<class_string>` tooltip **)**
  251. .. _class_PopupMenu_toggle_item_checked:
  252. - void **toggle_item_checked** **(** :ref:`int<class_int>` idx **)**
  253. .. _class_PopupMenu_toggle_item_multistate:
  254. - void **toggle_item_multistate** **(** :ref:`int<class_int>` idx **)**