[NativeMenu] Implement native popup menu support on Windows.
This commit is contained in:
@ -5,6 +5,35 @@
|
||||
</brief_description>
|
||||
<description>
|
||||
[NativeMenu] handles low-level access to the OS native global menu bar and popup menus.
|
||||
[b]Note:[/b] This is low-level API, consider using [MenuBar] with [member MenuBar.prefer_global_menu] set to [code]true[/code], and [PopupMenu] with [member PopupMenu.prefer_native_menu] set to [code]true[/code].
|
||||
To create a menu, use [method create_menu], add menu items using [code]add_*_item[/code] methods. To remove a menu, use [method free_menu].
|
||||
[codeblock]
|
||||
var menu
|
||||
|
||||
func _menu_callback(item_id):
|
||||
if item_id == "ITEM_CUT":
|
||||
cut()
|
||||
elif item_id == "ITEM_COPY":
|
||||
copy()
|
||||
elif item_id == "ITEM_PASTE":
|
||||
paste()
|
||||
|
||||
func _enter_tree():
|
||||
# Create new menu and add items:
|
||||
menu = NativeMenu.create_menu()
|
||||
NativeMenu.add_item(menu, "Cut", _menu_callback, Callable(), "ITEM_CUT")
|
||||
NativeMenu.add_item(menu, "Copy", _menu_callback, Callable(), "ITEM_COPY")
|
||||
NativeMenu.add_separator(menu)
|
||||
NativeMenu.add_item(menu, "Paste", _menu_callback, Callable(), "ITEM_PASTE")
|
||||
|
||||
func _on_button_pressed():
|
||||
# Show popup menu at mouse position:
|
||||
NativeMenu.popup(menu, DisplayServer.mouse_get_position())
|
||||
|
||||
func _exit_tree():
|
||||
# Remove menu when it's no longer needed:
|
||||
NativeMenu.free_menu(menu)
|
||||
[/codeblock]
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
@ -23,7 +52,8 @@
|
||||
Returns index of the inserted item, it's not guaranteed to be the same as [param index] value.
|
||||
An [param 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 [param accelerator] is generally a combination of [enum KeyModifierMask]s and [enum Key]s using bitwise OR such as [code]KEY_MASK_CTRL | KEY_A[/code] ([kbd]Ctrl + A[/kbd]).
|
||||
[b]Note:[/b] The [param callback] and [param key_callback] Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to [param tag].
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
[b]Note:[/b] [param accelerator] and [param key_callback] are ignored on Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="add_icon_check_item">
|
||||
@ -41,7 +71,8 @@
|
||||
Returns index of the inserted item, it's not guaranteed to be the same as [param index] value.
|
||||
An [param 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 [param accelerator] is generally a combination of [enum KeyModifierMask]s and [enum Key]s using bitwise OR such as [code]KEY_MASK_CTRL | KEY_A[/code] ([kbd]Ctrl + A[/kbd]).
|
||||
[b]Note:[/b] The [param callback] and [param key_callback] Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to [param tag].
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
[b]Note:[/b] [param accelerator] and [param key_callback] are ignored on Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="add_icon_item">
|
||||
@ -59,7 +90,8 @@
|
||||
Returns index of the inserted item, it's not guaranteed to be the same as [param index] value.
|
||||
An [param 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 [param accelerator] is generally a combination of [enum KeyModifierMask]s and [enum Key]s using bitwise OR such as [code]KEY_MASK_CTRL | KEY_A[/code] ([kbd]Ctrl + A[/kbd]).
|
||||
[b]Note:[/b] The [param callback] and [param key_callback] Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to [param tag].
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
[b]Note:[/b] [param accelerator] and [param key_callback] are ignored on Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="add_icon_radio_check_item">
|
||||
@ -78,7 +110,8 @@
|
||||
An [param 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 [param accelerator] is generally a combination of [enum KeyModifierMask]s and [enum Key]s using bitwise OR such as [code]KEY_MASK_CTRL | KEY_A[/code] ([kbd]Ctrl + A[/kbd]).
|
||||
[b]Note:[/b] Radio-checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See [method set_item_checked] for more info on how to control it.
|
||||
[b]Note:[/b] The [param callback] and [param key_callback] Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to [param tag].
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
[b]Note:[/b] [param accelerator] and [param key_callback] are ignored on Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="add_item">
|
||||
@ -95,7 +128,8 @@
|
||||
Returns index of the inserted item, it's not guaranteed to be the same as [param index] value.
|
||||
An [param 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 [param accelerator] is generally a combination of [enum KeyModifierMask]s and [enum Key]s using bitwise OR such as [code]KEY_MASK_CTRL | KEY_A[/code] ([kbd]Ctrl + A[/kbd]).
|
||||
[b]Note:[/b] The [param callback] and [param key_callback] Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to [param tag].
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
[b]Note:[/b] [param accelerator] and [param key_callback] are ignored on Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="add_multistate_item">
|
||||
@ -116,7 +150,8 @@
|
||||
An [param 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 [param accelerator] is generally a combination of [enum KeyModifierMask]s and [enum Key]s using bitwise OR such as [code]KEY_MASK_CTRL | KEY_A[/code] ([kbd]Ctrl + A[/kbd]).
|
||||
[b]Note:[/b] By default, there's no indication of the current item state, it should be changed manually.
|
||||
[b]Note:[/b] The [param callback] and [param key_callback] Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to [param tag].
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
[b]Note:[/b] [param accelerator] and [param key_callback] are ignored on Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="add_radio_check_item">
|
||||
@ -134,7 +169,8 @@
|
||||
An [param 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 [param accelerator] is generally a combination of [enum KeyModifierMask]s and [enum Key]s using bitwise OR such as [code]KEY_MASK_CTRL | KEY_A[/code] ([kbd]Ctrl + A[/kbd]).
|
||||
[b]Note:[/b] Radio-checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See [method set_item_checked] for more info on how to control it.
|
||||
[b]Note:[/b] The [param callback] and [param key_callback] Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to [param tag].
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
[b]Note:[/b] [param accelerator] and [param key_callback] are ignored on Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="add_separator">
|
||||
@ -144,7 +180,7 @@
|
||||
<description>
|
||||
Adds a separator between items to the global menu [param rid]. Separators also occupy an index.
|
||||
Returns index of the inserted item, it's not guaranteed to be the same as [param index] value.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="add_submenu_item">
|
||||
@ -157,7 +193,7 @@
|
||||
<description>
|
||||
Adds an item that will act as a submenu of the global menu [param rid]. The [param submenu_rid] argument is the RID of the global menu that will be shown when the item is clicked.
|
||||
Returns index of the inserted item, it's not guaranteed to be the same as [param index] value.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="clear">
|
||||
@ -165,14 +201,14 @@
|
||||
<param index="0" name="rid" type="RID" />
|
||||
<description>
|
||||
Removes all items from the global menu [param rid].
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="create_menu">
|
||||
<return type="RID" />
|
||||
<description>
|
||||
Creates a new global menu object.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="find_item_index_with_tag" qualifiers="const">
|
||||
@ -181,7 +217,7 @@
|
||||
<param index="1" name="tag" type="Variant" />
|
||||
<description>
|
||||
Returns the index of the item with the specified [param tag]. Index is automatically assigned to each item by the engine. Index can not be set manually.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="find_item_index_with_text" qualifiers="const">
|
||||
@ -190,7 +226,7 @@
|
||||
<param index="1" name="text" type="String" />
|
||||
<description>
|
||||
Returns the index of the item with the specified [param text]. Index is automatically assigned to each item by the engine. Index can not be set manually.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="free_menu">
|
||||
@ -198,7 +234,7 @@
|
||||
<param index="0" name="rid" type="RID" />
|
||||
<description>
|
||||
Frees a global menu object created by this [NativeMenu].
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_item_accelerator" qualifiers="const">
|
||||
@ -216,7 +252,7 @@
|
||||
<param index="1" name="idx" type="int" />
|
||||
<description>
|
||||
Returns the callback of the item at index [param idx].
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_item_count" qualifiers="const">
|
||||
@ -224,7 +260,7 @@
|
||||
<param index="0" name="rid" type="RID" />
|
||||
<description>
|
||||
Returns number of items in the global menu [param rid].
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_item_icon" qualifiers="const">
|
||||
@ -233,7 +269,7 @@
|
||||
<param index="1" name="idx" type="int" />
|
||||
<description>
|
||||
Returns the icon of the item at index [param idx].
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_item_indentation_level" qualifiers="const">
|
||||
@ -260,7 +296,7 @@
|
||||
<param index="1" name="idx" type="int" />
|
||||
<description>
|
||||
Returns number of states of a multistate item. See [method add_multistate_item] for details.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_item_state" qualifiers="const">
|
||||
@ -269,7 +305,7 @@
|
||||
<param index="1" name="idx" type="int" />
|
||||
<description>
|
||||
Returns the state of a multistate item. See [method add_multistate_item] for details.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_item_submenu" qualifiers="const">
|
||||
@ -278,7 +314,7 @@
|
||||
<param index="1" name="idx" type="int" />
|
||||
<description>
|
||||
Returns the submenu ID of the item at index [param idx]. See [method add_submenu_item] for more info on how to add a submenu.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_item_tag" qualifiers="const">
|
||||
@ -287,7 +323,7 @@
|
||||
<param index="1" name="idx" type="int" />
|
||||
<description>
|
||||
Returns the metadata of the specified item, which might be of any type. You can set it with [method set_item_tag], which provides a simple way of assigning context data to items.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_item_text" qualifiers="const">
|
||||
@ -296,7 +332,7 @@
|
||||
<param index="1" name="idx" type="int" />
|
||||
<description>
|
||||
Returns the text of the item at index [param idx].
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_item_tooltip" qualifiers="const">
|
||||
@ -337,7 +373,7 @@
|
||||
<param index="0" name="rid" type="RID" />
|
||||
<description>
|
||||
Returns global menu size.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_system_menu" qualifiers="const">
|
||||
@ -361,7 +397,7 @@
|
||||
<param index="0" name="feature" type="int" enum="NativeMenu.Feature" />
|
||||
<description>
|
||||
Returns [code]true[/code] if the specified [param feature] is supported by the current [NativeMenu], [code]false[/code] otherwise.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="has_menu" qualifiers="const">
|
||||
@ -369,7 +405,7 @@
|
||||
<param index="0" name="rid" type="RID" />
|
||||
<description>
|
||||
Returns [code]true[/code] if [param rid] is valid global menu.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="has_system_menu" qualifiers="const">
|
||||
@ -386,7 +422,7 @@
|
||||
<param index="1" name="idx" type="int" />
|
||||
<description>
|
||||
Returns [code]true[/code] if the item at index [param idx] is checkable in some way, i.e. if it has a checkbox or radio button.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_item_checked" qualifiers="const">
|
||||
@ -395,7 +431,7 @@
|
||||
<param index="1" name="idx" type="int" />
|
||||
<description>
|
||||
Returns [code]true[/code] if the item at index [param idx] is checked.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_item_disabled" qualifiers="const">
|
||||
@ -405,7 +441,7 @@
|
||||
<description>
|
||||
Returns [code]true[/code] if the item at index [param idx] is disabled. When it is disabled it can't be selected, or its action invoked.
|
||||
See [method set_item_disabled] for more info on how to disable an item.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_item_hidden" qualifiers="const">
|
||||
@ -425,7 +461,7 @@
|
||||
<description>
|
||||
Returns [code]true[/code] if the item at index [param idx] has radio button-style checkability.
|
||||
[b]Note:[/b] This is purely cosmetic; you must add the logic for checking/unchecking items in radio groups.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_system_menu" qualifiers="const">
|
||||
@ -442,7 +478,7 @@
|
||||
<param index="1" name="position" type="Vector2i" />
|
||||
<description>
|
||||
Shows the global menu at [param position] in the screen coordinates.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="remove_item">
|
||||
@ -452,7 +488,16 @@
|
||||
<description>
|
||||
Removes the item at index [param idx] from the global menu [param rid].
|
||||
[b]Note:[/b] The indices of items after the removed item will be shifted by one.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_interface_direction">
|
||||
<return type="void" />
|
||||
<param index="0" name="rid" type="RID" />
|
||||
<param index="1" name="is_rtl" type="bool" />
|
||||
<description>
|
||||
Sets the menu text layout directtion.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_item_accelerator">
|
||||
@ -473,7 +518,7 @@
|
||||
<description>
|
||||
Sets the callback of the item at index [param idx]. Callback is emitted when an item is pressed.
|
||||
[b]Note:[/b] The [param callback] Callable needs to accept exactly one Variant parameter, the parameter passed to the Callable will be the value passed to the [code]tag[/code] parameter when the menu item was created.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_item_checkable">
|
||||
@ -483,7 +528,7 @@
|
||||
<param index="2" name="checkable" type="bool" />
|
||||
<description>
|
||||
Sets whether the item at index [param idx] has a checkbox. If [code]false[/code], sets the type of the item to plain text.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_item_checked">
|
||||
@ -493,7 +538,7 @@
|
||||
<param index="2" name="checked" type="bool" />
|
||||
<description>
|
||||
Sets the checkstate status of the item at index [param idx].
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_item_disabled">
|
||||
@ -503,7 +548,7 @@
|
||||
<param index="2" name="disabled" type="bool" />
|
||||
<description>
|
||||
Enables/disables the item at index [param idx]. When it is disabled, it can't be selected and its action can't be invoked.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_item_hidden">
|
||||
@ -534,8 +579,8 @@
|
||||
<param index="2" name="icon" type="Texture2D" />
|
||||
<description>
|
||||
Replaces the [Texture2D] icon of the specified [param idx].
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is not supported by macOS "_dock" menu items.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
[b]Note:[/b] This method is not supported by macOS Dock menu items.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_item_indentation_level">
|
||||
@ -566,7 +611,7 @@
|
||||
<param index="2" name="max_states" type="int" />
|
||||
<description>
|
||||
Sets number of state of a multistate item. See [method add_multistate_item] for details.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_item_radio_checkable">
|
||||
@ -577,7 +622,7 @@
|
||||
<description>
|
||||
Sets the type of the item at the specified index [param idx] to radio button. If [code]false[/code], sets the type of the item to plain text.
|
||||
[b]Note:[/b] This is purely cosmetic; you must add the logic for checking/unchecking items in radio groups.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_item_state">
|
||||
@ -587,7 +632,7 @@
|
||||
<param index="2" name="state" type="int" />
|
||||
<description>
|
||||
Sets the state of a multistate item. See [method add_multistate_item] for details.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_item_submenu">
|
||||
@ -597,7 +642,7 @@
|
||||
<param index="2" name="submenu_rid" type="RID" />
|
||||
<description>
|
||||
Sets the submenu RID of the item at index [param idx]. The submenu is a global menu that would be shown when the item is clicked.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_item_tag">
|
||||
@ -607,7 +652,7 @@
|
||||
<param index="2" name="tag" type="Variant" />
|
||||
<description>
|
||||
Sets the metadata of an item, which may be of any type. You can later get it with [method get_item_tag], which provides a simple way of assigning context data to items.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_item_text">
|
||||
@ -617,7 +662,7 @@
|
||||
<param index="2" name="text" type="String" />
|
||||
<description>
|
||||
Sets the text of the item at index [param idx].
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
[b]Note:[/b] This method is implemented on macOS and Windows.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_item_tooltip">
|
||||
@ -645,6 +690,7 @@
|
||||
<param index="1" name="callback" type="Callable" />
|
||||
<description>
|
||||
Registers callable to emit when the menu is about to show.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_popup_open_callback">
|
||||
@ -653,6 +699,7 @@
|
||||
<param index="1" name="callback" type="Callable" />
|
||||
<description>
|
||||
Registers callable to emit when the menu is about to closed.
|
||||
[b]Note:[/b] This method is implemented only on macOS.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
@ -663,6 +710,15 @@
|
||||
<constant name="FEATURE_POPUP_MENU" value="1" enum="Feature">
|
||||
[NativeMenu] supports native popup menus.
|
||||
</constant>
|
||||
<constant name="FEATURE_OPEN_CLOSE_CALLBACK" value="2" enum="Feature">
|
||||
[NativeMenu] supports menu open and close callbacks.
|
||||
</constant>
|
||||
<constant name="FEATURE_HOVER_CALLBACK" value="3" enum="Feature">
|
||||
[NativeMenu] supports menu item hover callback.
|
||||
</constant>
|
||||
<constant name="FEATURE_KEY_CALLBACK" value="4" enum="Feature">
|
||||
[NativeMenu] supports menu item accelerator/key callback.
|
||||
</constant>
|
||||
<constant name="INVALID_MENU_ID" value="0" enum="SystemMenus">
|
||||
Invalid special system menu ID.
|
||||
</constant>
|
||||
|
||||
Reference in New Issue
Block a user