Table of Contents

Class NativeMenuInstance

Namespace
Godot
Assembly
GodotSharp.dll

NativeMenu handles low-level access to the OS native global menu bar and popup menus.

Note: This is low-level API, consider using MenuBar with PreferGlobalMenu set to true, and PopupMenu with PreferNativeMenu set to true.

To create a menu, use CreateMenu(), add menu items using add_*_item methods. To remove a menu, use FreeMenu(Rid).

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)

[GodotClassName("NativeMenu")]
public class NativeMenuInstance : GodotObject, IDisposable
Inheritance
NativeMenuInstance
Implements
Inherited Members

Methods

AddCheckItem(Rid, string, Callable, Callable, Variant, Key, int)

Adds a new checkable item with text label to the global menu rid.

Returns index of the inserted item, it's not guaranteed to be the same as index value.

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 KeyModifierMasks and Keys using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).

Note: The callback and keyCallback Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to tag.

Note: This method is implemented on macOS and Windows.

Note: On Windows, accelerator and keyCallback are ignored.

public int AddCheckItem(Rid rid, string label, Callable callback = default, Callable keyCallback = default, Variant tag = default, Key accelerator = Key.None, int index = -1)

Parameters

rid Rid
label string
callback Callable
keyCallback Callable
tag Variant
accelerator Key
index int

Returns

int

AddIconCheckItem(Rid, Texture2D, string, Callable, Callable, Variant, Key, int)

Adds a new checkable item with text label and icon icon to the global menu rid.

Returns index of the inserted item, it's not guaranteed to be the same as index value.

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 KeyModifierMasks and Keys using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).

Note: The callback and keyCallback Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to tag.

Note: This method is implemented on macOS and Windows.

Note: On Windows, accelerator and keyCallback are ignored.

public int AddIconCheckItem(Rid rid, Texture2D icon, string label, Callable callback = default, Callable keyCallback = default, Variant tag = default, Key accelerator = Key.None, int index = -1)

Parameters

rid Rid
icon Texture2D
label string
callback Callable
keyCallback Callable
tag Variant
accelerator Key
index int

Returns

int

AddIconItem(Rid, Texture2D, string, Callable, Callable, Variant, Key, int)

Adds a new item with text label and icon icon to the global menu rid.

Returns index of the inserted item, it's not guaranteed to be the same as index value.

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 KeyModifierMasks and Keys using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).

Note: The callback and keyCallback Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to tag.

Note: This method is implemented on macOS and Windows.

Note: On Windows, accelerator and keyCallback are ignored.

public int AddIconItem(Rid rid, Texture2D icon, string label, Callable callback = default, Callable keyCallback = default, Variant tag = default, Key accelerator = Key.None, int index = -1)

Parameters

rid Rid
icon Texture2D
label string
callback Callable
keyCallback Callable
tag Variant
accelerator Key
index int

Returns

int

AddIconRadioCheckItem(Rid, Texture2D, string, Callable, Callable, Variant, Key, int)

Adds a new radio-checkable item with text label and icon icon to the global menu rid.

Returns index of the inserted item, it's not guaranteed to be the same as index value.

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 KeyModifierMasks and Keys using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).

Note: Radio-checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See SetItemChecked(Rid, int, bool) for more info on how to control it.

Note: The callback and keyCallback Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to tag.

Note: This method is implemented on macOS and Windows.

Note: On Windows, accelerator and keyCallback are ignored.

public int AddIconRadioCheckItem(Rid rid, Texture2D icon, string label, Callable callback = default, Callable keyCallback = default, Variant tag = default, Key accelerator = Key.None, int index = -1)

Parameters

rid Rid
icon Texture2D
label string
callback Callable
keyCallback Callable
tag Variant
accelerator Key
index int

Returns

int

AddItem(Rid, string, Callable, Callable, Variant, Key, int)

Adds a new item with text label to the global menu rid.

Returns index of the inserted item, it's not guaranteed to be the same as index value.

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 KeyModifierMasks and Keys using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).

Note: The callback and keyCallback Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to tag.

Note: This method is implemented on macOS and Windows.

Note: On Windows, accelerator and keyCallback are ignored.

public int AddItem(Rid rid, string label, Callable callback = default, Callable keyCallback = default, Variant tag = default, Key accelerator = Key.None, int index = -1)

Parameters

rid Rid
label string
callback Callable
keyCallback Callable
tag Variant
accelerator Key
index int

Returns

int

