reckfellENGINE

NativeMenu

A server interface for OS native menus.

On this page
class NativeMenuReckfellSharp

A server interface for OS native menus.

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 MenuBar.PreferGlobalMenu set to true, and PopupMenu with PopupMenu.PreferNativeMenu set to true. To create a menu, use NativeMenu.CreateMenu, add menu items using add_*_item methods. To remove a menu, use NativeMenu.FreeMenu.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Properties1

SingletonProperty
# Singleton
C#
public static NativeMenuInstance Singleton { get; }

Methods71

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

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 ([kbd]Ctrl + A[/kbd]). Note: The callback and key_callback Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to tag. Note: This method is implemented on macOS and Windows. Note: On Windows, accelerator and key_callback are ignored.

Parameters
NameTypeDefault
ridRid—
labelstring—
callbackCallabledefault
keyCallbackCallabledefault
tagVariantdefault
acceleratorKeyKey.None
indexint-1
Returns int
AddIconCheckItemint
# AddIconCheckItem
C#
public static int AddIconCheckItem(Rid rid, Texture2D icon, string label, Callable callback = default, Callable keyCallback = default, Variant tag = default, Key accelerator = Key.None, int index = -1);

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 ([kbd]Ctrl + A[/kbd]). Note: The callback and key_callback Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to tag. Note: This method is implemented on macOS and Windows. Note: On Windows, accelerator and key_callback are ignored.

Parameters
NameTypeDefault
ridRid—
iconTexture2D—
labelstring—
callbackCallabledefault
keyCallbackCallabledefault
tagVariantdefault
acceleratorKeyKey.None
indexint-1
Returns int
AddIconItemint
# AddIconItem
C#
public static int AddIconItem(Rid rid, Texture2D icon, string label, Callable callback = default, Callable keyCallback = default, Variant tag = default, Key accelerator = Key.None, int index = -1);

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 ([kbd]Ctrl + A[/kbd]). Note: The callback and key_callback Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to tag. Note: This method is implemented on macOS and Windows. Note: On Windows, accelerator and key_callback are ignored.

Parameters
NameTypeDefault
ridRid—
iconTexture2D—
labelstring—
callbackCallabledefault
keyCallbackCallabledefault
tagVariantdefault
acceleratorKeyKey.None
indexint-1
Returns int
AddIconRadioCheckItemint
# AddIconRadioCheckItem
C#
public static int AddIconRadioCheckItem(Rid rid, Texture2D icon, string label, Callable callback = default, Callable keyCallback = default, Variant tag = default, Key accelerator = Key.None, int index = -1);

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 ([kbd]Ctrl + A[/kbd]). Note: Radio-checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See NativeMenu.SetItemChecked for more info on how to control it. Note: The callback and key_callback Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to tag. Note: This method is implemented on macOS and Windows. Note: On Windows, accelerator and key_callback are ignored.

Parameters
NameTypeDefault
ridRid—
iconTexture2D—
labelstring—
callbackCallabledefault
keyCallbackCallabledefault
tagVariantdefault
acceleratorKeyKey.None
indexint-1
Returns int
AddItemint
# AddItem
C#
public static int AddItem(Rid rid, string label, Callable callback = default, Callable keyCallback = default, Variant tag = default, Key accelerator = Key.None, int index = -1);

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 ([kbd]Ctrl + A[/kbd]). Note: The callback and key_callback Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to tag. Note: This method is implemented on macOS and Windows. Note: On Windows, accelerator and key_callback are ignored.

Parameters
NameTypeDefault
ridRid—
labelstring—
callbackCallabledefault
keyCallbackCallabledefault
tagVariantdefault
acceleratorKeyKey.None
indexint-1
Returns int
AddMultistateItemint
# AddMultistateItem
C#
public static 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);

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 max_states. Each press or activate of the item will increase the state by one. The default value is defined by default_state. 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 ([kbd]Ctrl + A[/kbd]). Note: By default, there's no indication of the current item state, it should be changed manually. Note: The callback and key_callback Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to tag. Note: This method is implemented on macOS and Windows. Note: On Windows, accelerator and key_callback are ignored.

