Exemple #1
0
        protected override void QueryContextMenuCore(Menu menu, IList <string> filenames, QueryContextMenuOptions flags)
        {
            if (filenames.Count != 1 || ContainsUnknownExtension(filenames))
            {
                return; // In this sample only extend the menu when only 1 .mvvv file is selected.
            }
            var menuMvvv = menu.AddSubMenu("Special commands for VVV files", new SmallBitmapCustomMenuHandler("MVVV", bitmapMenuIcon));

            menuMvvv.AddItem("&Open with notepad", "Open the VVV file with notepad", OnEditWithNotepadCommand);
            menuMvvv.AddItem(new SmallBitmapCustomMenuHandler("&About MMSF", bitmapMenuIcon), "Show the version number of the MMSF", OnAboutMmsf);

            // ... optional add more submenu's or more menu items.
        }
Exemple #2
0
        int IContextMenu.QueryContextMenu(IntPtr menuHandle, uint position, uint firstCommandId, uint lastCommandId, QueryContextMenuOptions flags)
        {
            Debug.WriteLine("[{0}] ContextMenuBase.IContextMenu.QueryContextMenu (menuHandle={1}, position={2}, firstCommandId={3}, lastCommandId={4}, flag={5})",
                            Id, menuHandle, position, firstCommandId, lastCommandId, flags);

            if (flags.HasFlag(QueryContextMenuOptions.DefaultOnly))
            {
                return(HResults.Create(Severity.Success, 0)); // don't add anything, only default menu items allowed.
            }
            menuItems.Clear();
            currentCommandId = firstCommandId;
            startCommandId   = firstCommandId;
            QueryContextMenuCore(new Menu(menuHandle, position, lastCommandId, this), FilesNames, flags);
            return(HResults.Create(Severity.Success, (ushort)(currentCommandId - firstCommandId)));
        }
Exemple #3
0
 int IContextMenu2.QueryContextMenu(IntPtr hmenu, uint indexMenu, uint idCommandFirst, uint idCmdLast, QueryContextMenuOptions flags)
 {
     return(((IContextMenu)this).QueryContextMenu(hmenu, indexMenu, idCommandFirst, idCmdLast, flags));
 }
Exemple #4
0
 /// <summary>
 /// Queries the context menu core.
 /// </summary>
 /// <param name="menu">The menu.</param>
 /// <param name="filenames">The filenames.</param>
 /// <param name="flags">The flags</param>
 protected abstract void QueryContextMenuCore(Menu menu, IList <string> filenames, QueryContextMenuOptions flags);