AddMultistateItem(Rid, string, int, int, Callable, Callable, Variant, Key, int)

Adds a new item with text label to the global menu rid.

Contrarily to normal binary items, multistate items can have more than two states, as defined by maxStates. Each press or activate of the item will increase the state by one. The default value is defined by defaultState.

Returns index of the inserted item, it's not guaranteed to be the same as index value.

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 KeyModifierMasks and Keys using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).

Note: By default, there's no indication of the current item state, it should be changed manually.

Note: The callback and keyCallback Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to tag.

Note: This method is implemented on macOS and Windows.

Note: On Windows, accelerator and keyCallback are ignored.

public int AddMultistateItem(Rid rid, string label, int maxStates, int defaultState, Callable callback = default, Callable keyCallback = default, Variant tag = default, Key accelerator = Key.None, int index = -1)

Parameters

rid Rid
label string
maxStates int
defaultState int
callback Callable
keyCallback Callable
tag Variant
accelerator Key
index int

Returns

int

AddRadioCheckItem(Rid, string, Callable, Callable, Variant, Key, int)

Adds a new radio-checkable item with text label to the global menu rid.

Returns index of the inserted item, it's not guaranteed to be the same as index value.

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 KeyModifierMasks and Keys using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).

Note: Radio-checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See SetItemChecked(Rid, int, bool) for more info on how to control it.

Note: The callback and keyCallback Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to tag.

Note: This method is implemented on macOS and Windows.

Note: On Windows, accelerator and keyCallback are ignored.

public int AddRadioCheckItem(Rid rid, string label, Callable callback = default, Callable keyCallback = default, Variant tag = default, Key accelerator = Key.None, int index = -1)

Parameters

rid Rid
label string
callback Callable
keyCallback Callable
tag Variant
accelerator Key
index int

Returns

int

AddSeparator(Rid, int)

Adds a separator between items to the global menu rid. Separators also occupy an index.

Returns index of the inserted item, it's not guaranteed to be the same as index value.

Note: This method is implemented on macOS and Windows.

public int AddSeparator(Rid rid, int index = -1)

Parameters

rid Rid
index int

Returns

int

AddSubmenuItem(Rid, string, Rid, Variant, int)

Adds an item that will act as a submenu of the global menu rid. The submenuRid 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 index value.

Note: This method is implemented on macOS and Windows.

public int AddSubmenuItem(Rid rid, string label, Rid submenuRid, Variant tag = default, int index = -1)

Parameters

rid Rid
label string
submenuRid Rid
tag Variant
index int

Returns

int

Clear(Rid)

Removes all items from the global menu rid.

Note: This method is implemented on macOS and Windows.

public void Clear(Rid rid)

Parameters

rid Rid

CreateMenu()

Creates a new global menu object.

Note: This method is implemented on macOS and Windows.

public Rid CreateMenu()

Returns

Rid

FindItemIndexWithSubmenu(Rid, Rid)

Returns the index of the item with the submenu specified by submenuRid. Indices are automatically assigned to each item by the engine, and cannot be set manually.

Note: This method is implemented on macOS and Windows.

public int FindItemIndexWithSubmenu(Rid rid, Rid submenuRid)

Parameters

rid Rid
submenuRid Rid

Returns

int

FindItemIndexWithTag(Rid, Variant)

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.

Note: This method is implemented on macOS and Windows.

public int FindItemIndexWithTag(Rid rid, Variant tag)

Parameters

rid Rid
tag Variant

Returns

int

FindItemIndexWithText(Rid, string)

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.

Note: This method is implemented on macOS and Windows.

public int FindItemIndexWithText(Rid rid, string text)

Parameters

rid Rid
text string

Returns

int

FreeMenu(Rid)

Frees a global menu object created by this NativeMenu.

Note: This method is implemented on macOS and Windows.

public void FreeMenu(Rid rid)

Parameters

rid Rid

GetItemAccelerator(Rid, int)

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.

Note: This method is implemented only on macOS.

public Key GetItemAccelerator(Rid rid, int idx)

Parameters

rid Rid
idx int

Returns

Key

GetItemCallback(Rid, int)

Returns the callback of the item at index idx.

Note: This method is implemented on macOS and Windows.

public Callable GetItemCallback(Rid rid, int idx)

Parameters

rid Rid
idx int

Returns

Callable

GetItemCount(Rid)

Returns number of items in the global menu rid.

Note: This method is implemented on macOS and Windows.

public int GetItemCount(Rid rid)

Parameters

rid Rid