Parameters
NameTypeDefault
ridRid—
labelstring—
maxStatesint—
defaultStateint—
callbackCallabledefault
keyCallbackCallabledefault
tagVariantdefault
acceleratorKeyKey.None
indexint-1
Returns int
AddRadioCheckItemint
# AddRadioCheckItem
C#
public static int AddRadioCheckItem(Rid rid, string label, Callable callback = default, Callable keyCallback = default, Variant tag = default, Key accelerator = Key.None, int index = -1);

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 ([kbd]Ctrl + A[/kbd]). Note: Radio-checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See NativeMenu.SetItemChecked for more info on how to control it. Note: The callback and key_callback Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to tag. Note: This method is implemented on macOS and Windows. Note: On Windows, accelerator and key_callback are ignored.

Parameters
NameTypeDefault
ridRid—
labelstring—
callbackCallabledefault
keyCallbackCallabledefault
tagVariantdefault
acceleratorKeyKey.None
indexint-1
Returns int
AddSeparatorint
# AddSeparator
C#
public static int AddSeparator(Rid rid, int index = -1);

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.

Parameters
NameTypeDefault
ridRid—
indexint-1
Returns int
AddSubmenuItemint
# AddSubmenuItem
C#
public static int AddSubmenuItem(Rid rid, string label, Rid submenuRid, Variant tag = default, int index = -1);

Adds an item that will act as a submenu of the global menu rid. The submenu_rid argument is the RID of the global menu that will be shown when the item is clicked. 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.

Parameters
NameTypeDefault
ridRid—
labelstring—
submenuRidRid—
tagVariantdefault
indexint-1
Returns int
Clearvoid
# Clear
C#
public static void Clear(Rid rid);

Removes all items from the global menu rid. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
CreateMenuRid
# CreateMenu
C#
public static Rid CreateMenu();

Creates a new global menu object. Note: This method is implemented on macOS and Windows.

Returns Rid
FindItemIndexWithSubmenuint
# FindItemIndexWithSubmenu
C#
public static int FindItemIndexWithSubmenu(Rid rid, Rid submenuRid);

Returns the index of the item with the submenu specified by submenu_rid. Indices are automatically assigned to each item by the engine. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
submenuRidRid—
Returns int
FindItemIndexWithTagint
# FindItemIndexWithTag
C#
public static int FindItemIndexWithTag(Rid rid, Variant tag);

Returns the index of the item with the specified tag. Indices are automatically assigned to each item by the engine. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
tagVariant—
Returns int
FindItemIndexWithTextint
# FindItemIndexWithText
C#
public static int FindItemIndexWithText(Rid rid, string text);

Returns the index of the item with the specified text. Indices are automatically assigned to each item by the engine. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
textstring—
Returns int
FreeMenuvoid
# FreeMenu
C#
public static void FreeMenu(Rid rid);

Frees a global menu object created by this NativeMenu. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
GetItemAcceleratorKey
# GetItemAccelerator
C#
public static Key GetItemAccelerator(Rid rid, int idx);

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.

Parameters
NameTypeDefault
ridRid—
idxint—
Returns Key
GetItemCallbackCallable
# GetItemCallback
C#
public static Callable GetItemCallback(Rid rid, int idx);

Returns the callback of the item at index idx. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
idxint—
Returns Callable
GetItemCountint
# GetItemCount
C#
public static int GetItemCount(Rid rid);

Returns number of items in the global menu rid. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
Returns int
GetItemIconTexture2D
# GetItemIcon
C#
public static Texture2D GetItemIcon(Rid rid, int idx);

Returns the icon of the item at index idx. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
idxint—
Returns Texture2D
GetItemIndentationLevelint
# GetItemIndentationLevel
C#
public static int GetItemIndentationLevel(Rid rid, int idx);

Returns the horizontal offset of the item at the given idx. Note: This method is implemented only on macOS.

Parameters
NameTypeDefault
ridRid—
idxint—
Returns int
GetItemKeyCallbackCallable
# GetItemKeyCallback
C#
public static Callable GetItemKeyCallback(Rid rid, int idx);

Returns the callback of the item accelerator at index idx. Note: This method is implemented only on macOS.

Parameters
NameTypeDefault
ridRid—
idxint—
Returns Callable
GetItemMaxStatesint
# GetItemMaxStates
C#
public static int GetItemMaxStates(Rid rid, int idx);

Returns number of states of a multistate item. See NativeMenu.AddMultistateItem for details. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
idxint—
Returns int
GetItemStateint
# GetItemState
C#
public static int GetItemState(Rid rid, int idx);

Returns the state of a multistate item. See NativeMenu.AddMultistateItem for details. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
idxint—
Returns int
GetItemSubmenuRid
# GetItemSubmenu
C#
public static Rid GetItemSubmenu(Rid rid, int idx);

