コード例 #1
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            string key     = textBox1.Text;
            int    num     = 0;
            string tempKey = key;

            while (GroupsManager.GetGroup(tempKey) != null)
            {
                tempKey = key + " (" + ++num + ")";
            }
            key = tempKey;
            GroupsManager.AddGroup(key, chkAllTabs.Checked
                    ? Tabs.Select(item => item.CurrentPath)
                    : new string[] { newPath });
        }
コード例 #2
0
            public string[] GetGroupPaths(string groupName)
            {
                Group g = GroupsManager.GetGroup(groupName);

                return(g == null ? null : g.Paths.ToArray());
            }
コード例 #3
0
        // TODO: what does this do?!
        // TODO: whatever it does, it should be returning an idl, not a path.
        public static string TrackGroupContextMenu(string groupName, Point pnt, IntPtr pDropDownHandle)
        {
            string name = string.Empty;
            Group  g    = GroupsManager.GetGroup(groupName);

            if (g == null)
            {
                return(name);
            }
            ContextMenu menu = new ContextMenu();

            if (!QTUtility.IsXP)
            {
                foreach (string str2 in g.Paths)
                {
                    string text;
                    if (str2.StartsWith(@"\\"))
                    {
                        text = str2;
                    }
                    else
                    {
                        text = ShellMethods.GetDisplayName(str2);
                    }
                    MenuItem item = new MenuItem(text);
                    item.Name = str2;
                    menu.MenuItems.Add(item);
                }
            }
            else
            {
                foreach (string path in g.Paths)
                {
                    string displayName;
                    if (path.StartsWith(@"\\"))
                    {
                        displayName = path;
                    }
                    else
                    {
                        displayName = ShellMethods.GetDisplayName(path);
                    }
                    MenuItemEx ex = new MenuItemEx(displayName);
                    ex.Name  = path;
                    ex.Image = QTUtility.ImageListGlobal.Images[QTUtility.GetImageKey(path, null)];
                    menu.MenuItems.Add(ex);
                }
            }
            List <IntPtr> list = new List <IntPtr>();

            if (!QTUtility.IsXP)
            {
                for (int k = 0; k < g.Paths.Count; k++)
                {
                    string imageKey = QTUtility.GetImageKey(g.Paths[k], null);
                    IntPtr hbitmap  = ((Bitmap)QTUtility.ImageListGlobal.Images[imageKey]).GetHbitmap(Color.Black);
                    if (hbitmap != IntPtr.Zero)
                    {
                        list.Add(hbitmap);
                        PInvoke.SetMenuItemBitmaps(menu.Handle, k, 0x400, hbitmap, IntPtr.Zero);
                    }
                }
            }
            uint maxValue = uint.MaxValue;

            if (menu.MenuItems.Count > 0)
            {
                maxValue = PInvoke.TrackPopupMenu(menu.Handle, 0x180, pnt.X, pnt.Y, 0, pDropDownHandle, IntPtr.Zero);
                if (maxValue != 0)
                {
                    for (int m = 0; m < menu.MenuItems.Count; m++)
                    {
                        if (maxValue == PInvoke.GetMenuItemID(menu.Handle, m))
                        {
                            name = menu.MenuItems[m].Name;
                            break;
                        }
                    }
                }
            }
            menu.Dispose();
            if (!QTUtility.IsXP)
            {
                foreach (IntPtr ptr2 in list)
                {
                    PInvoke.DeleteObject(ptr2);
                }
            }
            if (maxValue != 0)
            {
                return(name);
            }
            return(null);
        }