Example #1
0
        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);
                                }
                            }
                        }
                    }
                }
            }
        }
Example #2
0
 protected void AddTaskMenuItemAndChildren(ContextSubMenuItem item)
 {
     AddTaskMenuItem(item);
     foreach (ContextMenuItem childItem in item.MenuItems)
     {
         AddMenuItem(childItem);
     }
 }
Example #3
0
 protected void AddSubMenuItem(ContextSubMenuItem item)
 {
     AddMenuItem(item);
     if (m_subMenuItems == null)
     {
         m_subMenuItems = new ArrayList();
     }
     m_subMenuItems.Add(item);
 }
Example #4
0
        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);
        }
Example #5
0
        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);
            }
        }
Example #6
0
 protected void AddMenuItem(ContextSubMenuItem subMenuItem, ContextMenuItem item)
 {
     AddMenuItem(item);
     subMenuItem.AddMenuItem(item);
 }