Returns the submenu ID of the item at index idx. See NativeMenu.AddSubmenuItem for more info on how to add a submenu. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
idxint—
Returns Rid
GetItemTagVariant
# GetItemTag
C#
public static Variant GetItemTag(Rid rid, int idx);

Returns the metadata of the specified item, which might be of any type. You can set it with NativeMenu.SetItemTag, which provides a simple way of assigning context data to items. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
idxint—
Returns Variant
GetItemTextstring
# GetItemText
C#
public static string GetItemText(Rid rid, int idx);

Returns the text of the item at index idx. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
idxint—
Returns string
GetItemTooltipstring
# GetItemTooltip
C#
public static string GetItemTooltip(Rid rid, int idx);

Returns the tooltip associated with the specified index idx. Note: This method is implemented only on macOS.

Parameters
NameTypeDefault
ridRid—
idxint—
Returns string
GetMinimumWidthfloat
# GetMinimumWidth
C#
public static float GetMinimumWidth(Rid rid);

Returns global menu minimum width. Note: This method is implemented only on macOS.

Parameters
NameTypeDefault
ridRid—
Returns float
GetPopupCloseCallbackCallable
# GetPopupCloseCallback
C#
public static Callable GetPopupCloseCallback(Rid rid);

Returns global menu close callback. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
Returns Callable
GetPopupOpenCallbackCallable
# GetPopupOpenCallback
C#
public static Callable GetPopupOpenCallback(Rid rid);

Returns global menu open callback. Note: This method is implemented only on macOS.

Parameters
NameTypeDefault
ridRid—
Returns Callable
GetSizeVector2
# GetSize
C#
public static Vector2 GetSize(Rid rid);

Returns global menu size. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
Returns Vector2
GetSystemMenuRid
# GetSystemMenu
C#
public static Rid GetSystemMenu(NativeMenu.SystemMenus menuId);

Returns RID of a special system menu. Note: This method is implemented only on macOS.

Parameters
NameTypeDefault
menuIdNativeMenu.SystemMenus—
Returns Rid
GetSystemMenuNamestring
# GetSystemMenuName
C#
public static string GetSystemMenuName(NativeMenu.SystemMenus menuId);

Returns readable name of a special system menu. Note: This method is implemented only on macOS.

Parameters
NameTypeDefault
menuIdNativeMenu.SystemMenus—
Returns string
GetSystemMenuTextstring
# GetSystemMenuText
C#
public static string GetSystemMenuText(NativeMenu.SystemMenus menuId);

Returns the text of the system menu item. Note: This method is implemented on macOS.

Parameters
NameTypeDefault
menuIdNativeMenu.SystemMenus—
Returns string
HasFeaturebool
# HasFeature
C#
public static bool HasFeature(NativeMenu.Feature feature);

Returns true if the specified feature is supported by the current NativeMenu, false otherwise. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
featureNativeMenu.Feature—
Returns bool
HasMenubool
# HasMenu
C#
public static bool HasMenu(Rid rid);

Returns true if rid is valid global menu. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
Returns bool
HasSystemMenubool
# HasSystemMenu
C#
public static bool HasSystemMenu(NativeMenu.SystemMenus menuId);

Returns true if a special system menu is supported. Note: This method is implemented only on macOS.

Parameters
NameTypeDefault
menuIdNativeMenu.SystemMenus—
Returns bool
IsItemCheckablebool
# IsItemCheckable
C#
public static bool IsItemCheckable(Rid rid, int idx);

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.

Parameters
NameTypeDefault
ridRid—
idxint—
Returns bool
IsItemCheckedbool
# IsItemChecked
C#
public static bool IsItemChecked(Rid rid, int idx);

Returns true if the item at index idx is checked. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
idxint—
Returns bool
IsItemDisabledbool
# IsItemDisabled
C#
public static bool IsItemDisabled(Rid rid, int idx);

Returns true if the item at index idx is disabled. When it is disabled it can't be selected, or its action invoked. See NativeMenu.SetItemDisabled for more info on how to disable an item. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
idxint—
Returns bool
IsItemHiddenbool
# IsItemHidden
C#
public static bool IsItemHidden(Rid rid, int idx);

Returns true if the item at index idx is hidden. See NativeMenu.SetItemHidden for more info on how to hide an item. Note: This method is implemented only on macOS.

Parameters
NameTypeDefault
ridRid—
idxint—
Returns bool
IsItemIndeterminatebool
# IsItemIndeterminate
C#
public static bool IsItemIndeterminate(Rid rid, int idx);

