Documentation ¶
Overview ¶
Package NativeMenu provides methods for working with NativeMenu object instances.
Index ¶
- func AddCheckItem(rid RID.NativeMenu, label string) int
- func AddIconCheckItem(rid RID.NativeMenu, icon [1]gdclass.Texture2D, label string) int
- func AddIconItem(rid RID.NativeMenu, icon [1]gdclass.Texture2D, label string) int
- func AddIconRadioCheckItem(rid RID.NativeMenu, icon [1]gdclass.Texture2D, label string) int
- func AddItem(rid RID.NativeMenu, label string) int
- func AddMultistateItem(rid RID.NativeMenu, label string, max_states int, default_state int) int
- func AddRadioCheckItem(rid RID.NativeMenu, label string) int
- func AddSeparator(rid RID.NativeMenu) int
- func AddSubmenuItem(rid RID.NativeMenu, label string, submenu_rid RID.NativeMenu) int
- func Advanced() class
- func Clear(rid RID.NativeMenu)
- func CreateMenu() RID.NativeMenu
- func FindItemIndexWithSubmenu(rid RID.NativeMenu, submenu_rid RID.NativeMenu) int
- func FindItemIndexWithTag(rid RID.NativeMenu, tag any) int
- func FindItemIndexWithText(rid RID.NativeMenu, text string) int
- func FreeMenu(rid RID.NativeMenu)
- func GetItemCallback(rid RID.NativeMenu, idx int) Callable.Function
- func GetItemCount(rid RID.NativeMenu) int
- func GetItemIcon(rid RID.NativeMenu, idx int) [1]gdclass.Texture2D
- func GetItemIndentationLevel(rid RID.NativeMenu, idx int) int
- func GetItemKeyCallback(rid RID.NativeMenu, idx int) Callable.Function
- func GetItemMaxStates(rid RID.NativeMenu, idx int) int
- func GetItemState(rid RID.NativeMenu, idx int) int
- func GetItemSubmenu(rid RID.NativeMenu, idx int) RID.NativeMenu
- func GetItemTag(rid RID.NativeMenu, idx int) any
- func GetItemText(rid RID.NativeMenu, idx int) string
- func GetItemTooltip(rid RID.NativeMenu, idx int) string
- func GetMinimumWidth(rid RID.NativeMenu) Float.X
- func GetPopupCloseCallback(rid RID.NativeMenu) Callable.Function
- func GetPopupOpenCallback(rid RID.NativeMenu) Callable.Function
- func GetSize(rid RID.NativeMenu) Vector2.XY
- func GetSystemMenu(menu_id gdclass.NativeMenuSystemMenus) RID.NativeMenu
- func GetSystemMenuName(menu_id gdclass.NativeMenuSystemMenus) string
- func HasFeature(feature gdclass.NativeMenuFeature) bool
- func HasMenu(rid RID.NativeMenu) bool
- func HasSystemMenu(menu_id gdclass.NativeMenuSystemMenus) bool
- func IsItemCheckable(rid RID.NativeMenu, idx int) bool
- func IsItemChecked(rid RID.NativeMenu, idx int) bool
- func IsItemDisabled(rid RID.NativeMenu, idx int) bool
- func IsItemHidden(rid RID.NativeMenu, idx int) bool
- func IsItemRadioCheckable(rid RID.NativeMenu, idx int) bool
- func IsOpened(rid RID.NativeMenu) bool
- func IsSystemMenu(rid RID.NativeMenu) bool
- func Popup(rid RID.NativeMenu, position Vector2i.XY)
- func RemoveItem(rid RID.NativeMenu, idx int)
- func SetInterfaceDirection(rid RID.NativeMenu, is_rtl bool)
- func SetItemAccelerator(rid RID.NativeMenu, idx int, keycode Key)
- func SetItemCallback(rid RID.NativeMenu, idx int, callback func(tag any))
- func SetItemCheckable(rid RID.NativeMenu, idx int, checkable bool)
- func SetItemChecked(rid RID.NativeMenu, idx int, checked bool)
- func SetItemDisabled(rid RID.NativeMenu, idx int, disabled bool)
- func SetItemHidden(rid RID.NativeMenu, idx int, hidden bool)
- func SetItemHoverCallbacks(rid RID.NativeMenu, idx int, callback func(tag any))
- func SetItemIcon(rid RID.NativeMenu, idx int, icon [1]gdclass.Texture2D)
- func SetItemIndentationLevel(rid RID.NativeMenu, idx int, level int)
- func SetItemKeyCallback(rid RID.NativeMenu, idx int, key_callback func(tag any))
- func SetItemMaxStates(rid RID.NativeMenu, idx int, max_states int)
- func SetItemRadioCheckable(rid RID.NativeMenu, idx int, checkable bool)
- func SetItemState(rid RID.NativeMenu, idx int, state int)
- func SetItemSubmenu(rid RID.NativeMenu, idx int, submenu_rid RID.NativeMenu)
- func SetItemTag(rid RID.NativeMenu, idx int, tag any)
- func SetItemText(rid RID.NativeMenu, idx int, text string)
- func SetItemTooltip(rid RID.NativeMenu, idx int, tooltip string)
- func SetMinimumWidth(rid RID.NativeMenu, width Float.X)
- func SetPopupCloseCallback(rid RID.NativeMenu, callback func())
- func SetPopupOpenCallback(rid RID.NativeMenu, callback func())
- type Feature
- type Key
- type SystemMenus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCheckItem ¶
func AddCheckItem(rid RID.NativeMenu, label string) int
Adds a new checkable item with text [param label] to the global menu [param rid]. 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 on macOS and Windows. [b]Note:[/b] On Windows, [param accelerator] and [param key_callback] are ignored.
func AddIconCheckItem ¶
Adds a new checkable item with text [param label] and icon [param icon] to the global menu [param rid]. 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 on macOS and Windows. [b]Note:[/b] On Windows, [param accelerator] and [param key_callback] are ignored.
func AddIconItem ¶
Adds a new item with text [param label] and icon [param icon] to the global menu [param rid]. 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 on macOS and Windows. [b]Note:[/b] On Windows, [param accelerator] and [param key_callback] are ignored.
func AddIconRadioCheckItem ¶
Adds a new radio-checkable item with text [param label] and icon [param icon] to the global menu [param rid]. 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] 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 on macOS and Windows. [b]Note:[/b] On Windows, [param accelerator] and [param key_callback] are ignored.
func AddItem ¶
func AddItem(rid RID.NativeMenu, label string) int
Adds a new item with text [param label] to the global menu [param rid]. 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 on macOS and Windows. [b]Note:[/b] On Windows, [param accelerator] and [param key_callback] are ignored.
func AddMultistateItem ¶
Adds a new item with text [param label] to the global menu [param rid]. Contrarily to normal binary items, multistate items can have more than two states, as defined by [param max_states]. Each press or activate of the item will increase the state by one. The default value is defined by [param default_state]. 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] 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 on macOS and Windows. [b]Note:[/b] On Windows, [param accelerator] and [param key_callback] are ignored.
func AddRadioCheckItem ¶
func AddRadioCheckItem(rid RID.NativeMenu, label string) int
Adds a new radio-checkable item with text [param label] to the global menu [param rid]. 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] 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 on macOS and Windows. [b]Note:[/b] On Windows, [param accelerator] and [param key_callback] are ignored.
func AddSeparator ¶
func AddSeparator(rid RID.NativeMenu) int
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 on macOS and Windows.
func AddSubmenuItem ¶
func AddSubmenuItem(rid RID.NativeMenu, label string, submenu_rid RID.NativeMenu) int
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 on macOS and Windows.
func Advanced ¶
func Advanced() class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
func Clear ¶
func Clear(rid RID.NativeMenu)
Removes all items from the global menu [param rid]. [b]Note:[/b] This method is implemented on macOS and Windows.
func CreateMenu ¶
func CreateMenu() RID.NativeMenu
Creates a new global menu object. [b]Note:[/b] This method is implemented on macOS and Windows.
func FindItemIndexWithSubmenu ¶
func FindItemIndexWithSubmenu(rid RID.NativeMenu, submenu_rid RID.NativeMenu) int
Returns the index of the item with the submenu specified by [param submenu_rid]. Indices are automatically assigned to each item by the engine, and cannot be set manually. [b]Note:[/b] This method is implemented on macOS and Windows.
func FindItemIndexWithTag ¶
func FindItemIndexWithTag(rid RID.NativeMenu, tag any) int
Returns the index of the item with the specified [param tag]. Indices are automatically assigned to each item by the engine, and cannot be set manually. [b]Note:[/b] This method is implemented on macOS and Windows.
func FindItemIndexWithText ¶
func FindItemIndexWithText(rid RID.NativeMenu, text string) int
Returns the index of the item with the specified [param text]. Indices are automatically assigned to each item by the engine, and cannot be set manually. [b]Note:[/b] This method is implemented on macOS and Windows.
func FreeMenu ¶
func FreeMenu(rid RID.NativeMenu)
Frees a global menu object created by this [NativeMenu]. [b]Note:[/b] This method is implemented on macOS and Windows.
func GetItemCallback ¶
func GetItemCallback(rid RID.NativeMenu, idx int) Callable.Function
Returns the callback of the item at index [param idx]. [b]Note:[/b] This method is implemented on macOS and Windows.
func GetItemCount ¶
func GetItemCount(rid RID.NativeMenu) int
Returns number of items in the global menu [param rid]. [b]Note:[/b] This method is implemented on macOS and Windows.
func GetItemIcon ¶
func GetItemIcon(rid RID.NativeMenu, idx int) [1]gdclass.Texture2D
Returns the icon of the item at index [param idx]. [b]Note:[/b] This method is implemented on macOS and Windows.
func GetItemIndentationLevel ¶
func GetItemIndentationLevel(rid RID.NativeMenu, idx int) int
Returns the horizontal offset of the item at the given [param idx]. [b]Note:[/b] This method is implemented only on macOS.
func GetItemKeyCallback ¶
func GetItemKeyCallback(rid RID.NativeMenu, idx int) Callable.Function
Returns the callback of the item accelerator at index [param idx]. [b]Note:[/b] This method is implemented only on macOS.
func GetItemMaxStates ¶
func GetItemMaxStates(rid RID.NativeMenu, idx int) int
Returns number of states of a multistate item. See [method add_multistate_item] for details. [b]Note:[/b] This method is implemented on macOS and Windows.
func GetItemState ¶
func GetItemState(rid RID.NativeMenu, idx int) int
Returns the state of a multistate item. See [method add_multistate_item] for details. [b]Note:[/b] This method is implemented on macOS and Windows.
func GetItemSubmenu ¶
func GetItemSubmenu(rid RID.NativeMenu, idx int) RID.NativeMenu
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 on macOS and Windows.
func GetItemTag ¶
func GetItemTag(rid RID.NativeMenu, idx int) any
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 on macOS and Windows.
func GetItemText ¶
func GetItemText(rid RID.NativeMenu, idx int) string
Returns the text of the item at index [param idx]. [b]Note:[/b] This method is implemented on macOS and Windows.
func GetItemTooltip ¶
func GetItemTooltip(rid RID.NativeMenu, idx int) string
Returns the tooltip associated with the specified index [param idx]. [b]Note:[/b] This method is implemented only on macOS.
func GetMinimumWidth ¶
func GetMinimumWidth(rid RID.NativeMenu) Float.X
Returns global menu minimum width. [b]Note:[/b] This method is implemented only on macOS.
func GetPopupCloseCallback ¶
func GetPopupCloseCallback(rid RID.NativeMenu) Callable.Function
Returns global menu close callback. b]Note:[/b] This method is implemented only on macOS.
func GetPopupOpenCallback ¶
func GetPopupOpenCallback(rid RID.NativeMenu) Callable.Function
Returns global menu open callback. b]Note:[/b] This method is implemented only on macOS.
func GetSize ¶
func GetSize(rid RID.NativeMenu) Vector2.XY
Returns global menu size. [b]Note:[/b] This method is implemented on macOS and Windows.
func GetSystemMenu ¶
func GetSystemMenu(menu_id gdclass.NativeMenuSystemMenus) RID.NativeMenu
Returns RID of a special system menu. [b]Note:[/b] This method is implemented only on macOS.
func GetSystemMenuName ¶
func GetSystemMenuName(menu_id gdclass.NativeMenuSystemMenus) string
Returns readable name of a special system menu. [b]Note:[/b] This method is implemented only on macOS.
func HasFeature ¶
func HasFeature(feature gdclass.NativeMenuFeature) bool
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 on macOS and Windows.
func HasMenu ¶
func HasMenu(rid RID.NativeMenu) bool
Returns [code]true[/code] if [param rid] is valid global menu. [b]Note:[/b] This method is implemented on macOS and Windows.
func HasSystemMenu ¶
func HasSystemMenu(menu_id gdclass.NativeMenuSystemMenus) bool
Returns [code]true[/code] if a special system menu is supported. [b]Note:[/b] This method is implemented only on macOS.
func IsItemCheckable ¶
func IsItemCheckable(rid RID.NativeMenu, idx int) bool
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 on macOS and Windows.
func IsItemChecked ¶
func IsItemChecked(rid RID.NativeMenu, idx int) bool
Returns [code]true[/code] if the item at index [param idx] is checked. [b]Note:[/b] This method is implemented on macOS and Windows.
func IsItemDisabled ¶
func IsItemDisabled(rid RID.NativeMenu, idx int) bool
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 on macOS and Windows.
func IsItemHidden ¶
func IsItemHidden(rid RID.NativeMenu, idx int) bool
Returns [code]true[/code] if the item at index [param idx] is hidden. See [method set_item_hidden] for more info on how to hide an item. [b]Note:[/b] This method is implemented only on macOS.
func IsItemRadioCheckable ¶
func IsItemRadioCheckable(rid RID.NativeMenu, idx int) bool
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 on macOS and Windows.
func IsOpened ¶
func IsOpened(rid RID.NativeMenu) bool
Returns [code]true[/code] if the menu is currently opened. [b]Note:[/b] This method is implemented only on macOS.
func IsSystemMenu ¶
func IsSystemMenu(rid RID.NativeMenu) bool
Return [code]true[/code] is global menu is a special system menu. [b]Note:[/b] This method is implemented only on macOS.
func Popup ¶
func Popup(rid RID.NativeMenu, position Vector2i.XY)
Shows the global menu at [param position] in the screen coordinates. [b]Note:[/b] This method is implemented on macOS and Windows.
func RemoveItem ¶
func RemoveItem(rid RID.NativeMenu, idx int)
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 on macOS and Windows.
func SetInterfaceDirection ¶
func SetInterfaceDirection(rid RID.NativeMenu, is_rtl bool)
Sets the menu text layout direction from right-to-left if [param is_rtl] is [code]true[/code]. [b]Note:[/b] This method is implemented on macOS and Windows.
func SetItemAccelerator ¶
func SetItemAccelerator(rid RID.NativeMenu, idx int, keycode Key)
Sets the accelerator of the item at index [param idx]. [param keycode] can be a single [enum Key], or 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] This method is implemented only on macOS.
func SetItemCallback ¶
func SetItemCallback(rid RID.NativeMenu, idx int, callback func(tag any))
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 on macOS and Windows.
func SetItemCheckable ¶
func SetItemCheckable(rid RID.NativeMenu, idx int, checkable bool)
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 on macOS and Windows.
func SetItemChecked ¶
func SetItemChecked(rid RID.NativeMenu, idx int, checked bool)
Sets the checkstate status of the item at index [param idx]. [b]Note:[/b] This method is implemented on macOS and Windows.
func SetItemDisabled ¶
func SetItemDisabled(rid RID.NativeMenu, idx int, disabled bool)
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 on macOS and Windows.
func SetItemHidden ¶
func SetItemHidden(rid RID.NativeMenu, idx int, hidden bool)
Hides/shows the item at index [param idx]. When it is hidden, an item does not appear in a menu and its action cannot be invoked. [b]Note:[/b] This method is implemented only on macOS.
func SetItemHoverCallbacks ¶
func SetItemHoverCallbacks(rid RID.NativeMenu, idx int, callback func(tag any))
Sets the callback of the item at index [param idx]. The callback is emitted when an item is hovered. [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.
func SetItemIcon ¶
func SetItemIcon(rid RID.NativeMenu, idx int, icon [1]gdclass.Texture2D)
Replaces the [Texture2D] icon of the specified [param idx]. [b]Note:[/b] This method is implemented on macOS and Windows. [b]Note:[/b] This method is not supported by macOS Dock menu items.
func SetItemIndentationLevel ¶
func SetItemIndentationLevel(rid RID.NativeMenu, idx int, level int)
Sets the horizontal offset of the item at the given [param idx]. [b]Note:[/b] This method is implemented only on macOS.
func SetItemKeyCallback ¶
func SetItemKeyCallback(rid RID.NativeMenu, idx int, key_callback func(tag any))
Sets the callback of the item at index [param idx]. Callback is emitted when its accelerator is activated. [b]Note:[/b] The [param key_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.
func SetItemMaxStates ¶
func SetItemMaxStates(rid RID.NativeMenu, idx int, max_states int)
Sets number of state of a multistate item. See [method add_multistate_item] for details. [b]Note:[/b] This method is implemented on macOS and Windows.
func SetItemRadioCheckable ¶
func SetItemRadioCheckable(rid RID.NativeMenu, idx int, checkable bool)
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 on macOS and Windows.
func SetItemState ¶
func SetItemState(rid RID.NativeMenu, idx int, state int)
Sets the state of a multistate item. See [method add_multistate_item] for details. [b]Note:[/b] This method is implemented on macOS and Windows.
func SetItemSubmenu ¶
func SetItemSubmenu(rid RID.NativeMenu, idx int, submenu_rid RID.NativeMenu)
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 on macOS and Windows.
func SetItemTag ¶
func SetItemTag(rid RID.NativeMenu, idx int, tag any)
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 on macOS and Windows.
func SetItemText ¶
func SetItemText(rid RID.NativeMenu, idx int, text string)
Sets the text of the item at index [param idx]. [b]Note:[/b] This method is implemented on macOS and Windows.
func SetItemTooltip ¶
func SetItemTooltip(rid RID.NativeMenu, idx int, tooltip string)
Sets the [String] tooltip of the item at the specified index [param idx]. [b]Note:[/b] This method is implemented only on macOS.
func SetMinimumWidth ¶
func SetMinimumWidth(rid RID.NativeMenu, width Float.X)
Sets the minimum width of the global menu. [b]Note:[/b] This method is implemented only on macOS.
func SetPopupCloseCallback ¶
func SetPopupCloseCallback(rid RID.NativeMenu, callback func())
Registers callable to emit when the menu is about to show. [b]Note:[/b] 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 [method is_opened] to check if the menu is currently opened. [b]Note:[/b] This method is implemented only on macOS.
func SetPopupOpenCallback ¶
func SetPopupOpenCallback(rid RID.NativeMenu, callback func())
Registers callable to emit after the menu is closed. [b]Note:[/b] This method is implemented only on macOS.
Types ¶
type Feature ¶
type Feature = gdclass.NativeMenuFeature //gd:NativeMenu.Feature
const ( /*[NativeMenu] supports native global main menu.*/ FeatureGlobalMenu Feature = 0 /*[NativeMenu] supports native popup menus.*/ FeaturePopupMenu Feature = 1 /*[NativeMenu] supports menu open and close callbacks.*/ FeatureOpenCloseCallback Feature = 2 /*[NativeMenu] supports menu item hover callback.*/ FeatureHoverCallback Feature = 3 /*[NativeMenu] supports menu item accelerator/key callback.*/ FeatureKeyCallback Feature = 4 )
type Key ¶
type Key int
const ( /*Enum value which doesn't correspond to any key. This is used to initialize [enum Key] properties with a generic state.*/ KeyNone Key = 0 /*Keycodes with this bit applied are non-printable.*/ KeySpecial Key = 4194304 /*Escape key.*/ KeyEscape Key = 4194305 /*Tab key.*/ KeyTab Key = 4194306 /*Shift + Tab key.*/ KeyBacktab Key = 4194307 /*Backspace key.*/ KeyBackspace Key = 4194308 /*Return key (on the main keyboard).*/ KeyEnter Key = 4194309 /*Enter key on the numeric keypad.*/ KeyKpEnter Key = 4194310 /*Insert key.*/ KeyInsert Key = 4194311 /*Delete key.*/ KeyDelete Key = 4194312 /*Pause key.*/ KeyPause Key = 4194313 /*Print Screen key.*/ KeyPrint Key = 4194314 /*System Request key.*/ KeySysreq Key = 4194315 /*Clear key.*/ KeyClear Key = 4194316 /*Home key.*/ KeyHome Key = 4194317 /*End key.*/ KeyEnd Key = 4194318 /*Left arrow key.*/ KeyLeft Key = 4194319 /*Up arrow key.*/ KeyUp Key = 4194320 /*Right arrow key.*/ KeyRight Key = 4194321 /*Down arrow key.*/ KeyDown Key = 4194322 /*Page Up key.*/ KeyPageup Key = 4194323 /*Page Down key.*/ KeyPagedown Key = 4194324 /*Shift key.*/ KeyShift Key = 4194325 /*Control key.*/ KeyCtrl Key = 4194326 /*Meta key.*/ KeyMeta Key = 4194327 /*Alt key.*/ KeyAlt Key = 4194328 /*Caps Lock key.*/ KeyCapslock Key = 4194329 /*Num Lock key.*/ KeyNumlock Key = 4194330 /*Scroll Lock key.*/ KeyScrolllock Key = 4194331 /*F1 key.*/ KeyF1 Key = 4194332 /*F2 key.*/ KeyF2 Key = 4194333 /*F3 key.*/ KeyF3 Key = 4194334 /*F4 key.*/ KeyF4 Key = 4194335 /*F5 key.*/ KeyF5 Key = 4194336 /*F6 key.*/ KeyF6 Key = 4194337 /*F7 key.*/ KeyF7 Key = 4194338 /*F8 key.*/ KeyF8 Key = 4194339 /*F9 key.*/ KeyF9 Key = 4194340 /*F10 key.*/ KeyF10 Key = 4194341 /*F11 key.*/ KeyF11 Key = 4194342 /*F12 key.*/ KeyF12 Key = 4194343 /*F13 key.*/ KeyF13 Key = 4194344 /*F14 key.*/ KeyF14 Key = 4194345 /*F15 key.*/ KeyF15 Key = 4194346 /*F16 key.*/ KeyF16 Key = 4194347 /*F17 key.*/ KeyF17 Key = 4194348 /*F18 key.*/ KeyF18 Key = 4194349 /*F19 key.*/ KeyF19 Key = 4194350 /*F20 key.*/ KeyF20 Key = 4194351 /*F21 key.*/ KeyF21 Key = 4194352 /*F22 key.*/ KeyF22 Key = 4194353 /*F23 key.*/ KeyF23 Key = 4194354 /*F24 key.*/ KeyF24 Key = 4194355 /*F25 key. Only supported on macOS and Linux due to a Windows limitation.*/ KeyF25 Key = 4194356 /*F26 key. Only supported on macOS and Linux due to a Windows limitation.*/ KeyF26 Key = 4194357 /*F27 key. Only supported on macOS and Linux due to a Windows limitation.*/ KeyF27 Key = 4194358 /*F28 key. Only supported on macOS and Linux due to a Windows limitation.*/ KeyF28 Key = 4194359 /*F29 key. Only supported on macOS and Linux due to a Windows limitation.*/ KeyF29 Key = 4194360 /*F30 key. Only supported on macOS and Linux due to a Windows limitation.*/ KeyF30 Key = 4194361 /*F31 key. Only supported on macOS and Linux due to a Windows limitation.*/ KeyF31 Key = 4194362 /*F32 key. Only supported on macOS and Linux due to a Windows limitation.*/ KeyF32 Key = 4194363 /*F33 key. Only supported on macOS and Linux due to a Windows limitation.*/ KeyF33 Key = 4194364 /*F34 key. Only supported on macOS and Linux due to a Windows limitation.*/ KeyF34 Key = 4194365 /*F35 key. Only supported on macOS and Linux due to a Windows limitation.*/ KeyF35 Key = 4194366 /*Multiply (*) key on the numeric keypad.*/ KeyKpMultiply Key = 4194433 /*Divide (/) key on the numeric keypad.*/ KeyKpDivide Key = 4194434 /*Subtract (-) key on the numeric keypad.*/ KeyKpSubtract Key = 4194435 /*Period (.) key on the numeric keypad.*/ KeyKpPeriod Key = 4194436 /*Add (+) key on the numeric keypad.*/ KeyKpAdd Key = 4194437 /*Number 0 on the numeric keypad.*/ KeyKp0 Key = 4194438 /*Number 1 on the numeric keypad.*/ KeyKp1 Key = 4194439 /*Number 2 on the numeric keypad.*/ KeyKp2 Key = 4194440 /*Number 3 on the numeric keypad.*/ KeyKp3 Key = 4194441 /*Number 4 on the numeric keypad.*/ KeyKp4 Key = 4194442 /*Number 5 on the numeric keypad.*/ KeyKp5 Key = 4194443 /*Number 6 on the numeric keypad.*/ KeyKp6 Key = 4194444 /*Number 7 on the numeric keypad.*/ KeyKp7 Key = 4194445 /*Number 8 on the numeric keypad.*/ KeyKp8 Key = 4194446 /*Number 9 on the numeric keypad.*/ KeyKp9 Key = 4194447 /*Context menu key.*/ KeyMenu Key = 4194370 /*Hyper key. (On Linux/X11 only).*/ KeyHyper Key = 4194371 /*Help key.*/ KeyHelp Key = 4194373 /*Media back key. Not to be confused with the Back button on an Android device.*/ KeyBack Key = 4194376 /*Media forward key.*/ KeyForward Key = 4194377 /*Media stop key.*/ KeyStop Key = 4194378 /*Media refresh key.*/ KeyRefresh Key = 4194379 /*Volume down key.*/ KeyVolumedown Key = 4194380 /*Mute volume key.*/ KeyVolumemute Key = 4194381 /*Volume up key.*/ KeyVolumeup Key = 4194382 /*Media play key.*/ KeyMediaplay Key = 4194388 /*Media stop key.*/ KeyMediastop Key = 4194389 /*Previous song key.*/ KeyMediaprevious Key = 4194390 /*Next song key.*/ KeyMedianext Key = 4194391 /*Media record key.*/ KeyMediarecord Key = 4194392 /*Home page key.*/ KeyHomepage Key = 4194393 /*Favorites key.*/ KeyFavorites Key = 4194394 /*Search key.*/ KeySearch Key = 4194395 /*Standby key.*/ KeyStandby Key = 4194396 /*Open URL / Launch Browser key.*/ KeyOpenurl Key = 4194397 /*Launch Mail key.*/ KeyLaunchmail Key = 4194398 /*Launch Media key.*/ KeyLaunchmedia Key = 4194399 /*Launch Shortcut 0 key.*/ KeyLaunch0 Key = 4194400 /*Launch Shortcut 1 key.*/ KeyLaunch1 Key = 4194401 /*Launch Shortcut 2 key.*/ KeyLaunch2 Key = 4194402 /*Launch Shortcut 3 key.*/ KeyLaunch3 Key = 4194403 /*Launch Shortcut 4 key.*/ KeyLaunch4 Key = 4194404 /*Launch Shortcut 5 key.*/ KeyLaunch5 Key = 4194405 /*Launch Shortcut 6 key.*/ KeyLaunch6 Key = 4194406 /*Launch Shortcut 7 key.*/ KeyLaunch7 Key = 4194407 /*Launch Shortcut 8 key.*/ KeyLaunch8 Key = 4194408 /*Launch Shortcut 9 key.*/ KeyLaunch9 Key = 4194409 /*Launch Shortcut A key.*/ KeyLauncha Key = 4194410 /*Launch Shortcut B key.*/ KeyLaunchb Key = 4194411 /*Launch Shortcut C key.*/ KeyLaunchc Key = 4194412 /*Launch Shortcut D key.*/ KeyLaunchd Key = 4194413 /*Launch Shortcut E key.*/ KeyLaunche Key = 4194414 /*Launch Shortcut F key.*/ KeyLaunchf Key = 4194415 /*"Globe" key on Mac / iPad keyboard.*/ KeyGlobe Key = 4194416 /*"On-screen keyboard" key on iPad keyboard.*/ KeyKeyboard Key = 4194417 /*英数 key on Mac keyboard.*/ KeyJisEisu Key = 4194418 /*かな key on Mac keyboard.*/ KeyJisKana Key = 4194419 /*Unknown key.*/ KeyUnknown Key = 8388607 /*Space key.*/ KeySpace Key = 32 /*! key.*/ KeyExclam Key = 33 /*" key.*/ KeyQuotedbl Key = 34 /*# key.*/ KeyNumbersign Key = 35 /*$ key.*/ KeyDollar Key = 36 /*% key.*/ KeyPercent Key = 37 /*& key.*/ KeyAmpersand Key = 38 /*' key.*/ KeyApostrophe Key = 39 /*( key.*/ KeyParenleft Key = 40 /*) key.*/ KeyParenright Key = 41 /** key.*/ KeyAsterisk Key = 42 /*+ key.*/ KeyPlus Key = 43 /*, key.*/ KeyComma Key = 44 /*- key.*/ KeyMinus Key = 45 /*. key.*/ KeyPeriod Key = 46 /*/ key.*/ KeySlash Key = 47 /*Number 0 key.*/ Key0 Key = 48 /*Number 1 key.*/ Key1 Key = 49 /*Number 2 key.*/ Key2 Key = 50 /*Number 3 key.*/ Key3 Key = 51 /*Number 4 key.*/ Key4 Key = 52 /*Number 5 key.*/ Key5 Key = 53 /*Number 6 key.*/ Key6 Key = 54 /*Number 7 key.*/ Key7 Key = 55 /*Number 8 key.*/ Key8 Key = 56 /*Number 9 key.*/ Key9 Key = 57 /*: key.*/ KeyColon Key = 58 /*; key.*/ KeySemicolon Key = 59 /*< key.*/ KeyLess Key = 60 /*= key.*/ KeyEqual Key = 61 /*> key.*/ KeyGreater Key = 62 /*? key.*/ KeyQuestion Key = 63 /*@ key.*/ KeyAt Key = 64 /*A key.*/ KeyA Key = 65 /*B key.*/ KeyB Key = 66 /*C key.*/ KeyC Key = 67 /*D key.*/ KeyD Key = 68 /*E key.*/ KeyE Key = 69 /*F key.*/ KeyF Key = 70 /*G key.*/ KeyG Key = 71 /*H key.*/ KeyH Key = 72 /*I key.*/ KeyI Key = 73 /*J key.*/ KeyJ Key = 74 /*K key.*/ KeyK Key = 75 /*L key.*/ KeyL Key = 76 /*M key.*/ KeyM Key = 77 /*N key.*/ KeyN Key = 78 /*O key.*/ KeyO Key = 79 /*P key.*/ KeyP Key = 80 /*Q key.*/ KeyQ Key = 81 /*R key.*/ KeyR Key = 82 /*S key.*/ KeyS Key = 83 /*T key.*/ KeyT Key = 84 /*U key.*/ KeyU Key = 85 /*V key.*/ KeyV Key = 86 /*W key.*/ KeyW Key = 87 /*X key.*/ KeyX Key = 88 /*Y key.*/ KeyY Key = 89 /*Z key.*/ KeyZ Key = 90 /*[ key.*/ KeyBracketleft Key = 91 /*\ key.*/ KeyBackslash Key = 92 /*] key.*/ KeyBracketright Key = 93 /*^ key.*/ KeyAsciicircum Key = 94 /*_ key.*/ KeyUnderscore Key = 95 /*` key.*/ KeyQuoteleft Key = 96 /*{ key.*/ KeyBraceleft Key = 123 /*| key.*/ KeyBar Key = 124 /*} key.*/ KeyBraceright Key = 125 /*~ key.*/ KeyAsciitilde Key = 126 /*¥ key.*/ KeyYen Key = 165 /*§ key.*/ KeySection Key = 167 )
func GetItemAccelerator ¶
func GetItemAccelerator(rid RID.NativeMenu, idx int) Key
Returns the accelerator of the item at index [param idx]. Accelerators are special combinations of keys that activate the item, no matter which control is focused. [b]Note:[/b] This method is implemented only on macOS.
type SystemMenus ¶
type SystemMenus = gdclass.NativeMenuSystemMenus //gd:NativeMenu.SystemMenus
const ( /*Invalid special system menu ID.*/ InvalidMenuId SystemMenus = 0 /*Global main menu ID.*/ MainMenuId SystemMenus = 1 /*Application (first menu after "Apple" menu on macOS) menu ID.*/ ApplicationMenuId SystemMenus = 2 /*"Window" menu ID (on macOS this menu includes standard window control items and a list of open windows).*/ WindowMenuId SystemMenus = 3 /*"Help" menu ID (on macOS this menu includes help search bar).*/ HelpMenuId SystemMenus = 4 /*Dock icon right-click menu ID (on macOS this menu include standard application control items and a list of open windows).*/ DockMenuId SystemMenus = 5 )