Returns

int

GetItemIcon(Rid, int)

Returns the icon of the item at index idx.

Note: This method is implemented on macOS and Windows.

public Texture2D GetItemIcon(Rid rid, int idx)

Parameters

rid Rid
idx int

Returns

Texture2D

GetItemIndentationLevel(Rid, int)

Returns the horizontal offset of the item at the given idx.

Note: This method is implemented only on macOS.

public int GetItemIndentationLevel(Rid rid, int idx)

Parameters

rid Rid
idx int

Returns

int

GetItemKeyCallback(Rid, int)

Returns the callback of the item accelerator at index idx.

Note: This method is implemented only on macOS.

public Callable GetItemKeyCallback(Rid rid, int idx)

Parameters

rid Rid
idx int

Returns

Callable

GetItemMaxStates(Rid, int)

Returns number of states of a multistate item. See AddMultistateItem(Rid, string, int, int, Callable, Callable, Variant, Key, int) for details.

Note: This method is implemented on macOS and Windows.

public int GetItemMaxStates(Rid rid, int idx)

Parameters

rid Rid
idx int

Returns

int

GetItemState(Rid, int)

Returns the state of a multistate item. See AddMultistateItem(Rid, string, int, int, Callable, Callable, Variant, Key, int) for details.

Note: This method is implemented on macOS and Windows.

public int GetItemState(Rid rid, int idx)

Parameters

rid Rid
idx int

Returns

int

GetItemSubmenu(Rid, int)

Returns the submenu ID of the item at index idx. See AddSubmenuItem(Rid, string, Rid, Variant, int) for more info on how to add a submenu.

Note: This method is implemented on macOS and Windows.

public Rid GetItemSubmenu(Rid rid, int idx)

Parameters

rid Rid
idx int

Returns

Rid

GetItemTag(Rid, int)

Returns the metadata of the specified item, which might be of any type. You can set it with SetItemTag(Rid, int, Variant), which provides a simple way of assigning context data to items.

Note: This method is implemented on macOS and Windows.

public Variant GetItemTag(Rid rid, int idx)

Parameters

rid Rid
idx int

Returns

Variant

GetItemText(Rid, int)

Returns the text of the item at index idx.

Note: This method is implemented on macOS and Windows.

public string GetItemText(Rid rid, int idx)

Parameters

rid Rid
idx int

Returns

string

GetItemTooltip(Rid, int)

Returns the tooltip associated with the specified index idx.

Note: This method is implemented only on macOS.

public string GetItemTooltip(Rid rid, int idx)

Parameters

rid Rid
idx int

Returns

string

GetMinimumWidth(Rid)

Returns global menu minimum width.

Note: This method is implemented only on macOS.

public float GetMinimumWidth(Rid rid)

Parameters

rid Rid

Returns

float

GetPopupCloseCallback(Rid)

Returns global menu close callback.

b]Note:[/b] This method is implemented only on macOS.

public Callable GetPopupCloseCallback(Rid rid)

Parameters

rid Rid

Returns

Callable

GetPopupOpenCallback(Rid)

Returns global menu open callback.

b]Note:[/b] This method is implemented only on macOS.

public Callable GetPopupOpenCallback(Rid rid)

Parameters

rid Rid

Returns

Callable

GetSize(Rid)

Returns global menu size.

Note: This method is implemented on macOS and Windows.

public Vector2 GetSize(Rid rid)

Parameters

rid Rid

Returns

Vector2

GetSystemMenu(SystemMenus)

Returns RID of a special system menu.

Note: This method is implemented only on macOS.

public Rid GetSystemMenu(NativeMenu.SystemMenus menuId)

Parameters

menuId NativeMenu.SystemMenus

Returns

Rid

GetSystemMenuName(SystemMenus)

Returns readable name of a special system menu.

Note: This method is implemented only on macOS.

public string GetSystemMenuName(NativeMenu.SystemMenus menuId)

Parameters

menuId NativeMenu.SystemMenus

Returns

string

HasFeature(Feature)

Returns true if the specified feature is supported by the current NativeMenu, false otherwise.

Note: This method is implemented on macOS and Windows.

public bool HasFeature(NativeMenu.Feature feature)

Parameters

feature NativeMenu.Feature

Returns

bool

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

HasMenu(Rid)

Returns true if rid is valid global menu.

Note: This method is implemented on macOS and Windows.

public bool HasMenu(Rid rid)

Parameters

rid Rid

Returns

bool