Returns true if the item at index idx is indeterminate. See NativeMenu.SetItemIndeterminate for more info on how to set an item. Note: This method is implemented only on macOS.

Parameters
NameTypeDefault
ridRid—
idxint—
Returns bool
IsItemRadioCheckablebool
# IsItemRadioCheckable
C#
public static bool IsItemRadioCheckable(Rid rid, int idx);

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.

Parameters
NameTypeDefault
ridRid—
idxint—
Returns bool
IsOpenedbool
# IsOpened
C#
public static bool IsOpened(Rid rid);

Returns true if the menu is currently opened. Note: This method is implemented only on macOS.

Parameters
NameTypeDefault
ridRid—
Returns bool
IsSystemMenubool
# IsSystemMenu
C#
public static bool IsSystemMenu(Rid rid);

Return true is global menu is a special system menu. Note: This method is implemented only on macOS.

Parameters
NameTypeDefault
ridRid—
Returns bool
Popupvoid
# Popup
C#
public static void Popup(Rid rid, Vector2I position);

Shows the global menu at position in the screen coordinates. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
positionVector2I—
RemoveItemvoid
# RemoveItem
C#
public static void RemoveItem(Rid rid, int idx);

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.

Parameters
NameTypeDefault
ridRid—
idxint—
SetInterfaceDirectionvoid
# SetInterfaceDirection
C#
public static void SetInterfaceDirection(Rid rid, bool isRtl);

Sets the menu text layout direction from right-to-left if is_rtl is true. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
isRtlbool—
SetItemAcceleratorvoid
# SetItemAccelerator
C#
public static void SetItemAccelerator(Rid rid, int idx, Key keycode);

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 ([kbd]Ctrl + A[/kbd]). Note: This method is implemented only on macOS.

Parameters
NameTypeDefault
ridRid—
idxint—
keycodeKey—
SetItemCallbackvoid
# SetItemCallback
C#
public static void SetItemCallback(Rid rid, int idx, Callable callback);

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.

Parameters
NameTypeDefault
ridRid—
idxint—
callbackCallable—
SetItemCheckablevoid
# SetItemCheckable
C#
public static void SetItemCheckable(Rid rid, int idx, bool checkable);

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.

Parameters
NameTypeDefault
ridRid—
idxint—
checkablebool—
SetItemCheckedvoid
# SetItemChecked
C#
public static void SetItemChecked(Rid rid, int idx, bool @checked);

Sets the checkstate status of the item at index idx. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
idxint—
checkedbool—
SetItemDisabledvoid
# SetItemDisabled
C#
public static void SetItemDisabled(Rid rid, int idx, bool disabled);

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.

Parameters
NameTypeDefault
ridRid—
idxint—
disabledbool—
SetItemHiddenvoid
# SetItemHidden
C#
public static void SetItemHidden(Rid rid, int idx, bool hidden);

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.

Parameters
NameTypeDefault
ridRid—
idxint—
hiddenbool—
SetItemHoverCallbacksvoid
# SetItemHoverCallbacks
C#
public static void SetItemHoverCallbacks(Rid rid, int idx, Callable callback);

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.

Parameters
NameTypeDefault
ridRid—
idxint—
callbackCallable—
SetItemIconvoid
# SetItemIcon
C#
public static void SetItemIcon(Rid rid, int idx, Texture2D icon);

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.

Parameters
NameTypeDefault
ridRid—
idxint—
iconTexture2D—
SetItemIndentationLevelvoid
# SetItemIndentationLevel
C#
public static void SetItemIndentationLevel(Rid rid, int idx, int level);

Sets the horizontal offset of the item at the given idx. Note: This method is implemented only on macOS.

Parameters
NameTypeDefault
ridRid—
idxint—
levelint—
SetItemIndeterminatevoid
# SetItemIndeterminate
C#
public static void SetItemIndeterminate(Rid rid, int idx, bool indeterminate);

Sets the indeterminate status of the item at index idx. Note: This method is implemented only on macOS.

Parameters
NameTypeDefault
ridRid—
idxint—
indeterminatebool—
SetItemIndexint
# SetItemIndex
C#
public static int SetItemIndex(Rid rid, int idx, int targetIdx);

Changes the index of the item at index idx to be at index target_idx. This can be used to move an item above other items. Returns the new index of the moved item, it's not guaranteed to be the same as target_idx. Note: The indices of any items between index idx and index target_idx will be shifted by one. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
idxint—
targetIdxint—
Returns int
SetItemKeyCallbackvoid
# SetItemKeyCallback
C#
public static void SetItemKeyCallback(Rid rid, int idx, Callable keyCallback);

