Esempio n. 1
0
        /// <summary>
        /// Adds the item.
        /// </summary>
        /// <param name="customMenuHandler">The custom menu handler.</param>
        /// <param name="helpText">The help.</param>
        /// <param name="contextCommand">The context command.</param>
        public void AddItem(CustomMenuHandler customMenuHandler, string helpText, ContextCommand contextCommand)
        {
            Contract.Requires(customMenuHandler != null);
            Contract.Requires(helpText != null);
            Contract.Requires(contextCommand != null);

            var menuItemInfo = new MenuItemInfo();

            menuItemInfo.InitializeSize();
            menuItemInfo.Id = menuHost.GetCommandId();

            customMenuHandler.InitializeItemInfo(ref menuItemInfo);

            InsertMenuItem(ref menuItemInfo, helpText, contextCommand, customMenuHandler);
        }
Esempio n. 2
0
        /// <summary>
        /// Adds the sub menu.
        /// </summary>
        /// <returns></returns>
        public Menu AddSubMenu(string helpText, CustomMenuHandler customMenuHandler)
        {
            ////Contract.Requires(helpText != null);
            ////Contract.Requires(customMenuHandler != null);

            IntPtr subMenu = CreateSubMenu();

            var menuItemInfo = new MenuItemInfo();

            menuItemInfo.InitializeSize();
            menuItemInfo.Id      = menuHost.GetCommandId();
            menuItemInfo.SubMenu = subMenu;

            customMenuHandler.InitializeItemInfo(ref menuItemInfo);

            InsertMenuItem(ref menuItemInfo, helpText, null, customMenuHandler);

            return(new Menu(subMenu, indexMenu, idCmdLast, menuHost));
        }
Esempio n. 3
0
        /// <summary>
        /// Adds the item.
        /// </summary>
        /// <param name="customMenuHandler">The custom menu handler.</param>
        /// <param name="helpText">The help.</param>
        /// <param name="contextCommand">The context command.</param>
        public void AddItem(CustomMenuHandler customMenuHandler, string helpText, ContextCommand contextCommand)
        {
            if (customMenuHandler == null)
            {
                throw new ArgumentNullException(nameof(customMenuHandler));
            }

            ////Contract.Requires(helpText != null);
            ////Contract.Requires(contextCommand != null);

            var menuItemInfo = new MenuItemInfo();

            menuItemInfo.InitializeSize();
            menuItemInfo.Id = menuHost.GetCommandId();

            customMenuHandler.InitializeItemInfo(ref menuItemInfo);

            InsertMenuItem(ref menuItemInfo, helpText, contextCommand, customMenuHandler);
        }