Beispiel #1
0
        internal static IntPtr FindPluginMenuItem(uint commandId, out uint index)
        {
            IntPtr pluginMenuHandle = ClassNPPTools.getPluginMenuHandle();

            index = 0u;
            if (pluginMenuHandle == IntPtr.Zero)
            {
                return(IntPtr.Zero);
            }
            uint num = 0u;

            while ((ulong)num < (ulong)((long)Win32Extendet.GetMenuItemCount(pluginMenuHandle)))
            {
                IntPtr subMenu = Win32Extendet.GetSubMenu(pluginMenuHandle, num, true);
                if (!(subMenu == IntPtr.Zero))
                {
                    uint num2 = 0u;
                    while ((ulong)num2 < (ulong)((long)Win32Extendet.GetMenuItemCount(subMenu)))
                    {
                        if (Win32Extendet.GetMenuItemId(subMenu, num2, true) == commandId)
                        {
                            index = num2;
                            return(subMenu);
                        }
                        num2 += 1u;
                    }
                }
                num += 1u;
            }
            return(IntPtr.Zero);
        }
Beispiel #2
0
        public static bool enablePluginMenuFunction(int myMenuIndex, bool enable)
        {
            bool   result = false;
            uint   uIDEnableItem;
            IntPtr intPtr = ClassNPPTools.FindPluginMenuItem((uint)PluginBase._funcItems.Items[myMenuIndex]._cmdID, out uIDEnableItem);

            if (intPtr != IntPtr.Zero)
            {
                uint uEnable = 1024u;
                if (!enable)
                {
                    uEnable = 1025u;
                }
                result = Win32Extendet.EnableMenuItem(intPtr, uIDEnableItem, uEnable);
            }
            return(result);
        }