/// <summary> /// Registers a menu for the application</summary> /// <param name="commandRegistry">ICommandService</param> /// <param name="menuTag">Menu's unique ID</param> /// <param name="menuText">Command text as it appears in menu</param> /// <param name="description">Menu description</param> public static void RegisterMenu( this ICommandService commandRegistry, object menuTag, string menuText, string description) { Requires.NotNull(commandRegistry, "commandRegistry"); var def = new MenuDef(menuTag, menuText, description); commandRegistry.RegisterMenu(def); }
private void AddMenu(MenuDef def) { var menu = new RootMenu(def); if (menu.MenuTag is Sce.Atf.Applications.StandardMenu) m_toolbars.Add(menu); else m_toolbars.Insert(m_toolbars.Count - 2, menu); // insert custom menus before Window, Help }
private void AddMenu(MenuDef def) { var menu = new RootMenu(def); menu.RefreshRequested += (s, e) => RebuildMenu((Menu)s); if (menu.MenuTag is Sce.Atf.Applications.StandardMenu) m_menus.Add(menu); else m_menus.Insert(m_menus.Count - 2, menu); // insert custom menus before Window, Help }
/// <summary> /// Registers a menu for the application. /// NOTE: This could be replaced with MEF composition?</summary> /// <param name="definition">Menu definition</param> public void RegisterMenu(MenuDef definition) { Requires.NotNull(definition.MenuTag, "menuTag"); if (m_menus.Any <MenuDef>(x => x.MenuTag == definition.MenuTag)) { throw new ArgumentException("Menu already registered"); } m_menus.Add(definition); int index = m_menus.IndexOf(definition); MenuAdded.Raise <ItemInsertedEventArgs <MenuDef> >(this, new ItemInsertedEventArgs <MenuDef>(index, definition)); }
public RootMenu(MenuDef def) : base(null, def.MenuTag, null, def.Text, def.Description) { }
/// <summary> /// Registers a menu for the application. /// NOTE: This could be replaced with MEF composition?</summary> /// <param name="definition">Menu definition</param> public void RegisterMenu(MenuDef definition) { Requires.NotNull(definition.MenuTag, "menuTag"); if(m_menus.Any<MenuDef>(x => x.MenuTag == definition.MenuTag)) throw new ArgumentException("Menu already registered"); m_menus.Add(definition); int index = m_menus.IndexOf(definition); MenuAdded.Raise<ItemInsertedEventArgs<MenuDef>>(this, new ItemInsertedEventArgs<MenuDef>(index, definition)); }