示例#1
0
        private void CreateItems(bool fRefresh) {
            ManageImageList(fRefresh);
            toolStrip.SuspendLayout();
            if(iSearchResultCount != -1) {
                Explorer.Refresh();
            }
            RefreshSearchBox(false);
            if(searchBox != null) {
                searchBox.Dispose();
                timerSerachBox_Search.Dispose();
                timerSearchBox_Rearrange.Dispose();
                searchBox = null;
                timerSerachBox_Search = null;
                timerSearchBox_Rearrange = null;
            }
            ClearToolStripItems();
            toolStrip.ShowItemToolTips = QTUtility.CheckConfig(Settings.ShowTooltips);
            Height = LargeButton ? 0x22 : 0x1a;
            bool flag = (ConfigValues[0] & 0x20) == 0x20;
            bool flag2 = (ConfigValues[0] & 0x10) == 0x10;
            UnloadPluginsOnCreation();
            foreach(int num in ButtonIndexes) {
                ToolStripItem item;
                switch(num) {
                    case 0: {
                            ToolStripSeparator separator = new ToolStripSeparator();
                            separator.Tag = 0;
                            toolStrip.Items.Add(separator);
                            goto Label_050D;
                        }
                    case 3:
                    case 4:
                    case 5:
                        item = CreateDropDownButton(num);
                        break;

                    case 9: {
                            item = new ToolStripDropDownButton();
                            string[] strArray = QTUtility.TextResourcesDic["ButtonBar_Misc"];
                            DropDownMenuBase base2 = new DropDownMenuBase(components);
                            base2.ShowCheckMargin = QTUtility.CheckConfig(Settings.NonDefaultMenu) && !QTUtility.CheckConfig(Settings.XPStyleMenus);
                            base2.ShowImageMargin = false;
                            base2.Items.AddRange(new ToolStripItem[] { new ToolStripMenuItem(strArray[0]), new ToolStripMenuItem(strArray[1]), new ToolStripMenuItem(strArray[2]), new ToolStripMenuItem(strArray[3]), new ToolStripMenuItem(strArray[4]), new ToolStripMenuItem(strArray[6]) });
                            base2.ItemClicked += copyButton_DropDownItemClicked;
                            base2.Opening += copyButton_Opening;
                            ((ToolStripDropDownButton)item).DropDown = base2;
                            break;
                        }
                    case 10:
                        item = new ToolStripButton();
                        ((ToolStripButton)item).CheckOnClick = true;
                        break;

                    case 0x13: {
                            ToolStripTrackBar bar = new ToolStripTrackBar();
                            bar.Tag = num;
                            bar.ToolTipText = ButtonItemsDisplayName[0x13];
                            bar.ValueChanged += trackBar_ValueChanged;
                            toolStrip.Items.Add(bar);
                            goto Label_050D;
                        }
                    case 20:
                        searchBox = new ToolStripSearchBox(LargeButton, (ConfigValues[0] & 8) != 0, ButtonItemsDisplayName[0x12], SearchBoxWidth);
                        searchBox.ToolTipText = ButtonItemsDisplayName[20];
                        searchBox.Tag = num;
                        searchBox.ErasingText += searchBox_ErasingText;
                        searchBox.ResizeComplete += searchBox_ResizeComplete;
                        searchBox.TextChanged += searchBox_TextChanged;
                        searchBox.KeyPress += searchBox_KeyPress;
                        searchBox.GotFocus += searchBox_GotFocus;
                        toolStrip.Items.Add(searchBox);
                        timerSerachBox_Search = new Timer(components);
                        timerSerachBox_Search.Interval = 250;
                        timerSerachBox_Search.Tick += timerSerachBox_Search_Tick;
                        timerSearchBox_Rearrange = new Timer(components);
                        timerSearchBox_Rearrange.Interval = 300;
                        timerSearchBox_Rearrange.Tick += timerSearchBox_Rearrange_Tick;
                        goto Label_050D;

                    case 0x10000:
                        CreatePluginItem();
                        goto Label_050D;

                    default:
                        if(num >= 0x15) {
                            goto Label_050D;
                        }
                        item = new ToolStripButton();
                        break;
                }
                if(flag) {
                    if(flag2) {
                        if(Array.IndexOf(selectiveLablesIndices, num) != -1) {
                            item.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
                        }
                        else {
                            item.DisplayStyle = ToolStripItemDisplayStyle.Image;
                        }
                    }
                    else {
                        item.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
                    }
                }
                else {
                    item.DisplayStyle = ToolStripItemDisplayStyle.Image;
                }
                item.ImageScaling = ToolStripItemImageScaling.None;
                item.Text = item.ToolTipText = ButtonItemsDisplayName[num];
                item.Image = (LargeButton ? imageStrip_Large[num - 1] : imageStrip_Small[num - 1]).Clone(new Rectangle(Point.Empty, LargeButton ? sizeLargeButton : sizeSmallButton), PixelFormat.Format32bppArgb);
                item.Tag = num;
                toolStrip.Items.Add(item);
                if(((num == 1) && (Array.IndexOf(ButtonIndexes, 2) == -1)) || (num == 2)) {
                    toolStrip.Items.Add(CreateDropDownButton(-1));
                }
            Label_050D: ;
            }
            if(ButtonIndexes.Length == 0) {
                ToolStripSeparator separator2 = new ToolStripSeparator();
                separator2.Tag = 0;
                toolStrip.Items.Add(separator2);
            }
            toolStrip.ResumeLayout();
            toolStrip.RaiseOnResize();
            iPluginCreatingIndex = 0;
            if(pluginManager != null) {
                pluginManager.ClearBackgroundMultipleOrders();
            }
        }
