private void OnAddMenu(IContextMenuCallback piCallback, ArrayList menuItems, InsertionPointId insertionPointId) { if (menuItems != null) { foreach (ContextMenuItem item in menuItems) { if (item.Visible) { ContextSubMenuItem subMenuItem = item as ContextSubMenuItem; if (subMenuItem == null) { AddItem(piCallback, item, insertionPointId); } else { AddItem(piCallback, subMenuItem, insertionPointId); // Iterate through each sub menu. foreach (ContextMenuItem menuItem in subMenuItem.MenuItems) { if (menuItem.Visible) { AddItem(piCallback, subMenuItem, menuItem); } } } } } } }
protected void AddTaskMenuItemAndChildren(ContextSubMenuItem item) { AddTaskMenuItem(item); foreach (ContextMenuItem childItem in item.MenuItems) { AddMenuItem(childItem); } }
protected void AddSubMenuItem(ContextSubMenuItem item) { AddMenuItem(item); if (m_subMenuItems == null) { m_subMenuItems = new ArrayList(); } m_subMenuItems.Add(item); }
private void AddItem(IContextMenuCallback piCallback, ContextSubMenuItem subMenuItem, ContextMenuItem menuItem) { MmcContextMenuItem item = new MmcContextMenuItem(); item.Name = menuItem.Name; item.StatusBarText = menuItem.StatusText; item.CommandId = menuItem.CommandId; item.InsertionPointId = (uint)subMenuItem.CommandId; item.Flags = 0; item.SpecialFlags = 0; piCallback.AddItem(ref item); }
private void RemoveMenuItem(ContextMenuItem item) { if (m_menuItems != null) { ContextSubMenuItem subMenuItem = item as ContextSubMenuItem; if (subMenuItem != null) { // Remove all sub-items first. foreach (ContextMenuItem subItem in subMenuItem.MenuItems) { RemoveMenuItem(subItem); } } m_menuItems.Remove(item); } }
protected void AddMenuItem(ContextSubMenuItem subMenuItem, ContextMenuItem item) { AddMenuItem(item); subMenuItem.AddMenuItem(item); }