Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        private void AddItem(IContextMenuCallback piCallback, ContextMenuItem menuItem, InsertionPointId insertionPointId)
        {
            MmcContextMenuItem newItem = new MmcContextMenuItem();

            newItem.Name             = menuItem.Name;
            newItem.StatusBarText    = menuItem.StatusText;
            newItem.CommandId        = menuItem.CommandId;
            newItem.InsertionPointId = (uint)insertionPointId;

            if (menuItem.IsSeparator)
            {
                newItem.Flags = (int)ContextMenuFlags.Separator;
            }
            else
            {
                newItem.Flags = (menuItem.IsChecked ? (int)ContextMenuFlags.Checked : (int)ContextMenuFlags.Unchecked)
                                | (menuItem.IsEnabled ? (int)ContextMenuFlags.Enabled : (int)(ContextMenuFlags.Grayed | ContextMenuFlags.Disabled));
            }

            newItem.SpecialFlags = menuItem.IsDefault ? (int)ContextMenuFlags.SpecialDefaultItem : 0;
            piCallback.AddItem(ref newItem);
        }