Sets the callback of the item at index idx. Callback is emitted when its accelerator is activated. Note: The key_callback Callable needs to accept exactly one Variant parameter, the parameter passed to the Callable will be the value passed to the tag parameter when the menu item was created. Note: This method is implemented only on macOS.

Parameters
NameTypeDefault
ridRid—
idxint—
keyCallbackCallable—
SetItemMaxStatesvoid
# SetItemMaxStates
C#
public static void SetItemMaxStates(Rid rid, int idx, int maxStates);

Sets number of state of a multistate item. See NativeMenu.AddMultistateItem for details. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
idxint—
maxStatesint—
SetItemRadioCheckablevoid
# SetItemRadioCheckable
C#
public static void SetItemRadioCheckable(Rid rid, int idx, bool checkable);

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.

Parameters
NameTypeDefault
ridRid—
idxint—
checkablebool—
SetItemStatevoid
# SetItemState
C#
public static void SetItemState(Rid rid, int idx, int state);

Sets the state of a multistate item. See NativeMenu.AddMultistateItem for details. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
idxint—
stateint—
SetItemSubmenuvoid
# SetItemSubmenu
C#
public static void SetItemSubmenu(Rid rid, int idx, Rid submenuRid);

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.

Parameters
NameTypeDefault
ridRid—
idxint—
submenuRidRid—
SetItemTagvoid
# SetItemTag
C#
public static void SetItemTag(Rid rid, int idx, Variant tag);

Sets the metadata of an item, which may be of any type. You can later get it with NativeMenu.GetItemTag, which provides a simple way of assigning context data to items. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
idxint—
tagVariant—
SetItemTextvoid
# SetItemText
C#
public static void SetItemText(Rid rid, int idx, string text);

Sets the text of the item at index idx. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
idxint—
textstring—
SetItemTooltipvoid
# SetItemTooltip
C#
public static void SetItemTooltip(Rid rid, int idx, string tooltip);

Sets the string tooltip of the item at the specified index idx. Note: This method is implemented only on macOS.

Parameters
NameTypeDefault
ridRid—
idxint—
tooltipstring—
SetMinimumWidthvoid
# SetMinimumWidth
C#
public static void SetMinimumWidth(Rid rid, float width);

Sets the minimum width of the global menu. Note: This method is implemented only on macOS.

Parameters
NameTypeDefault
ridRid—
widthfloat—
SetPopupCloseCallbackvoid
# SetPopupCloseCallback
C#
public static void SetPopupCloseCallback(Rid rid, Callable callback);

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 NativeMenu.IsOpened to check if the menu is currently opened. Note: This method is implemented on macOS and Windows.

Parameters
NameTypeDefault
ridRid—
callbackCallable—
SetPopupOpenCallbackvoid
# SetPopupOpenCallback
C#
public static void SetPopupOpenCallback(Rid rid, Callable callback);

Registers callable to emit after the menu is closed. Note: This method is implemented only on macOS.

Parameters
NameTypeDefault
ridRid—
callbackCallable—
SetSystemMenuTextvoid
# SetSystemMenuText
C#
public static void SetSystemMenuText(NativeMenu.SystemMenus menuId, string name);

Sets the text of the system menu item. Note: This method is implemented on macOS.

Parameters
NameTypeDefault
menuIdNativeMenu.SystemMenus—
namestring—

NativeMenu.Feature

ValueDescription
GlobalMenu = 0

NativeMenu supports native global main menu.

HoverCallback = 3

NativeMenu supports menu item hover callback.

KeyCallback = 4

NativeMenu supports menu item accelerator/key callback.

OpenCloseCallback = 2

NativeMenu supports menu open and close callbacks.

PopupMenu = 1

NativeMenu supports native popup menus.

NativeMenu.SystemMenus

ValueDescription
ApplicationMenuId = 2

Application (first menu after "Apple" menu on macOS) menu ID.

DockMenuId = 5

Dock icon right-click menu ID (on macOS this menu include standard application control items and a list of open windows).

HelpMenuId = 4

"Help" menu ID (on macOS this menu includes help search bar).

InvalidMenuId = 0

Invalid special system menu ID.

MainMenuId = 1

Global main menu ID.

WindowMenuId = 3

"Window" menu ID (on macOS this menu includes standard window control items and a list of open windows).

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.