public static Menu CreateMenuFromActions(string name, IEnumerable<ActionItem> actions) { Menu menu = FindMenu(name); if (menu != null) { mgr.UnRegisterMenu(menu._Menu); Kernel._Global.ReleaseIMenu(menu._Menu); menu = null; } menu = new Menu(); menu.Title = name; RegisterMenu(menu); foreach (var a in actions) menu.AddItem(new MenuItem(a)); MenuItem item = new MenuItem(); item.Title = name; item.SubMenu = menu; MainMenuBar.AddItem(item); UpdateMenuBar(); return menu; }
public void AddItem(MenuItem item) { InsertItem(item, menu.NumItems); }
public void Delete(MenuItem item) { menu.RemoveItem(item._Item); }
public void InsertItem(MenuItem item, int position) { menu.AddItem(item._Item, position); }