Game Development Reference
In-Depth Information
(uint)Native.MaskFlags.State |
(uint)Native.MaskFlags.SubMenu |
(uint)Native.MaskFlags.ID;
menuItemInfo.Type = (uint)Native.MenuFlags.String;
menuItemInfo.State = (uint)Native.MenuFlags.Enabled;
Native.InsertMenuItem(menu, (uint)menuId, 1, ref menuItemInfo);
AddMenuSeparator(menu, menuId + 1);
}
}
catch (Exception exception)
{
HandleError(exception);
}
return id;
}
The base class exposes a method that is used to register commands with the under-
lying framework and create the submenu items for the context menu. The follow-
ing code shows this method. Specifying - (a hyphen) as the command text will
insert a separator entry, which is useful for cleaning up menus with multiple groups
of commands.
protected void RegisterCommand(string command)
{
_commandPosition++;
_commandIdentifier++;
if (command == “-”)
{
AddMenuSeparator(_popupMenu, (uint)(_commandPosition));
}
else
{
_commands.Add(_commandPosition, command);
AddMenuItem(_popupMenu,
command,
_commandIdentifier,
(uint)(_commandPosition));
}
}
Search Nedrilad ::




Custom Search