示例#2
0
        internal void CreateItems()
        {
            string[] ButtonItemsDisplayName = QTUtility.TextResourcesDic["ButtonBar_BtnName"];
            ManageImageList();
            toolStrip.SuspendLayout();
            if(iSearchResultCount != -1) {
                Explorer.Refresh();
            }
            RefreshSearchBox(false);
            if(searchBox != null) {
                searchBox.Dispose();
                timerSerachBox_Search.Dispose();
                timerSearchBox_Rearrange.Dispose();
                searchBox = null;
                timerSerachBox_Search = null;
                timerSearchBox_Rearrange = null;
            }
            ClearToolStripItems();
            toolStrip.ShowItemToolTips = true;
            Height = Config.BBar.LargeButtons ? 34 : 26;
            bool showButtonLabels = Config.BBar.ShowButtonLabels;
            UnloadPluginsOnCreation();
            foreach(int index in Config.BBar.ButtonIndexes) {
                ToolStripItem item;
                switch(index) {
                    case BII_SEPARATOR:
                        toolStrip.Items.Add(new ToolStripSeparator {Tag = 0});
                        continue;

                    case BII_GROUP:
                    case BII_RECENTTAB:
                    case BII_APPLICATIONLAUNCHER:
                        item = CreateDropDownButton(index);
                        break;

                    case BII_MISCTOOL:
                        string[] strArray = QTUtility.TextResourcesDic["ButtonBar_Misc"];
                        DropDownMenuBase base2 = new DropDownMenuBase(components) {
                                ShowCheckMargin = !QTUtility.IsXP,
                                ShowImageMargin = false
                        };
                        base2.Items.AddRange(new ToolStripItem[] {
                                new ToolStripMenuItem(strArray[0]),
                                new ToolStripMenuItem(strArray[1]),
                                new ToolStripMenuItem(strArray[2]),
                                new ToolStripMenuItem(strArray[3]),
                                new ToolStripMenuItem(strArray[4]),
                                new ToolStripMenuItem(strArray[6])
                        });
                        base2.ItemClicked += copyButton_DropDownItemClicked;
                        base2.Opening += copyButton_Opening;
                        item = new ToolStripDropDownButton {DropDown = base2};
                        break;

                    case BII_TOPMOST:
                        item = new ToolStripButton {CheckOnClick = true};
                        break;

                    case BII_WINDOWOPACITY:
                        ToolStripTrackBar bar = new ToolStripTrackBar {
                            Tag = index,
                            ToolTipText = ButtonItemsDisplayName[19]
                        };
                        int crKey, dwFlg;
                        byte bAlpha;
                        if(PInvoke.GetLayeredWindowAttributes(ExplorerHandle, out crKey, out bAlpha, out dwFlg)) {
                            bar.SetValueWithoutEvent(bAlpha);
                        }
                        bar.ValueChanged += trackBar_ValueChanged;
                        toolStrip.Items.Add(bar);
                        continue;

                    case BII_FILTERBAR:
                        searchBox = new ToolStripSearchBox(
                                Config.BBar.LargeButtons,
                                Config.BBar.LockSearchBarWidth,
                                ButtonItemsDisplayName[0x12],
                                SearchBoxWidth) {
                            ToolTipText = ButtonItemsDisplayName[20],
                            Tag = index
                        };
                        searchBox.ErasingText += searchBox_ErasingText;
                        searchBox.ResizeComplete += searchBox_ResizeComplete;
                        searchBox.TextChanged += searchBox_TextChanged;
                        searchBox.KeyPress += searchBox_KeyPress;
                        searchBox.GotFocus += searchBox_GotFocus;
                        toolStrip.Items.Add(searchBox);
                        timerSerachBox_Search = new Timer(components) {Interval = 250};
                        timerSerachBox_Search.Tick += timerSerachBox_Search_Tick;
                        timerSearchBox_Rearrange = new Timer(components) {Interval = 300};
                        timerSearchBox_Rearrange.Tick += timerSearchBox_Rearrange_Tick;
                        continue;

                    default:
                        if(index >= INTERNAL_BUTTON_COUNT) {
                            if(index.HiWord() > 0) CreatePluginItem(index);
                            continue;
                        }
                        item = new ToolStripButton();
                        break;
                }
                item.DisplayStyle = showButtonLabels
                        ? ToolStripItemDisplayStyle.ImageAndText
                        : ToolStripItemDisplayStyle.Image;
                item.ImageScaling = ToolStripItemImageScaling.None;
                item.Text = item.ToolTipText = ButtonItemsDisplayName[index];
                item.Image = (Config.BBar.LargeButtons ? imageStrip_Large[index - 1] : imageStrip_Small[index - 1])
                        .Clone(new Rectangle(Point.Empty, Config.BBar.LargeButtons ? sizeLargeButton : sizeSmallButton), PixelFormat.Format32bppArgb);
                item.Tag = index;
                toolStrip.Items.Add(item);
                if((index == BII_NAVIGATION_BACK && Array.IndexOf(Config.BBar.ButtonIndexes, BII_NAVIGATION_FWRD) == -1) || index == BII_NAVIGATION_FWRD) {
                    toolStrip.Items.Add(CreateDropDownButton(BII_NAVIGATION_DROPDOWN));
                }
            }
            if(Config.BBar.ButtonIndexes.Length == 0) {
                toolStrip.Items.Add(new ToolStripSeparator {Tag = 0});
            }

            // todo: check
            QTTabBarClass tabBar = InstanceManager.GetThreadTabBar();
            if(tabBar != null) {
                tabBar.rebarController.RefreshHeight();
            }
            RefreshButtons();

            toolStrip.ResumeLayout();
            toolStrip.RaiseOnResize();
        }