class_nativemenu.rst 111 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/NativeMenu.xml.
  6. .. _class_NativeMenu:
  7. NativeMenu
  8. ==========
  9. **Inherits:** :ref:`Object<class_Object>`
  10. A server interface for OS native menus.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. **NativeMenu** handles low-level access to the OS native global menu bar and popup menus.
  15. \ **Note:** This is low-level API, consider using :ref:`MenuBar<class_MenuBar>` with :ref:`MenuBar.prefer_global_menu<class_MenuBar_property_prefer_global_menu>` set to ``true``, and :ref:`PopupMenu<class_PopupMenu>` with :ref:`PopupMenu.prefer_native_menu<class_PopupMenu_property_prefer_native_menu>` set to ``true``.
  16. To create a menu, use :ref:`create_menu<class_NativeMenu_method_create_menu>`, add menu items using ``add_*_item`` methods. To remove a menu, use :ref:`free_menu<class_NativeMenu_method_free_menu>`.
  17. ::
  18. var menu
  19. func _menu_callback(item_id):
  20. if item_id == "ITEM_CUT":
  21. cut()
  22. elif item_id == "ITEM_COPY":
  23. copy()
  24. elif item_id == "ITEM_PASTE":
  25. paste()
  26. func _enter_tree():
  27. # Create new menu and add items:
  28. menu = NativeMenu.create_menu()
  29. NativeMenu.add_item(menu, "Cut", _menu_callback, Callable(), "ITEM_CUT")
  30. NativeMenu.add_item(menu, "Copy", _menu_callback, Callable(), "ITEM_COPY")
  31. NativeMenu.add_separator(menu)
  32. NativeMenu.add_item(menu, "Paste", _menu_callback, Callable(), "ITEM_PASTE")
  33. func _on_button_pressed():
  34. # Show popup menu at mouse position:
  35. NativeMenu.popup(menu, DisplayServer.mouse_get_position())
  36. func _exit_tree():
  37. # Remove menu when it's no longer needed:
  38. NativeMenu.free_menu(menu)
  39. .. rst-class:: classref-reftable-group
  40. Methods
  41. -------
  42. .. table::
  43. :widths: auto
  44. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`int<class_int>` | :ref:`add_check_item<class_NativeMenu_method_add_check_item>`\ (\ rid\: :ref:`RID<class_RID>`, label\: :ref:`String<class_String>`, callback\: :ref:`Callable<class_Callable>` = Callable(), key_callback\: :ref:`Callable<class_Callable>` = Callable(), tag\: :ref:`Variant<class_Variant>` = null, accelerator\: :ref:`Key<enum_@GlobalScope_Key>` = 0, index\: :ref:`int<class_int>` = -1\ ) |
  46. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`int<class_int>` | :ref:`add_icon_check_item<class_NativeMenu_method_add_icon_check_item>`\ (\ rid\: :ref:`RID<class_RID>`, icon\: :ref:`Texture2D<class_Texture2D>`, label\: :ref:`String<class_String>`, callback\: :ref:`Callable<class_Callable>` = Callable(), key_callback\: :ref:`Callable<class_Callable>` = Callable(), tag\: :ref:`Variant<class_Variant>` = null, accelerator\: :ref:`Key<enum_@GlobalScope_Key>` = 0, index\: :ref:`int<class_int>` = -1\ ) |
  48. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`int<class_int>` | :ref:`add_icon_item<class_NativeMenu_method_add_icon_item>`\ (\ rid\: :ref:`RID<class_RID>`, icon\: :ref:`Texture2D<class_Texture2D>`, label\: :ref:`String<class_String>`, callback\: :ref:`Callable<class_Callable>` = Callable(), key_callback\: :ref:`Callable<class_Callable>` = Callable(), tag\: :ref:`Variant<class_Variant>` = null, accelerator\: :ref:`Key<enum_@GlobalScope_Key>` = 0, index\: :ref:`int<class_int>` = -1\ ) |
  50. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | :ref:`int<class_int>` | :ref:`add_icon_radio_check_item<class_NativeMenu_method_add_icon_radio_check_item>`\ (\ rid\: :ref:`RID<class_RID>`, icon\: :ref:`Texture2D<class_Texture2D>`, label\: :ref:`String<class_String>`, callback\: :ref:`Callable<class_Callable>` = Callable(), key_callback\: :ref:`Callable<class_Callable>` = Callable(), tag\: :ref:`Variant<class_Variant>` = null, accelerator\: :ref:`Key<enum_@GlobalScope_Key>` = 0, index\: :ref:`int<class_int>` = -1\ ) |
  52. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`int<class_int>` | :ref:`add_item<class_NativeMenu_method_add_item>`\ (\ rid\: :ref:`RID<class_RID>`, label\: :ref:`String<class_String>`, callback\: :ref:`Callable<class_Callable>` = Callable(), key_callback\: :ref:`Callable<class_Callable>` = Callable(), tag\: :ref:`Variant<class_Variant>` = null, accelerator\: :ref:`Key<enum_@GlobalScope_Key>` = 0, index\: :ref:`int<class_int>` = -1\ ) |
  54. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`int<class_int>` | :ref:`add_multistate_item<class_NativeMenu_method_add_multistate_item>`\ (\ rid\: :ref:`RID<class_RID>`, label\: :ref:`String<class_String>`, max_states\: :ref:`int<class_int>`, default_state\: :ref:`int<class_int>`, callback\: :ref:`Callable<class_Callable>` = Callable(), key_callback\: :ref:`Callable<class_Callable>` = Callable(), tag\: :ref:`Variant<class_Variant>` = null, accelerator\: :ref:`Key<enum_@GlobalScope_Key>` = 0, index\: :ref:`int<class_int>` = -1\ ) |
  56. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | :ref:`int<class_int>` | :ref:`add_radio_check_item<class_NativeMenu_method_add_radio_check_item>`\ (\ rid\: :ref:`RID<class_RID>`, label\: :ref:`String<class_String>`, callback\: :ref:`Callable<class_Callable>` = Callable(), key_callback\: :ref:`Callable<class_Callable>` = Callable(), tag\: :ref:`Variant<class_Variant>` = null, accelerator\: :ref:`Key<enum_@GlobalScope_Key>` = 0, index\: :ref:`int<class_int>` = -1\ ) |
  58. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`int<class_int>` | :ref:`add_separator<class_NativeMenu_method_add_separator>`\ (\ rid\: :ref:`RID<class_RID>`, index\: :ref:`int<class_int>` = -1\ ) |
  60. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`int<class_int>` | :ref:`add_submenu_item<class_NativeMenu_method_add_submenu_item>`\ (\ rid\: :ref:`RID<class_RID>`, label\: :ref:`String<class_String>`, submenu_rid\: :ref:`RID<class_RID>`, tag\: :ref:`Variant<class_Variant>` = null, index\: :ref:`int<class_int>` = -1\ ) |
  62. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | |void| | :ref:`clear<class_NativeMenu_method_clear>`\ (\ rid\: :ref:`RID<class_RID>`\ ) |
  64. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | :ref:`RID<class_RID>` | :ref:`create_menu<class_NativeMenu_method_create_menu>`\ (\ ) |
  66. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | :ref:`int<class_int>` | :ref:`find_item_index_with_submenu<class_NativeMenu_method_find_item_index_with_submenu>`\ (\ rid\: :ref:`RID<class_RID>`, submenu_rid\: :ref:`RID<class_RID>`\ ) |const| |
  68. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | :ref:`int<class_int>` | :ref:`find_item_index_with_tag<class_NativeMenu_method_find_item_index_with_tag>`\ (\ rid\: :ref:`RID<class_RID>`, tag\: :ref:`Variant<class_Variant>`\ ) |const| |
  70. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | :ref:`int<class_int>` | :ref:`find_item_index_with_text<class_NativeMenu_method_find_item_index_with_text>`\ (\ rid\: :ref:`RID<class_RID>`, text\: :ref:`String<class_String>`\ ) |const| |
  72. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | |void| | :ref:`free_menu<class_NativeMenu_method_free_menu>`\ (\ rid\: :ref:`RID<class_RID>`\ ) |
  74. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | :ref:`Key<enum_@GlobalScope_Key>` | :ref:`get_item_accelerator<class_NativeMenu_method_get_item_accelerator>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| |
  76. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | :ref:`Callable<class_Callable>` | :ref:`get_item_callback<class_NativeMenu_method_get_item_callback>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| |
  78. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | :ref:`int<class_int>` | :ref:`get_item_count<class_NativeMenu_method_get_item_count>`\ (\ rid\: :ref:`RID<class_RID>`\ ) |const| |
  80. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | :ref:`Texture2D<class_Texture2D>` | :ref:`get_item_icon<class_NativeMenu_method_get_item_icon>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| |
  82. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | :ref:`int<class_int>` | :ref:`get_item_indentation_level<class_NativeMenu_method_get_item_indentation_level>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| |
  84. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | :ref:`Callable<class_Callable>` | :ref:`get_item_key_callback<class_NativeMenu_method_get_item_key_callback>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| |
  86. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | :ref:`int<class_int>` | :ref:`get_item_max_states<class_NativeMenu_method_get_item_max_states>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| |
  88. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | :ref:`int<class_int>` | :ref:`get_item_state<class_NativeMenu_method_get_item_state>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| |
  90. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | :ref:`RID<class_RID>` | :ref:`get_item_submenu<class_NativeMenu_method_get_item_submenu>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| |
  92. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | :ref:`Variant<class_Variant>` | :ref:`get_item_tag<class_NativeMenu_method_get_item_tag>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| |
  94. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | :ref:`String<class_String>` | :ref:`get_item_text<class_NativeMenu_method_get_item_text>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| |
  96. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | :ref:`String<class_String>` | :ref:`get_item_tooltip<class_NativeMenu_method_get_item_tooltip>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| |
  98. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | :ref:`float<class_float>` | :ref:`get_minimum_width<class_NativeMenu_method_get_minimum_width>`\ (\ rid\: :ref:`RID<class_RID>`\ ) |const| |
  100. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | :ref:`Callable<class_Callable>` | :ref:`get_popup_close_callback<class_NativeMenu_method_get_popup_close_callback>`\ (\ rid\: :ref:`RID<class_RID>`\ ) |const| |
  102. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | :ref:`Callable<class_Callable>` | :ref:`get_popup_open_callback<class_NativeMenu_method_get_popup_open_callback>`\ (\ rid\: :ref:`RID<class_RID>`\ ) |const| |
  104. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | :ref:`Vector2<class_Vector2>` | :ref:`get_size<class_NativeMenu_method_get_size>`\ (\ rid\: :ref:`RID<class_RID>`\ ) |const| |
  106. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. | :ref:`RID<class_RID>` | :ref:`get_system_menu<class_NativeMenu_method_get_system_menu>`\ (\ menu_id\: :ref:`SystemMenus<enum_NativeMenu_SystemMenus>`\ ) |const| |
  108. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  109. | :ref:`String<class_String>` | :ref:`get_system_menu_name<class_NativeMenu_method_get_system_menu_name>`\ (\ menu_id\: :ref:`SystemMenus<enum_NativeMenu_SystemMenus>`\ ) |const| |
  110. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  111. | :ref:`bool<class_bool>` | :ref:`has_feature<class_NativeMenu_method_has_feature>`\ (\ feature\: :ref:`Feature<enum_NativeMenu_Feature>`\ ) |const| |
  112. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  113. | :ref:`bool<class_bool>` | :ref:`has_menu<class_NativeMenu_method_has_menu>`\ (\ rid\: :ref:`RID<class_RID>`\ ) |const| |
  114. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  115. | :ref:`bool<class_bool>` | :ref:`has_system_menu<class_NativeMenu_method_has_system_menu>`\ (\ menu_id\: :ref:`SystemMenus<enum_NativeMenu_SystemMenus>`\ ) |const| |
  116. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  117. | :ref:`bool<class_bool>` | :ref:`is_item_checkable<class_NativeMenu_method_is_item_checkable>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| |
  118. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  119. | :ref:`bool<class_bool>` | :ref:`is_item_checked<class_NativeMenu_method_is_item_checked>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| |
  120. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  121. | :ref:`bool<class_bool>` | :ref:`is_item_disabled<class_NativeMenu_method_is_item_disabled>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| |
  122. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  123. | :ref:`bool<class_bool>` | :ref:`is_item_hidden<class_NativeMenu_method_is_item_hidden>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| |
  124. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  125. | :ref:`bool<class_bool>` | :ref:`is_item_radio_checkable<class_NativeMenu_method_is_item_radio_checkable>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| |
  126. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  127. | :ref:`bool<class_bool>` | :ref:`is_opened<class_NativeMenu_method_is_opened>`\ (\ rid\: :ref:`RID<class_RID>`\ ) |const| |
  128. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  129. | :ref:`bool<class_bool>` | :ref:`is_system_menu<class_NativeMenu_method_is_system_menu>`\ (\ rid\: :ref:`RID<class_RID>`\ ) |const| |
  130. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  131. | |void| | :ref:`popup<class_NativeMenu_method_popup>`\ (\ rid\: :ref:`RID<class_RID>`, position\: :ref:`Vector2i<class_Vector2i>`\ ) |
  132. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  133. | |void| | :ref:`remove_item<class_NativeMenu_method_remove_item>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |
  134. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  135. | |void| | :ref:`set_interface_direction<class_NativeMenu_method_set_interface_direction>`\ (\ rid\: :ref:`RID<class_RID>`, is_rtl\: :ref:`bool<class_bool>`\ ) |
  136. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  137. | |void| | :ref:`set_item_accelerator<class_NativeMenu_method_set_item_accelerator>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, keycode\: :ref:`Key<enum_@GlobalScope_Key>`\ ) |
  138. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  139. | |void| | :ref:`set_item_callback<class_NativeMenu_method_set_item_callback>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, callback\: :ref:`Callable<class_Callable>`\ ) |
  140. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  141. | |void| | :ref:`set_item_checkable<class_NativeMenu_method_set_item_checkable>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, checkable\: :ref:`bool<class_bool>`\ ) |
  142. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  143. | |void| | :ref:`set_item_checked<class_NativeMenu_method_set_item_checked>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, checked\: :ref:`bool<class_bool>`\ ) |
  144. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  145. | |void| | :ref:`set_item_disabled<class_NativeMenu_method_set_item_disabled>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, disabled\: :ref:`bool<class_bool>`\ ) |
  146. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  147. | |void| | :ref:`set_item_hidden<class_NativeMenu_method_set_item_hidden>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, hidden\: :ref:`bool<class_bool>`\ ) |
  148. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  149. | |void| | :ref:`set_item_hover_callbacks<class_NativeMenu_method_set_item_hover_callbacks>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, callback\: :ref:`Callable<class_Callable>`\ ) |
  150. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  151. | |void| | :ref:`set_item_icon<class_NativeMenu_method_set_item_icon>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, icon\: :ref:`Texture2D<class_Texture2D>`\ ) |
  152. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  153. | |void| | :ref:`set_item_indentation_level<class_NativeMenu_method_set_item_indentation_level>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, level\: :ref:`int<class_int>`\ ) |
  154. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  155. | |void| | :ref:`set_item_key_callback<class_NativeMenu_method_set_item_key_callback>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, key_callback\: :ref:`Callable<class_Callable>`\ ) |
  156. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  157. | |void| | :ref:`set_item_max_states<class_NativeMenu_method_set_item_max_states>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, max_states\: :ref:`int<class_int>`\ ) |
  158. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  159. | |void| | :ref:`set_item_radio_checkable<class_NativeMenu_method_set_item_radio_checkable>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, checkable\: :ref:`bool<class_bool>`\ ) |
  160. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  161. | |void| | :ref:`set_item_state<class_NativeMenu_method_set_item_state>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, state\: :ref:`int<class_int>`\ ) |
  162. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  163. | |void| | :ref:`set_item_submenu<class_NativeMenu_method_set_item_submenu>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, submenu_rid\: :ref:`RID<class_RID>`\ ) |
  164. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  165. | |void| | :ref:`set_item_tag<class_NativeMenu_method_set_item_tag>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, tag\: :ref:`Variant<class_Variant>`\ ) |
  166. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  167. | |void| | :ref:`set_item_text<class_NativeMenu_method_set_item_text>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, text\: :ref:`String<class_String>`\ ) |
  168. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  169. | |void| | :ref:`set_item_tooltip<class_NativeMenu_method_set_item_tooltip>`\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, tooltip\: :ref:`String<class_String>`\ ) |
  170. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  171. | |void| | :ref:`set_minimum_width<class_NativeMenu_method_set_minimum_width>`\ (\ rid\: :ref:`RID<class_RID>`, width\: :ref:`float<class_float>`\ ) |
  172. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  173. | |void| | :ref:`set_popup_close_callback<class_NativeMenu_method_set_popup_close_callback>`\ (\ rid\: :ref:`RID<class_RID>`, callback\: :ref:`Callable<class_Callable>`\ ) |
  174. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  175. | |void| | :ref:`set_popup_open_callback<class_NativeMenu_method_set_popup_open_callback>`\ (\ rid\: :ref:`RID<class_RID>`, callback\: :ref:`Callable<class_Callable>`\ ) |
  176. +-----------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  177. .. rst-class:: classref-section-separator
  178. ----
  179. .. rst-class:: classref-descriptions-group
  180. Enumerations
  181. ------------
  182. .. _enum_NativeMenu_Feature:
  183. .. rst-class:: classref-enumeration
  184. enum **Feature**: :ref:`๐Ÿ”—<enum_NativeMenu_Feature>`
  185. .. _class_NativeMenu_constant_FEATURE_GLOBAL_MENU:
  186. .. rst-class:: classref-enumeration-constant
  187. :ref:`Feature<enum_NativeMenu_Feature>` **FEATURE_GLOBAL_MENU** = ``0``
  188. **NativeMenu** supports native global main menu.
  189. .. _class_NativeMenu_constant_FEATURE_POPUP_MENU:
  190. .. rst-class:: classref-enumeration-constant
  191. :ref:`Feature<enum_NativeMenu_Feature>` **FEATURE_POPUP_MENU** = ``1``
  192. **NativeMenu** supports native popup menus.
  193. .. _class_NativeMenu_constant_FEATURE_OPEN_CLOSE_CALLBACK:
  194. .. rst-class:: classref-enumeration-constant
  195. :ref:`Feature<enum_NativeMenu_Feature>` **FEATURE_OPEN_CLOSE_CALLBACK** = ``2``
  196. **NativeMenu** supports menu open and close callbacks.
  197. .. _class_NativeMenu_constant_FEATURE_HOVER_CALLBACK:
  198. .. rst-class:: classref-enumeration-constant
  199. :ref:`Feature<enum_NativeMenu_Feature>` **FEATURE_HOVER_CALLBACK** = ``3``
  200. **NativeMenu** supports menu item hover callback.
  201. .. _class_NativeMenu_constant_FEATURE_KEY_CALLBACK:
  202. .. rst-class:: classref-enumeration-constant
  203. :ref:`Feature<enum_NativeMenu_Feature>` **FEATURE_KEY_CALLBACK** = ``4``
  204. **NativeMenu** supports menu item accelerator/key callback.
  205. .. rst-class:: classref-item-separator
  206. ----
  207. .. _enum_NativeMenu_SystemMenus:
  208. .. rst-class:: classref-enumeration
  209. enum **SystemMenus**: :ref:`๐Ÿ”—<enum_NativeMenu_SystemMenus>`
  210. .. _class_NativeMenu_constant_INVALID_MENU_ID:
  211. .. rst-class:: classref-enumeration-constant
  212. :ref:`SystemMenus<enum_NativeMenu_SystemMenus>` **INVALID_MENU_ID** = ``0``
  213. Invalid special system menu ID.
  214. .. _class_NativeMenu_constant_MAIN_MENU_ID:
  215. .. rst-class:: classref-enumeration-constant
  216. :ref:`SystemMenus<enum_NativeMenu_SystemMenus>` **MAIN_MENU_ID** = ``1``
  217. Global main menu ID.
  218. .. _class_NativeMenu_constant_APPLICATION_MENU_ID:
  219. .. rst-class:: classref-enumeration-constant
  220. :ref:`SystemMenus<enum_NativeMenu_SystemMenus>` **APPLICATION_MENU_ID** = ``2``
  221. Application (first menu after "Apple" menu on macOS) menu ID.
  222. .. _class_NativeMenu_constant_WINDOW_MENU_ID:
  223. .. rst-class:: classref-enumeration-constant
  224. :ref:`SystemMenus<enum_NativeMenu_SystemMenus>` **WINDOW_MENU_ID** = ``3``
  225. "Window" menu ID (on macOS this menu includes standard window control items and a list of open windows).
  226. .. _class_NativeMenu_constant_HELP_MENU_ID:
  227. .. rst-class:: classref-enumeration-constant
  228. :ref:`SystemMenus<enum_NativeMenu_SystemMenus>` **HELP_MENU_ID** = ``4``
  229. "Help" menu ID (on macOS this menu includes help search bar).
  230. .. _class_NativeMenu_constant_DOCK_MENU_ID:
  231. .. rst-class:: classref-enumeration-constant
  232. :ref:`SystemMenus<enum_NativeMenu_SystemMenus>` **DOCK_MENU_ID** = ``5``
  233. Dock icon right-click menu ID (on macOS this menu include standard application control items and a list of open windows).
  234. .. rst-class:: classref-section-separator
  235. ----
  236. .. rst-class:: classref-descriptions-group
  237. Method Descriptions
  238. -------------------
  239. .. _class_NativeMenu_method_add_check_item:
  240. .. rst-class:: classref-method
  241. :ref:`int<class_int>` **add_check_item**\ (\ rid\: :ref:`RID<class_RID>`, label\: :ref:`String<class_String>`, callback\: :ref:`Callable<class_Callable>` = Callable(), key_callback\: :ref:`Callable<class_Callable>` = Callable(), tag\: :ref:`Variant<class_Variant>` = null, accelerator\: :ref:`Key<enum_@GlobalScope_Key>` = 0, index\: :ref:`int<class_int>` = -1\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_add_check_item>`
  242. Adds a new checkable item with text ``label`` to the global menu ``rid``.
  243. Returns index of the inserted item, it's not guaranteed to be the same as ``index`` value.
  244. An ``accelerator`` can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The ``accelerator`` 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`).
  245. \ **Note:** The ``callback`` and ``key_callback`` Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to ``tag``.
  246. \ **Note:** This method is implemented on macOS and Windows.
  247. \ **Note:** On Windows, ``accelerator`` and ``key_callback`` are ignored.
  248. .. rst-class:: classref-item-separator
  249. ----
  250. .. _class_NativeMenu_method_add_icon_check_item:
  251. .. rst-class:: classref-method
  252. :ref:`int<class_int>` **add_icon_check_item**\ (\ rid\: :ref:`RID<class_RID>`, icon\: :ref:`Texture2D<class_Texture2D>`, label\: :ref:`String<class_String>`, callback\: :ref:`Callable<class_Callable>` = Callable(), key_callback\: :ref:`Callable<class_Callable>` = Callable(), tag\: :ref:`Variant<class_Variant>` = null, accelerator\: :ref:`Key<enum_@GlobalScope_Key>` = 0, index\: :ref:`int<class_int>` = -1\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_add_icon_check_item>`
  253. Adds a new checkable item with text ``label`` and icon ``icon`` to the global menu ``rid``.
  254. Returns index of the inserted item, it's not guaranteed to be the same as ``index`` value.
  255. An ``accelerator`` can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The ``accelerator`` 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`).
  256. \ **Note:** The ``callback`` and ``key_callback`` Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to ``tag``.
  257. \ **Note:** This method is implemented on macOS and Windows.
  258. \ **Note:** On Windows, ``accelerator`` and ``key_callback`` are ignored.
  259. .. rst-class:: classref-item-separator
  260. ----
  261. .. _class_NativeMenu_method_add_icon_item:
  262. .. rst-class:: classref-method
  263. :ref:`int<class_int>` **add_icon_item**\ (\ rid\: :ref:`RID<class_RID>`, icon\: :ref:`Texture2D<class_Texture2D>`, label\: :ref:`String<class_String>`, callback\: :ref:`Callable<class_Callable>` = Callable(), key_callback\: :ref:`Callable<class_Callable>` = Callable(), tag\: :ref:`Variant<class_Variant>` = null, accelerator\: :ref:`Key<enum_@GlobalScope_Key>` = 0, index\: :ref:`int<class_int>` = -1\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_add_icon_item>`
  264. Adds a new item with text ``label`` and icon ``icon`` to the global menu ``rid``.
  265. Returns index of the inserted item, it's not guaranteed to be the same as ``index`` value.
  266. An ``accelerator`` can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The ``accelerator`` 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`).
  267. \ **Note:** The ``callback`` and ``key_callback`` Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to ``tag``.
  268. \ **Note:** This method is implemented on macOS and Windows.
  269. \ **Note:** On Windows, ``accelerator`` and ``key_callback`` are ignored.
  270. .. rst-class:: classref-item-separator
  271. ----
  272. .. _class_NativeMenu_method_add_icon_radio_check_item:
  273. .. rst-class:: classref-method
  274. :ref:`int<class_int>` **add_icon_radio_check_item**\ (\ rid\: :ref:`RID<class_RID>`, icon\: :ref:`Texture2D<class_Texture2D>`, label\: :ref:`String<class_String>`, callback\: :ref:`Callable<class_Callable>` = Callable(), key_callback\: :ref:`Callable<class_Callable>` = Callable(), tag\: :ref:`Variant<class_Variant>` = null, accelerator\: :ref:`Key<enum_@GlobalScope_Key>` = 0, index\: :ref:`int<class_int>` = -1\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_add_icon_radio_check_item>`
  275. Adds a new radio-checkable item with text ``label`` and icon ``icon`` to the global menu ``rid``.
  276. Returns index of the inserted item, it's not guaranteed to be the same as ``index`` value.
  277. An ``accelerator`` can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The ``accelerator`` 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`).
  278. \ **Note:** Radio-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_NativeMenu_method_set_item_checked>` for more info on how to control it.
  279. \ **Note:** The ``callback`` and ``key_callback`` Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to ``tag``.
  280. \ **Note:** This method is implemented on macOS and Windows.
  281. \ **Note:** On Windows, ``accelerator`` and ``key_callback`` are ignored.
  282. .. rst-class:: classref-item-separator
  283. ----
  284. .. _class_NativeMenu_method_add_item:
  285. .. rst-class:: classref-method
  286. :ref:`int<class_int>` **add_item**\ (\ rid\: :ref:`RID<class_RID>`, label\: :ref:`String<class_String>`, callback\: :ref:`Callable<class_Callable>` = Callable(), key_callback\: :ref:`Callable<class_Callable>` = Callable(), tag\: :ref:`Variant<class_Variant>` = null, accelerator\: :ref:`Key<enum_@GlobalScope_Key>` = 0, index\: :ref:`int<class_int>` = -1\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_add_item>`
  287. Adds a new item with text ``label`` to the global menu ``rid``.
  288. Returns index of the inserted item, it's not guaranteed to be the same as ``index`` value.
  289. An ``accelerator`` can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The ``accelerator`` 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`).
  290. \ **Note:** The ``callback`` and ``key_callback`` Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to ``tag``.
  291. \ **Note:** This method is implemented on macOS and Windows.
  292. \ **Note:** On Windows, ``accelerator`` and ``key_callback`` are ignored.
  293. .. rst-class:: classref-item-separator
  294. ----
  295. .. _class_NativeMenu_method_add_multistate_item:
  296. .. rst-class:: classref-method
  297. :ref:`int<class_int>` **add_multistate_item**\ (\ rid\: :ref:`RID<class_RID>`, label\: :ref:`String<class_String>`, max_states\: :ref:`int<class_int>`, default_state\: :ref:`int<class_int>`, callback\: :ref:`Callable<class_Callable>` = Callable(), key_callback\: :ref:`Callable<class_Callable>` = Callable(), tag\: :ref:`Variant<class_Variant>` = null, accelerator\: :ref:`Key<enum_@GlobalScope_Key>` = 0, index\: :ref:`int<class_int>` = -1\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_add_multistate_item>`
  298. Adds a new item with text ``label`` to the global menu ``rid``.
  299. 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``.
  300. Returns index of the inserted item, it's not guaranteed to be the same as ``index`` value.
  301. An ``accelerator`` can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The ``accelerator`` 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`).
  302. \ **Note:** By default, there's no indication of the current item state, it should be changed manually.
  303. \ **Note:** The ``callback`` and ``key_callback`` Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to ``tag``.
  304. \ **Note:** This method is implemented on macOS and Windows.
  305. \ **Note:** On Windows, ``accelerator`` and ``key_callback`` are ignored.
  306. .. rst-class:: classref-item-separator
  307. ----
  308. .. _class_NativeMenu_method_add_radio_check_item:
  309. .. rst-class:: classref-method
  310. :ref:`int<class_int>` **add_radio_check_item**\ (\ rid\: :ref:`RID<class_RID>`, label\: :ref:`String<class_String>`, callback\: :ref:`Callable<class_Callable>` = Callable(), key_callback\: :ref:`Callable<class_Callable>` = Callable(), tag\: :ref:`Variant<class_Variant>` = null, accelerator\: :ref:`Key<enum_@GlobalScope_Key>` = 0, index\: :ref:`int<class_int>` = -1\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_add_radio_check_item>`
  311. Adds a new radio-checkable item with text ``label`` to the global menu ``rid``.
  312. Returns index of the inserted item, it's not guaranteed to be the same as ``index`` value.
  313. An ``accelerator`` can optionally be defined, which is a keyboard shortcut that can be pressed to trigger the menu button even if it's not currently open. The ``accelerator`` 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`).
  314. \ **Note:** Radio-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_NativeMenu_method_set_item_checked>` for more info on how to control it.
  315. \ **Note:** The ``callback`` and ``key_callback`` Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to ``tag``.
  316. \ **Note:** This method is implemented on macOS and Windows.
  317. \ **Note:** On Windows, ``accelerator`` and ``key_callback`` are ignored.
  318. .. rst-class:: classref-item-separator
  319. ----
  320. .. _class_NativeMenu_method_add_separator:
  321. .. rst-class:: classref-method
  322. :ref:`int<class_int>` **add_separator**\ (\ rid\: :ref:`RID<class_RID>`, index\: :ref:`int<class_int>` = -1\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_add_separator>`
  323. Adds a separator between items to the global menu ``rid``. Separators also occupy an index.
  324. Returns index of the inserted item, it's not guaranteed to be the same as ``index`` value.
  325. \ **Note:** This method is implemented on macOS and Windows.
  326. .. rst-class:: classref-item-separator
  327. ----
  328. .. _class_NativeMenu_method_add_submenu_item:
  329. .. rst-class:: classref-method
  330. :ref:`int<class_int>` **add_submenu_item**\ (\ rid\: :ref:`RID<class_RID>`, label\: :ref:`String<class_String>`, submenu_rid\: :ref:`RID<class_RID>`, tag\: :ref:`Variant<class_Variant>` = null, index\: :ref:`int<class_int>` = -1\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_add_submenu_item>`
  331. Adds an item that will act as a submenu of the global menu ``rid``. The ``submenu_rid`` argument is the RID of the global menu that will be shown when the item is clicked.
  332. Returns index of the inserted item, it's not guaranteed to be the same as ``index`` value.
  333. \ **Note:** This method is implemented on macOS and Windows.
  334. .. rst-class:: classref-item-separator
  335. ----
  336. .. _class_NativeMenu_method_clear:
  337. .. rst-class:: classref-method
  338. |void| **clear**\ (\ rid\: :ref:`RID<class_RID>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_clear>`
  339. Removes all items from the global menu ``rid``.
  340. \ **Note:** This method is implemented on macOS and Windows.
  341. .. rst-class:: classref-item-separator
  342. ----
  343. .. _class_NativeMenu_method_create_menu:
  344. .. rst-class:: classref-method
  345. :ref:`RID<class_RID>` **create_menu**\ (\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_create_menu>`
  346. Creates a new global menu object.
  347. \ **Note:** This method is implemented on macOS and Windows.
  348. .. rst-class:: classref-item-separator
  349. ----
  350. .. _class_NativeMenu_method_find_item_index_with_submenu:
  351. .. rst-class:: classref-method
  352. :ref:`int<class_int>` **find_item_index_with_submenu**\ (\ rid\: :ref:`RID<class_RID>`, submenu_rid\: :ref:`RID<class_RID>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_find_item_index_with_submenu>`
  353. Returns the index of the item with the submenu specified by ``submenu_rid``. Indices are automatically assigned to each item by the engine, and cannot be set manually.
  354. \ **Note:** This method is implemented on macOS and Windows.
  355. .. rst-class:: classref-item-separator
  356. ----
  357. .. _class_NativeMenu_method_find_item_index_with_tag:
  358. .. rst-class:: classref-method
  359. :ref:`int<class_int>` **find_item_index_with_tag**\ (\ rid\: :ref:`RID<class_RID>`, tag\: :ref:`Variant<class_Variant>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_find_item_index_with_tag>`
  360. Returns the index of the item with the specified ``tag``. Indices are automatically assigned to each item by the engine, and cannot be set manually.
  361. \ **Note:** This method is implemented on macOS and Windows.
  362. .. rst-class:: classref-item-separator
  363. ----
  364. .. _class_NativeMenu_method_find_item_index_with_text:
  365. .. rst-class:: classref-method
  366. :ref:`int<class_int>` **find_item_index_with_text**\ (\ rid\: :ref:`RID<class_RID>`, text\: :ref:`String<class_String>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_find_item_index_with_text>`
  367. Returns the index of the item with the specified ``text``. Indices are automatically assigned to each item by the engine, and cannot be set manually.
  368. \ **Note:** This method is implemented on macOS and Windows.
  369. .. rst-class:: classref-item-separator
  370. ----
  371. .. _class_NativeMenu_method_free_menu:
  372. .. rst-class:: classref-method
  373. |void| **free_menu**\ (\ rid\: :ref:`RID<class_RID>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_free_menu>`
  374. Frees a global menu object created by this **NativeMenu**.
  375. \ **Note:** This method is implemented on macOS and Windows.
  376. .. rst-class:: classref-item-separator
  377. ----
  378. .. _class_NativeMenu_method_get_item_accelerator:
  379. .. rst-class:: classref-method
  380. :ref:`Key<enum_@GlobalScope_Key>` **get_item_accelerator**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_get_item_accelerator>`
  381. Returns the accelerator of the item at index ``idx``. Accelerators are special combinations of keys that activate the item, no matter which control is focused.
  382. \ **Note:** This method is implemented only on macOS.
  383. .. rst-class:: classref-item-separator
  384. ----
  385. .. _class_NativeMenu_method_get_item_callback:
  386. .. rst-class:: classref-method
  387. :ref:`Callable<class_Callable>` **get_item_callback**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_get_item_callback>`
  388. Returns the callback of the item at index ``idx``.
  389. \ **Note:** This method is implemented on macOS and Windows.
  390. .. rst-class:: classref-item-separator
  391. ----
  392. .. _class_NativeMenu_method_get_item_count:
  393. .. rst-class:: classref-method
  394. :ref:`int<class_int>` **get_item_count**\ (\ rid\: :ref:`RID<class_RID>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_get_item_count>`
  395. Returns number of items in the global menu ``rid``.
  396. \ **Note:** This method is implemented on macOS and Windows.
  397. .. rst-class:: classref-item-separator
  398. ----
  399. .. _class_NativeMenu_method_get_item_icon:
  400. .. rst-class:: classref-method
  401. :ref:`Texture2D<class_Texture2D>` **get_item_icon**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_get_item_icon>`
  402. Returns the icon of the item at index ``idx``.
  403. \ **Note:** This method is implemented on macOS and Windows.
  404. .. rst-class:: classref-item-separator
  405. ----
  406. .. _class_NativeMenu_method_get_item_indentation_level:
  407. .. rst-class:: classref-method
  408. :ref:`int<class_int>` **get_item_indentation_level**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_get_item_indentation_level>`
  409. Returns the horizontal offset of the item at the given ``idx``.
  410. \ **Note:** This method is implemented only on macOS.
  411. .. rst-class:: classref-item-separator
  412. ----
  413. .. _class_NativeMenu_method_get_item_key_callback:
  414. .. rst-class:: classref-method
  415. :ref:`Callable<class_Callable>` **get_item_key_callback**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_get_item_key_callback>`
  416. Returns the callback of the item accelerator at index ``idx``.
  417. \ **Note:** This method is implemented only on macOS.
  418. .. rst-class:: classref-item-separator
  419. ----
  420. .. _class_NativeMenu_method_get_item_max_states:
  421. .. rst-class:: classref-method
  422. :ref:`int<class_int>` **get_item_max_states**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_get_item_max_states>`
  423. Returns number of states of a multistate item. See :ref:`add_multistate_item<class_NativeMenu_method_add_multistate_item>` for details.
  424. \ **Note:** This method is implemented on macOS and Windows.
  425. .. rst-class:: classref-item-separator
  426. ----
  427. .. _class_NativeMenu_method_get_item_state:
  428. .. rst-class:: classref-method
  429. :ref:`int<class_int>` **get_item_state**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_get_item_state>`
  430. Returns the state of a multistate item. See :ref:`add_multistate_item<class_NativeMenu_method_add_multistate_item>` for details.
  431. \ **Note:** This method is implemented on macOS and Windows.
  432. .. rst-class:: classref-item-separator
  433. ----
  434. .. _class_NativeMenu_method_get_item_submenu:
  435. .. rst-class:: classref-method
  436. :ref:`RID<class_RID>` **get_item_submenu**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_get_item_submenu>`
  437. Returns the submenu ID of the item at index ``idx``. See :ref:`add_submenu_item<class_NativeMenu_method_add_submenu_item>` for more info on how to add a submenu.
  438. \ **Note:** This method is implemented on macOS and Windows.
  439. .. rst-class:: classref-item-separator
  440. ----
  441. .. _class_NativeMenu_method_get_item_tag:
  442. .. rst-class:: classref-method
  443. :ref:`Variant<class_Variant>` **get_item_tag**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_get_item_tag>`
  444. Returns the metadata of the specified item, which might be of any type. You can set it with :ref:`set_item_tag<class_NativeMenu_method_set_item_tag>`, which provides a simple way of assigning context data to items.
  445. \ **Note:** This method is implemented on macOS and Windows.
  446. .. rst-class:: classref-item-separator
  447. ----
  448. .. _class_NativeMenu_method_get_item_text:
  449. .. rst-class:: classref-method
  450. :ref:`String<class_String>` **get_item_text**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_get_item_text>`
  451. Returns the text of the item at index ``idx``.
  452. \ **Note:** This method is implemented on macOS and Windows.
  453. .. rst-class:: classref-item-separator
  454. ----
  455. .. _class_NativeMenu_method_get_item_tooltip:
  456. .. rst-class:: classref-method
  457. :ref:`String<class_String>` **get_item_tooltip**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_get_item_tooltip>`
  458. Returns the tooltip associated with the specified index ``idx``.
  459. \ **Note:** This method is implemented only on macOS.
  460. .. rst-class:: classref-item-separator
  461. ----
  462. .. _class_NativeMenu_method_get_minimum_width:
  463. .. rst-class:: classref-method
  464. :ref:`float<class_float>` **get_minimum_width**\ (\ rid\: :ref:`RID<class_RID>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_get_minimum_width>`
  465. Returns global menu minimum width.
  466. \ **Note:** This method is implemented only on macOS.
  467. .. rst-class:: classref-item-separator
  468. ----
  469. .. _class_NativeMenu_method_get_popup_close_callback:
  470. .. rst-class:: classref-method
  471. :ref:`Callable<class_Callable>` **get_popup_close_callback**\ (\ rid\: :ref:`RID<class_RID>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_get_popup_close_callback>`
  472. Returns global menu close callback.
  473. b]Note:** This method is implemented only on macOS.
  474. .. rst-class:: classref-item-separator
  475. ----
  476. .. _class_NativeMenu_method_get_popup_open_callback:
  477. .. rst-class:: classref-method
  478. :ref:`Callable<class_Callable>` **get_popup_open_callback**\ (\ rid\: :ref:`RID<class_RID>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_get_popup_open_callback>`
  479. Returns global menu open callback.
  480. b]Note:** This method is implemented only on macOS.
  481. .. rst-class:: classref-item-separator
  482. ----
  483. .. _class_NativeMenu_method_get_size:
  484. .. rst-class:: classref-method
  485. :ref:`Vector2<class_Vector2>` **get_size**\ (\ rid\: :ref:`RID<class_RID>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_get_size>`
  486. Returns global menu size.
  487. \ **Note:** This method is implemented on macOS and Windows.
  488. .. rst-class:: classref-item-separator
  489. ----
  490. .. _class_NativeMenu_method_get_system_menu:
  491. .. rst-class:: classref-method
  492. :ref:`RID<class_RID>` **get_system_menu**\ (\ menu_id\: :ref:`SystemMenus<enum_NativeMenu_SystemMenus>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_get_system_menu>`
  493. Returns RID of a special system menu.
  494. \ **Note:** This method is implemented only on macOS.
  495. .. rst-class:: classref-item-separator
  496. ----
  497. .. _class_NativeMenu_method_get_system_menu_name:
  498. .. rst-class:: classref-method
  499. :ref:`String<class_String>` **get_system_menu_name**\ (\ menu_id\: :ref:`SystemMenus<enum_NativeMenu_SystemMenus>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_get_system_menu_name>`
  500. Returns readable name of a special system menu.
  501. \ **Note:** This method is implemented only on macOS.
  502. .. rst-class:: classref-item-separator
  503. ----
  504. .. _class_NativeMenu_method_has_feature:
  505. .. rst-class:: classref-method
  506. :ref:`bool<class_bool>` **has_feature**\ (\ feature\: :ref:`Feature<enum_NativeMenu_Feature>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_has_feature>`
  507. Returns ``true`` if the specified ``feature`` is supported by the current **NativeMenu**, ``false`` otherwise.
  508. \ **Note:** This method is implemented on macOS and Windows.
  509. .. rst-class:: classref-item-separator
  510. ----
  511. .. _class_NativeMenu_method_has_menu:
  512. .. rst-class:: classref-method
  513. :ref:`bool<class_bool>` **has_menu**\ (\ rid\: :ref:`RID<class_RID>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_has_menu>`
  514. Returns ``true`` if ``rid`` is valid global menu.
  515. \ **Note:** This method is implemented on macOS and Windows.
  516. .. rst-class:: classref-item-separator
  517. ----
  518. .. _class_NativeMenu_method_has_system_menu:
  519. .. rst-class:: classref-method
  520. :ref:`bool<class_bool>` **has_system_menu**\ (\ menu_id\: :ref:`SystemMenus<enum_NativeMenu_SystemMenus>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_has_system_menu>`
  521. Returns ``true`` if a special system menu is supported.
  522. \ **Note:** This method is implemented only on macOS.
  523. .. rst-class:: classref-item-separator
  524. ----
  525. .. _class_NativeMenu_method_is_item_checkable:
  526. .. rst-class:: classref-method
  527. :ref:`bool<class_bool>` **is_item_checkable**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_is_item_checkable>`
  528. Returns ``true`` if the item at index ``idx`` is checkable in some way, i.e. if it has a checkbox or radio button.
  529. \ **Note:** This method is implemented on macOS and Windows.
  530. .. rst-class:: classref-item-separator
  531. ----
  532. .. _class_NativeMenu_method_is_item_checked:
  533. .. rst-class:: classref-method
  534. :ref:`bool<class_bool>` **is_item_checked**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_is_item_checked>`
  535. Returns ``true`` if the item at index ``idx`` is checked.
  536. \ **Note:** This method is implemented on macOS and Windows.
  537. .. rst-class:: classref-item-separator
  538. ----
  539. .. _class_NativeMenu_method_is_item_disabled:
  540. .. rst-class:: classref-method
  541. :ref:`bool<class_bool>` **is_item_disabled**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_is_item_disabled>`
  542. Returns ``true`` if the item at index ``idx`` is disabled. When it is disabled it can't be selected, or its action invoked.
  543. See :ref:`set_item_disabled<class_NativeMenu_method_set_item_disabled>` for more info on how to disable an item.
  544. \ **Note:** This method is implemented on macOS and Windows.
  545. .. rst-class:: classref-item-separator
  546. ----
  547. .. _class_NativeMenu_method_is_item_hidden:
  548. .. rst-class:: classref-method
  549. :ref:`bool<class_bool>` **is_item_hidden**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_is_item_hidden>`
  550. Returns ``true`` if the item at index ``idx`` is hidden.
  551. See :ref:`set_item_hidden<class_NativeMenu_method_set_item_hidden>` for more info on how to hide an item.
  552. \ **Note:** This method is implemented only on macOS.
  553. .. rst-class:: classref-item-separator
  554. ----
  555. .. _class_NativeMenu_method_is_item_radio_checkable:
  556. .. rst-class:: classref-method
  557. :ref:`bool<class_bool>` **is_item_radio_checkable**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_is_item_radio_checkable>`
  558. Returns ``true`` if the item at index ``idx`` has radio button-style checkability.
  559. \ **Note:** This is purely cosmetic; you must add the logic for checking/unchecking items in radio groups.
  560. \ **Note:** This method is implemented on macOS and Windows.
  561. .. rst-class:: classref-item-separator
  562. ----
  563. .. _class_NativeMenu_method_is_opened:
  564. .. rst-class:: classref-method
  565. :ref:`bool<class_bool>` **is_opened**\ (\ rid\: :ref:`RID<class_RID>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_is_opened>`
  566. Returns ``true`` if the menu is currently opened.
  567. \ **Note:** This method is implemented only on macOS.
  568. .. rst-class:: classref-item-separator
  569. ----
  570. .. _class_NativeMenu_method_is_system_menu:
  571. .. rst-class:: classref-method
  572. :ref:`bool<class_bool>` **is_system_menu**\ (\ rid\: :ref:`RID<class_RID>`\ ) |const| :ref:`๐Ÿ”—<class_NativeMenu_method_is_system_menu>`
  573. Return ``true`` is global menu is a special system menu.
  574. \ **Note:** This method is implemented only on macOS.
  575. .. rst-class:: classref-item-separator
  576. ----
  577. .. _class_NativeMenu_method_popup:
  578. .. rst-class:: classref-method
  579. |void| **popup**\ (\ rid\: :ref:`RID<class_RID>`, position\: :ref:`Vector2i<class_Vector2i>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_popup>`
  580. Shows the global menu at ``position`` in the screen coordinates.
  581. \ **Note:** This method is implemented on macOS and Windows.
  582. .. rst-class:: classref-item-separator
  583. ----
  584. .. _class_NativeMenu_method_remove_item:
  585. .. rst-class:: classref-method
  586. |void| **remove_item**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_remove_item>`
  587. Removes the item at index ``idx`` from the global menu ``rid``.
  588. \ **Note:** The indices of items after the removed item will be shifted by one.
  589. \ **Note:** This method is implemented on macOS and Windows.
  590. .. rst-class:: classref-item-separator
  591. ----
  592. .. _class_NativeMenu_method_set_interface_direction:
  593. .. rst-class:: classref-method
  594. |void| **set_interface_direction**\ (\ rid\: :ref:`RID<class_RID>`, is_rtl\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_set_interface_direction>`
  595. Sets the menu text layout direction from right-to-left if ``is_rtl`` is ``true``.
  596. \ **Note:** This method is implemented on macOS and Windows.
  597. .. rst-class:: classref-item-separator
  598. ----
  599. .. _class_NativeMenu_method_set_item_accelerator:
  600. .. rst-class:: classref-method
  601. |void| **set_item_accelerator**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, keycode\: :ref:`Key<enum_@GlobalScope_Key>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_set_item_accelerator>`
  602. Sets the accelerator of the item at index ``idx``. ``keycode`` can be a single :ref:`Key<enum_@GlobalScope_Key>`, or 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. \ **Note:** This method is implemented only on macOS.
  604. .. rst-class:: classref-item-separator
  605. ----
  606. .. _class_NativeMenu_method_set_item_callback:
  607. .. rst-class:: classref-method
  608. |void| **set_item_callback**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, callback\: :ref:`Callable<class_Callable>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_set_item_callback>`
  609. Sets the callback of the item at index ``idx``. Callback is emitted when an item is pressed.
  610. \ **Note:** The ``callback`` Callable needs to accept exactly one Variant parameter, the parameter passed to the Callable will be the value passed to the ``tag`` parameter when the menu item was created.
  611. \ **Note:** This method is implemented on macOS and Windows.
  612. .. rst-class:: classref-item-separator
  613. ----
  614. .. _class_NativeMenu_method_set_item_checkable:
  615. .. rst-class:: classref-method
  616. |void| **set_item_checkable**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, checkable\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_set_item_checkable>`
  617. Sets whether the item at index ``idx`` has a checkbox. If ``false``, sets the type of the item to plain text.
  618. \ **Note:** This method is implemented on macOS and Windows.
  619. .. rst-class:: classref-item-separator
  620. ----
  621. .. _class_NativeMenu_method_set_item_checked:
  622. .. rst-class:: classref-method
  623. |void| **set_item_checked**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, checked\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_set_item_checked>`
  624. Sets the checkstate status of the item at index ``idx``.
  625. \ **Note:** This method is implemented on macOS and Windows.
  626. .. rst-class:: classref-item-separator
  627. ----
  628. .. _class_NativeMenu_method_set_item_disabled:
  629. .. rst-class:: classref-method
  630. |void| **set_item_disabled**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, disabled\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_set_item_disabled>`
  631. Enables/disables the item at index ``idx``. When it is disabled, it can't be selected and its action can't be invoked.
  632. \ **Note:** This method is implemented on macOS and Windows.
  633. .. rst-class:: classref-item-separator
  634. ----
  635. .. _class_NativeMenu_method_set_item_hidden:
  636. .. rst-class:: classref-method
  637. |void| **set_item_hidden**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, hidden\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_set_item_hidden>`
  638. Hides/shows the item at index ``idx``. When it is hidden, an item does not appear in a menu and its action cannot be invoked.
  639. \ **Note:** This method is implemented only on macOS.
  640. .. rst-class:: classref-item-separator
  641. ----
  642. .. _class_NativeMenu_method_set_item_hover_callbacks:
  643. .. rst-class:: classref-method
  644. |void| **set_item_hover_callbacks**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, callback\: :ref:`Callable<class_Callable>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_set_item_hover_callbacks>`
  645. Sets the callback of the item at index ``idx``. The callback is emitted when an item is hovered.
  646. \ **Note:** The ``callback`` Callable needs to accept exactly one Variant parameter, the parameter passed to the Callable will be the value passed to the ``tag`` parameter when the menu item was created.
  647. \ **Note:** This method is implemented only on macOS.
  648. .. rst-class:: classref-item-separator
  649. ----
  650. .. _class_NativeMenu_method_set_item_icon:
  651. .. rst-class:: classref-method
  652. |void| **set_item_icon**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, icon\: :ref:`Texture2D<class_Texture2D>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_set_item_icon>`
  653. Replaces the :ref:`Texture2D<class_Texture2D>` icon of the specified ``idx``.
  654. \ **Note:** This method is implemented on macOS and Windows.
  655. \ **Note:** This method is not supported by macOS Dock menu items.
  656. .. rst-class:: classref-item-separator
  657. ----
  658. .. _class_NativeMenu_method_set_item_indentation_level:
  659. .. rst-class:: classref-method
  660. |void| **set_item_indentation_level**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, level\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_set_item_indentation_level>`
  661. Sets the horizontal offset of the item at the given ``idx``.
  662. \ **Note:** This method is implemented only on macOS.
  663. .. rst-class:: classref-item-separator
  664. ----
  665. .. _class_NativeMenu_method_set_item_key_callback:
  666. .. rst-class:: classref-method
  667. |void| **set_item_key_callback**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, key_callback\: :ref:`Callable<class_Callable>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_set_item_key_callback>`
  668. Sets the callback of the item at index ``idx``. Callback is emitted when its accelerator is activated.
  669. \ **Note:** The ``key_callback`` Callable needs to accept exactly one Variant parameter, the parameter passed to the Callable will be the value passed to the ``tag`` parameter when the menu item was created.
  670. \ **Note:** This method is implemented only on macOS.
  671. .. rst-class:: classref-item-separator
  672. ----
  673. .. _class_NativeMenu_method_set_item_max_states:
  674. .. rst-class:: classref-method
  675. |void| **set_item_max_states**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, max_states\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_set_item_max_states>`
  676. Sets number of state of a multistate item. See :ref:`add_multistate_item<class_NativeMenu_method_add_multistate_item>` for details.
  677. \ **Note:** This method is implemented on macOS and Windows.
  678. .. rst-class:: classref-item-separator
  679. ----
  680. .. _class_NativeMenu_method_set_item_radio_checkable:
  681. .. rst-class:: classref-method
  682. |void| **set_item_radio_checkable**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, checkable\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_set_item_radio_checkable>`
  683. Sets the type of the item at the specified index ``idx`` to radio button. If ``false``, sets the type of the item to plain text.
  684. \ **Note:** This is purely cosmetic; you must add the logic for checking/unchecking items in radio groups.
  685. \ **Note:** This method is implemented on macOS and Windows.
  686. .. rst-class:: classref-item-separator
  687. ----
  688. .. _class_NativeMenu_method_set_item_state:
  689. .. rst-class:: classref-method
  690. |void| **set_item_state**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, state\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_set_item_state>`
  691. Sets the state of a multistate item. See :ref:`add_multistate_item<class_NativeMenu_method_add_multistate_item>` for details.
  692. \ **Note:** This method is implemented on macOS and Windows.
  693. .. rst-class:: classref-item-separator
  694. ----
  695. .. _class_NativeMenu_method_set_item_submenu:
  696. .. rst-class:: classref-method
  697. |void| **set_item_submenu**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, submenu_rid\: :ref:`RID<class_RID>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_set_item_submenu>`
  698. Sets the submenu RID of the item at index ``idx``. The submenu is a global menu that would be shown when the item is clicked.
  699. \ **Note:** This method is implemented on macOS and Windows.
  700. .. rst-class:: classref-item-separator
  701. ----
  702. .. _class_NativeMenu_method_set_item_tag:
  703. .. rst-class:: classref-method
  704. |void| **set_item_tag**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, tag\: :ref:`Variant<class_Variant>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_set_item_tag>`
  705. Sets the metadata of an item, which may be of any type. You can later get it with :ref:`get_item_tag<class_NativeMenu_method_get_item_tag>`, which provides a simple way of assigning context data to items.
  706. \ **Note:** This method is implemented on macOS and Windows.
  707. .. rst-class:: classref-item-separator
  708. ----
  709. .. _class_NativeMenu_method_set_item_text:
  710. .. rst-class:: classref-method
  711. |void| **set_item_text**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, text\: :ref:`String<class_String>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_set_item_text>`
  712. Sets the text of the item at index ``idx``.
  713. \ **Note:** This method is implemented on macOS and Windows.
  714. .. rst-class:: classref-item-separator
  715. ----
  716. .. _class_NativeMenu_method_set_item_tooltip:
  717. .. rst-class:: classref-method
  718. |void| **set_item_tooltip**\ (\ rid\: :ref:`RID<class_RID>`, idx\: :ref:`int<class_int>`, tooltip\: :ref:`String<class_String>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_set_item_tooltip>`
  719. Sets the :ref:`String<class_String>` tooltip of the item at the specified index ``idx``.
  720. \ **Note:** This method is implemented only on macOS.
  721. .. rst-class:: classref-item-separator
  722. ----
  723. .. _class_NativeMenu_method_set_minimum_width:
  724. .. rst-class:: classref-method
  725. |void| **set_minimum_width**\ (\ rid\: :ref:`RID<class_RID>`, width\: :ref:`float<class_float>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_set_minimum_width>`
  726. Sets the minimum width of the global menu.
  727. \ **Note:** This method is implemented only on macOS.
  728. .. rst-class:: classref-item-separator
  729. ----
  730. .. _class_NativeMenu_method_set_popup_close_callback:
  731. .. rst-class:: classref-method
  732. |void| **set_popup_close_callback**\ (\ rid\: :ref:`RID<class_RID>`, callback\: :ref:`Callable<class_Callable>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_set_popup_close_callback>`
  733. Registers callable to emit when the menu is about to show.
  734. \ **Note:** The OS can simulate menu opening to track menu item changes and global shortcuts, in which case the corresponding close callback is not triggered. Use :ref:`is_opened<class_NativeMenu_method_is_opened>` to check if the menu is currently opened.
  735. \ **Note:** This method is implemented only on macOS.
  736. .. rst-class:: classref-item-separator
  737. ----
  738. .. _class_NativeMenu_method_set_popup_open_callback:
  739. .. rst-class:: classref-method
  740. |void| **set_popup_open_callback**\ (\ rid\: :ref:`RID<class_RID>`, callback\: :ref:`Callable<class_Callable>`\ ) :ref:`๐Ÿ”—<class_NativeMenu_method_set_popup_open_callback>`
  741. Registers callable to emit after the menu is closed.
  742. \ **Note:** This method is implemented only on macOS.
  743. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  744. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  745. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  746. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  747. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  748. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  749. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  750. .. |void| replace:: :abbr:`void (No return value.)`