HasSystemMenu(SystemMenus)

Returns true if a special system menu is supported.

Note: This method is implemented only on macOS.

public bool HasSystemMenu(NativeMenu.SystemMenus menuId)

Parameters

menuId NativeMenu.SystemMenus

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

IsItemCheckable(Rid, int)

Returns true if the item at index idx is checkable in some way, i.e. if it has a checkbox or radio button.

Note: This method is implemented on macOS and Windows.

public bool IsItemCheckable(Rid rid, int idx)

Parameters

rid Rid
idx int

Returns

bool

IsItemChecked(Rid, int)

Returns true if the item at index idx is checked.

Note: This method is implemented on macOS and Windows.

public bool IsItemChecked(Rid rid, int idx)

Parameters

rid Rid
idx int

Returns

bool

IsItemDisabled(Rid, int)

Returns true if the item at index idx is disabled. When it is disabled it can't be selected, or its action invoked.

See SetItemDisabled(Rid, int, bool) for more info on how to disable an item.

Note: This method is implemented on macOS and Windows.

public bool IsItemDisabled(Rid rid, int idx)

Parameters

rid Rid
idx int

Returns

bool

IsItemHidden(Rid, int)

Returns true if the item at index idx is hidden.

See SetItemHidden(Rid, int, bool) for more info on how to hide an item.

Note: This method is implemented only on macOS.

public bool IsItemHidden(Rid rid, int idx)

Parameters

rid Rid
idx int

Returns

bool

IsItemRadioCheckable(Rid, int)

Returns true if the item at index idx has radio button-style checkability.

Note: This is purely cosmetic; you must add the logic for checking/unchecking items in radio groups.

Note: This method is implemented on macOS and Windows.

public bool IsItemRadioCheckable(Rid rid, int idx)

Parameters

rid Rid
idx int

Returns

bool

IsOpened(Rid)

Returns true if the menu is currently opened.

Note: This method is implemented only on macOS.

public bool IsOpened(Rid rid)

Parameters

rid Rid

Returns

bool

IsSystemMenu(Rid)

Return true is global menu is a special system menu.

Note: This method is implemented only on macOS.

public bool IsSystemMenu(Rid rid)

Parameters

rid Rid

Returns

bool

Popup(Rid, Vector2I)

Shows the global menu at position in the screen coordinates.

Note: This method is implemented on macOS and Windows.

public void Popup(Rid rid, Vector2I position)

Parameters

rid Rid
position Vector2I

RemoveItem(Rid, int)

Removes the item at index idx from the global menu rid.

Note: The indices of items after the removed item will be shifted by one.

Note: This method is implemented on macOS and Windows.

public void RemoveItem(Rid rid, int idx)

Parameters

rid Rid
idx int

SetInterfaceDirection(Rid, bool)

Sets the menu text layout direction from right-to-left if isRtl is true.

Note: This method is implemented on macOS and Windows.

public void SetInterfaceDirection(Rid rid, bool isRtl)

Parameters

rid Rid
isRtl bool

SetItemAccelerator(Rid, int, Key)

Sets the accelerator of the item at index idx. keycode can be a single Key, or a combination of KeyModifierMasks and Keys using bitwise OR such as KEY_MASK_CTRL | KEY_A (Ctrl + A).

Note: This method is implemented only on macOS.

public void SetItemAccelerator(Rid rid, int idx, Key keycode)

Parameters

rid Rid
idx int
keycode Key

SetItemCallback(Rid, int, Callable)

Sets the callback of the item at index idx. Callback is emitted when an item is pressed.

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.

Note: This method is implemented on macOS and Windows.

public void SetItemCallback(Rid rid, int idx, Callable callback)

Parameters

rid Rid
idx int
callback Callable

SetItemCheckable(Rid, int, bool)

Sets whether the item at index idx has a checkbox. If false, sets the type of the item to plain text.

Note: This method is implemented on macOS and Windows.

public void SetItemCheckable(Rid rid, int idx, bool checkable)

Parameters

rid Rid
idx int
checkable bool

SetItemChecked(Rid, int, bool)

Sets the checkstate status of the item at index idx.

Note: This method is implemented on macOS and Windows.

public void SetItemChecked(Rid rid, int idx, bool @checked)

Parameters

rid Rid
idx int
checked bool

SetItemDisabled(Rid, int, bool)

Enables/disables the item at index idx. When it is disabled, it can't be selected and its action can't be invoked.

Note: This method is implemented on macOS and Windows.

