[macOS] Add missing global menu features.

This commit is contained in:
bruvzg 2022-03-22 11:26:36 +02:00
parent 50f3154d55
commit 595995a5a7
No known key found for this signature in database
GPG key ID: 7960FCF39844EC38
6 changed files with 1038 additions and 53 deletions

View file

@ -136,7 +136,74 @@
<argument index="1" name="label" type="String" />
<argument index="2" name="callback" type="Callable" />
<argument index="3" name="tag" type="Variant" default="null" />
<argument index="4" name="accelerator" type="int" enum="Key" default="0" />
<argument index="5" name="index" type="int" default="-1" />
<description>
Adds a new checkable item with text [code]label[/code] to the global menu with ID [code]menu_root[/code].
[b]Note:[/b] This method is implemented on macOS.
[b]Supported system menu IDs:[/b]
[codeblock]
"" - Main menu (macOS).
"_dock" - Dock popup menu (macOS).
[/codeblock]
</description>
</method>
<method name="global_menu_add_icon_check_item">
<return type="void" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="icon" type="Texture2D" />
<argument index="2" name="label" type="String" />
<argument index="3" name="callback" type="Callable" />
<argument index="4" name="tag" type="Variant" default="null" />
<argument index="5" name="accelerator" type="int" enum="Key" default="0" />
<argument index="6" name="index" type="int" default="-1" />
<description>
Adds a new checkable item with text [code]label[/code] and icon [code]icon[/code] to the global menu with ID [code]menu_root[/code].
[b]Note:[/b] This method is implemented on macOS.
[b]Supported system menu IDs:[/b]
[codeblock]
"" - Main menu (macOS).
"_dock" - Dock popup menu (macOS).
[/codeblock]
</description>
</method>
<method name="global_menu_add_icon_item">
<return type="void" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="icon" type="Texture2D" />
<argument index="2" name="label" type="String" />
<argument index="3" name="callback" type="Callable" />
<argument index="4" name="tag" type="Variant" default="null" />
<argument index="5" name="accelerator" type="int" enum="Key" default="0" />
<argument index="6" name="index" type="int" default="-1" />
<description>
Adds a new item with text [code]label[/code] and icon [code]icon[/code] to the global menu with ID [code]menu_root[/code].
[b]Note:[/b] This method is implemented on macOS.
[b]Supported system menu IDs:[/b]
[codeblock]
"" - Main menu (macOS).
"_dock" - Dock popup menu (macOS).
[/codeblock]
</description>
</method>
<method name="global_menu_add_icon_radio_check_item">
<return type="void" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="icon" type="Texture2D" />
<argument index="2" name="label" type="String" />
<argument index="3" name="callback" type="Callable" />
<argument index="4" name="tag" type="Variant" default="null" />
<argument index="5" name="accelerator" type="int" enum="Key" default="0" />
<argument index="6" name="index" type="int" default="-1" />
<description>
Adds a new radio-checkable item with text [code]label[/code] and icon [code]icon[/code] to the global menu with ID [code]menu_root[/code].
[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 global_menu_set_item_checked] for more info on how to control it.
[b]Note:[/b] This method is implemented on macOS.
[b]Supported system menu IDs:[/b]
[codeblock]
"" - Main menu (macOS).
"_dock" - Dock popup menu (macOS).
[/codeblock]
</description>
</method>
<method name="global_menu_add_item">
@ -145,13 +212,70 @@
<argument index="1" name="label" type="String" />
<argument index="2" name="callback" type="Callable" />
<argument index="3" name="tag" type="Variant" default="null" />
<argument index="4" name="accelerator" type="int" enum="Key" default="0" />
<argument index="5" name="index" type="int" default="-1" />
<description>
Adds a new item with text [code]label[/code] to the global menu with ID [code]menu_root[/code].
[b]Note:[/b] This method is implemented on macOS.
[b]Supported system menu IDs:[/b]
[codeblock]
"" - Main menu (macOS).
"_dock" - Dock popup menu (macOS).
[/codeblock]
</description>
</method>
<method name="global_menu_add_multistate_item">
<return type="void" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="labe" type="String" />
<argument index="2" name="max_states" type="int" />
<argument index="3" name="default_state" type="int" />
<argument index="4" name="callback" type="Callable" />
<argument index="5" name="tag" type="Variant" default="null" />
<argument index="6" name="accelerator" type="int" enum="Key" default="0" />
<argument index="7" name="index" type="int" default="-1" />
<description>
Adds a new item with text [code]label[/code] to the global menu with ID [code]menu_root[/code].
Contrarily to normal binary items, multistate items can have more than two states, as defined by [code]max_states[/code]. Each press or activate of the item will increase the state by one. The default value is defined by [code]default_state[/code].
[b]Note:[/b] This method is implemented on macOS.
[b]Supported system menu IDs:[/b]
[codeblock]
"" - Main menu (macOS).
"_dock" - Dock popup menu (macOS).
[/codeblock]
</description>
</method>
<method name="global_menu_add_radio_check_item">
<return type="void" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="label" type="String" />
<argument index="2" name="callback" type="Callable" />
<argument index="3" name="tag" type="Variant" default="null" />
<argument index="4" name="accelerator" type="int" enum="Key" default="0" />
<argument index="5" name="index" type="int" default="-1" />
<description>
Adds a new radio-checkable item with text [code]label[/code] to the global menu with ID [code]menu_root[/code].
[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 global_menu_set_item_checked] for more info on how to control it.
[b]Note:[/b] This method is implemented on macOS.
[b]Supported system menu IDs:[/b]
[codeblock]
"" - Main menu (macOS).
"_dock" - Dock popup menu (macOS).
[/codeblock]
</description>
</method>
<method name="global_menu_add_separator">
<return type="void" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="index" type="int" default="-1" />
<description>
Adds a separator between items to the global menu with ID [code]menu_root[/code]. Separators also occupy an index.
[b]Note:[/b] This method is implemented on macOS.
[b]Supported system menu IDs:[/b]
[codeblock]
"" - Main menu (macOS).
"_dock" - Dock popup menu (macOS).
[/codeblock]
</description>
</method>
<method name="global_menu_add_submenu_item">
@ -159,41 +283,127 @@
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="label" type="String" />
<argument index="2" name="submenu" type="String" />
<argument index="3" name="index" type="int" default="-1" />
<description>
Adds an item that will act as a submenu of the global menu [code]menu_root[/code]. The [code]submenu[/code] argument is the ID of the global menu root that will be shown when the item is clicked.
[b]Note:[/b] This method is implemented on macOS.
[b]Supported system menu IDs:[/b]
[codeblock]
"" - Main menu (macOS).
"_dock" - Dock popup menu (macOS).
[/codeblock]
</description>
</method>
<method name="global_menu_clear">
<return type="void" />
<argument index="0" name="menu_root" type="String" />
<description>
Removes all items from the global menu with ID [code]menu_root[/code].
[b]Note:[/b] This method is implemented on macOS.
[b]Supported system menu IDs:[/b]
[codeblock]
"" - Main menu (macOS).
"_dock" - Dock popup menu (macOS).
[/codeblock]
</description>
</method>
<method name="global_menu_get_item_callback">
<method name="global_menu_get_item_accelerator" qualifiers="const">
<return type="int" enum="Key" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="idx" type="int" />
<description>
Returns the accelerator of the item at index [code]idx[/code]. Accelerators are special combinations of keys that activate the item, no matter which control is focused.
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_get_item_callback" qualifiers="const">
<return type="Callable" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="idx" type="int" />
<description>
Returns the callback of the item at index [code]idx[/code].
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_get_item_submenu">
<method name="global_menu_get_item_icon" qualifiers="const">
<return type="Texture2D" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="idx" type="int" />
<description>
Returns the icon of the item at index [code]idx[/code].
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_get_item_index_from_tag" qualifiers="const">
<return type="int" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="tag" type="Variant" />
<description>
Returns the index of the item with the specified [code]tag[/code]. Index is automatically assigned to each item by the engine. Index can not be set manually.
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_get_item_index_from_text" qualifiers="const">
<return type="int" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="text" type="String" />
<description>
Returns the index of the item with the specified [code]text[/code]. Index is automatically assigned to each item by the engine. Index can not be set manually.
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_get_item_max_states" qualifiers="const">
<return type="int" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="idx" type="int" />
<description>
Returns number of states of an multistate item. See [method global_menu_add_multistate_item] for details.
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_get_item_state" qualifiers="const">
<return type="int" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="idx" type="int" />
<description>
Returns the state of an multistate item. See [method global_menu_add_multistate_item] for details.
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_get_item_submenu" qualifiers="const">
<return type="String" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="idx" type="int" />
<description>
Returns the submenu ID of the item at index [code]idx[/code]. See [method global_menu_add_submenu_item] for more info on how to add a submenu.
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_get_item_tag">
<method name="global_menu_get_item_tag" qualifiers="const">
<return type="Variant" />
<argument index="0" name="menu_root" type="String" />
<argument 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 global_menu_set_item_tag], which provides a simple way of assigning context data to items.
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_get_item_text">
<method name="global_menu_get_item_text" qualifiers="const">
<return type="String" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="idx" type="int" />
<description>
Returns the text of the item at index [code]idx[/code].
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_get_item_tooltip" qualifiers="const">
<return type="String" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="idx" type="int" />
<description>
Returns the tooltip associated with the specified index index [code]idx[/code].
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_is_item_checkable" qualifiers="const">
@ -201,6 +411,8 @@
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="idx" type="int" />
<description>
Returns [code]true[/code] if the item at index [code]idx[/code] is checkable in some way, i.e. if it has a checkbox or radio button.
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_is_item_checked" qualifiers="const">
@ -208,6 +420,28 @@
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="idx" type="int" />
<description>
Returns [code]true[/code] if the item at index [code]idx[/code] is checked.
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_is_item_disabled" qualifiers="const">
<return type="bool" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="idx" type="int" />
<description>
Returns [code]true[/code] if the item at index [code]idx[/code] is disabled. When it is disabled it can't be selected, or its action invoked.
See [method global_menu_set_item_disabled] for more info on how to disable an item.
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_is_item_radio_checkable" qualifiers="const">
<return type="bool" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="idx" type="int" />
<description>
Returns [code]true[/code] if the item at index [code]idx[/code] 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 on macOS.
</description>
</method>
<method name="global_menu_remove_item">
@ -215,6 +449,19 @@
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="idx" type="int" />
<description>
Removes the item at index [code]idx[/code] from the global menu [code]menu_root[/code].
[b]Note:[/b] The indices of items after the removed item will be shifted by one.
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_set_item_accelerator">
<return type="void" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="idx" type="int" />
<argument index="2" name="keycode" type="int" enum="Key" />
<description>
Sets the accelerator of the item at index [code]idx[/code].
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_set_item_callback">
@ -223,6 +470,8 @@
<argument index="1" name="idx" type="int" />
<argument index="2" name="callback" type="Callable" />
<description>
Sets the callback of the item at index [code]idx[/code]. Callback is emitted when an item is pressed or its accelerator is activated.
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_set_item_checkable">
@ -231,6 +480,8 @@
<argument index="1" name="idx" type="int" />
<argument index="2" name="checkable" type="bool" />
<description>
Sets whether the item at index [code]idx[/code] has a checkbox. If [code]false[/code], sets the type of the item to plain text.
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_set_item_checked">
@ -239,6 +490,60 @@
<argument index="1" name="idx" type="int" />
<argument index="2" name="checked" type="bool" />
<description>
Sets the checkstate status of the item at index [code]idx[/code].
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_set_item_disabled">
<return type="void" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="idx" type="int" />
<argument index="2" name="disabled" type="bool" />
<description>
Enables/disables the item at index [code]idx[/code]. When it is disabled, it can't be selected and its action can't be invoked.
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_set_item_icon">
<return type="void" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="idx" type="int" />
<argument index="2" name="icon" type="Texture2D" />
<description>
Replaces the [Texture2D] icon of the specified [code]idx[/code].
[b]Note:[/b] This method is implemented on macOS.
[b]Note:[/b] This method is not supported by macOS "_dock" menu items.
</description>
</method>
<method name="global_menu_set_item_max_states">
<return type="void" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="idx" type="int" />
<argument index="2" name="max_states" type="int" />
<description>
Sets number of state of an multistate item. See [method global_menu_add_multistate_item] for details.
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_set_item_radio_checkable">
<return type="void" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="idx" type="int" />
<argument index="2" name="checkable" type="bool" />
<description>
Sets the type of the item at the specified index [code]idx[/code] 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 on macOS.
</description>
</method>
<method name="global_menu_set_item_state">
<return type="void" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="idx" type="int" />
<argument index="2" name="state" type="int" />
<description>
Sets the state of an multistate item. See [method global_menu_add_multistate_item] for details.
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_set_item_submenu">
@ -247,6 +552,8 @@
<argument index="1" name="idx" type="int" />
<argument index="2" name="submenu" type="String" />
<description>
Sets the submenu of the item at index [code]idx[/code]. The submenu is the ID of a global menu root that would be shown when the item is clicked.
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_set_item_tag">
@ -255,6 +562,8 @@
<argument index="1" name="idx" type="int" />
<argument 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 global_menu_get_item_tag], which provides a simple way of assigning context data to items.
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_set_item_text">
@ -263,6 +572,18 @@
<argument index="1" name="idx" type="int" />
<argument index="2" name="text" type="String" />
<description>
Sets the text of the item at index [code]idx[/code].
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="global_menu_set_item_tooltip">
<return type="void" />
<argument index="0" name="menu_root" type="String" />
<argument index="1" name="idx" type="int" />
<argument index="2" name="tooltip" type="String" />
<description>
Sets the [String] tooltip of the item at the specified index [code]idx[/code].
[b]Note:[/b] This method is implemented on macOS.
</description>
</method>
<method name="has_feature" qualifiers="const">