public void SetItemDisabled(Rid rid, int idx, bool disabled)

Parameters

rid Rid
idx int
disabled bool

SetItemHidden(Rid, int, bool)

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.

Note: This method is implemented only on macOS.

public void SetItemHidden(Rid rid, int idx, bool hidden)

Parameters

rid Rid
idx int
hidden bool

SetItemHoverCallbacks(Rid, int, Callable)

Sets the callback of the item at index idx. The callback is emitted when an item is hovered.

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.

Note: This method is implemented only on macOS.

public void SetItemHoverCallbacks(Rid rid, int idx, Callable callback)

Parameters

rid Rid
idx int
callback Callable

SetItemIcon(Rid, int, Texture2D)

Replaces the Texture2D icon of the specified idx.

Note: This method is implemented on macOS and Windows.

Note: This method is not supported by macOS Dock menu items.

public void SetItemIcon(Rid rid, int idx, Texture2D icon)

Parameters

rid Rid
idx int
icon Texture2D

SetItemIndentationLevel(Rid, int, int)

Sets the horizontal offset of the item at the given idx.

Note: This method is implemented only on macOS.

public void SetItemIndentationLevel(Rid rid, int idx, int level)

Parameters

rid Rid
idx int
level int

SetItemKeyCallback(Rid, int, Callable)

Sets the callback of the item at index idx. Callback is emitted when its accelerator is activated.

Note: The keyCallback 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.

Note: This method is implemented only on macOS.

public void SetItemKeyCallback(Rid rid, int idx, Callable keyCallback)

Parameters

rid Rid
idx int
keyCallback Callable

SetItemMaxStates(Rid, int, int)

Sets number of state of a multistate item. See AddMultistateItem(Rid, string, int, int, Callable, Callable, Variant, Key, int) for details.

Note: This method is implemented on macOS and Windows.

public void SetItemMaxStates(Rid rid, int idx, int maxStates)

Parameters

rid Rid
idx int
maxStates int

SetItemRadioCheckable(Rid, int, bool)

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.

Note: This is purely cosmetic; you must add the logic for checking/unchecking items in radio groups.

Note: This method is implemented on macOS and Windows.

public void SetItemRadioCheckable(Rid rid, int idx, bool checkable)

Parameters

rid Rid
idx int
checkable bool

SetItemState(Rid, int, int)

Sets the state of a multistate item. See AddMultistateItem(Rid, string, int, int, Callable, Callable, Variant, Key, int) for details.

Note: This method is implemented on macOS and Windows.

public void SetItemState(Rid rid, int idx, int state)

Parameters

rid Rid
idx int
state int

SetItemSubmenu(Rid, int, Rid)

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.

Note: This method is implemented on macOS and Windows.

public void SetItemSubmenu(Rid rid, int idx, Rid submenuRid)

Parameters

rid Rid
idx int
submenuRid Rid

SetItemTag(Rid, int, Variant)

Sets the metadata of an item, which may be of any type. You can later get it with GetItemTag(Rid, int), which provides a simple way of assigning context data to items.

Note: This method is implemented on macOS and Windows.

public void SetItemTag(Rid rid, int idx, Variant tag)

Parameters

rid Rid
idx int
tag Variant

SetItemText(Rid, int, string)

Sets the text of the item at index idx.

Note: This method is implemented on macOS and Windows.

public void SetItemText(Rid rid, int idx, string text)

Parameters

rid Rid
idx int
text string

SetItemTooltip(Rid, int, string)

Sets the string tooltip of the item at the specified index idx.

Note: This method is implemented only on macOS.

public void SetItemTooltip(Rid rid, int idx, string tooltip)

Parameters

rid Rid
idx int
tooltip string

SetMinimumWidth(Rid, float)

Sets the minimum width of the global menu.

Note: This method is implemented only on macOS.

public void SetMinimumWidth(Rid rid, float width)

Parameters

rid Rid
width float

SetPopupCloseCallback(Rid, Callable)

Registers callable to emit when the menu is about to show.

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 IsOpened(Rid) to check if the menu is currently opened.

Note: This method is implemented only on macOS.

public void SetPopupCloseCallback(Rid rid, Callable callback)

Parameters

rid Rid
callback Callable

SetPopupOpenCallback(Rid, Callable)

Registers callable to emit after the menu is closed.

Note: This method is implemented only on macOS.

public void SetPopupOpenCallback(Rid rid, Callable callback)

Parameters

rid Rid
callback Callable