private DragDropEffects dropTargetWrapper_DragFileEnter(IntPtr hDrop, Point pnt, int grfKeyState)
        {
            fRespondModKeysTemp = fRespondModKeys;
            fEnableShiftKeyTemp = fEnableShiftKey;
            fRespondModKeys     = false;
            fEnableShiftKey     = false;
            if (MenuDragEnter != null)
            {
                MenuDragEnter(this, EventArgs.Empty);
            }
            fDrivesContained = false;
            switch (QTTabBarClass.HandleDragEnter(hDrop, out strDraggingDrive, out strDraggingStartPath))
            {
            case -1:
                return(DragDropEffects.None);

            case 0:
                return(DropTargetWrapper.MakeEffect(grfKeyState, 0));

            case 1:
                return(DropTargetWrapper.MakeEffect(grfKeyState, 1));

            case 2:
                fDrivesContained = true;
                return(DragDropEffects.None);
            }
            return(DragDropEffects.None);
        }
Example #2
0
        public RebarController(QTTabBarClass tabbar, IntPtr hwndReBar, IOleCommandTarget bandObjectSite)
        {
            this.tabbar = tabbar;
            this.bandObjectSite = bandObjectSite;
            ExplorerHandle = PInvoke.GetAncestor(hwndReBar, 2);
            Handle = hwndReBar;
            rebarController = new NativeWindowController(hwndReBar);
            rebarController.MessageCaptured += RebarMessageCaptured;

            REBARBANDINFO structure = new REBARBANDINFO();
            structure.cbSize = Marshal.SizeOf(structure);
            structure.fMask = RBBIM.CHILD | RBBIM.ID;
            int num = (int)PInvoke.SendMessage(Handle, RB.GETBANDCOUNT, IntPtr.Zero, IntPtr.Zero);
            for(int i = 0; i < num; i++) {
                PInvoke.SendMessage(Handle, RB.GETBANDINFO, (IntPtr)i, ref structure);
                if(PInvoke.GetClassName(structure.hwndChild) == "ToolbarWindow32" && structure.wID == 1) {
                    menuController = new NativeWindowController(structure.hwndChild);
                    menuController.MessageCaptured += MenuMessageCaptured;
                    break;
                }
            }

            if(Config.Skin.UseRebarBGColor) {
                if(DefaultRebarCOLORREF == -1) {
                    DefaultRebarCOLORREF = (int)PInvoke.SendMessage(Handle, RB.GETBKCOLOR, IntPtr.Zero, IntPtr.Zero);
                }
                int num2 = QTUtility2.MakeCOLORREF(Config.Skin.RebarColor);
                PInvoke.SendMessage(Handle, RB.SETBKCOLOR, IntPtr.Zero, (IntPtr)num2);
            }

            EnsureMenuBarIsCorrect();
        }
        private DragDropEffects dropTargetWrapper_DragFileEnter(IntPtr hDrop, BandObjectLib.POINT pnt, int grfKeyState)
        {
            this.fRespondModKeysTemp = base.fRespondModKeys;
            this.fEnableShiftKeyTemp = base.fEnableShiftKey;
            base.fRespondModKeys     = false;
            base.fEnableShiftKey     = false;
            if (this.MenuDragEnter != null)
            {
                this.MenuDragEnter(this, EventArgs.Empty);
            }
            this.fDrivesContained = false;
            switch (QTTabBarClass.HandleDragEnter(hDrop, out this.strDraggingDrive, out this.strDraggingStartPath))
            {
            case -1:
                return(DragDropEffects.None);

            case 0:
                return(DropTargetWrapper.MakeEffect(grfKeyState, 0));

            case 1:
                return(DropTargetWrapper.MakeEffect(grfKeyState, 1));

            case 2:
                this.fDrivesContained = true;
                return(DragDropEffects.None);
            }
            return(DragDropEffects.None);
        }
            public PluginServer(QTTabBarClass tabBar)
            {
                BandObjectLib.Logging.Add_DEBUG("Constructor.log", "PluginServer");

                this.tabBar          = tabBar;
                shellBrowser         = (BandObjectLib.Interop.QTPluginLib.IShellBrowser) this.tabBar.ShellBrowser.GetIShellBrowser();
                dicLocalizingStrings = new Dictionary <string, string[]>();
                foreach (string file in Config.Lang.PluginLangFiles)
                {
                    if (file.Length <= 0 || !File.Exists(file))
                    {
                        continue;
                    }
                    var dict = QTUtility.ReadLanguageFile(file);
                    if (dict == null)
                    {
                        continue;
                    }
                    foreach (var pair in dict)
                    {
                        dicLocalizingStrings[pair.Key] = pair.Value;
                    }
                }
                LoadStartupPlugins();
            }
Example #5
0
        public static void GroupMenu_ItemRightClicked(object sender, ItemRightClickedEventArgs e)
        {
            DropDownMenuReorderable reorderable = (DropDownMenuReorderable)sender;
            string path = TrackGroupContextMenu(e.ClickedItem.Text, e.IsKey ? e.Point : Control.MousePosition, reorderable.Handle);

            if (!string.IsNullOrEmpty(path))
            {
                Action <QTTabBarClass> open = tabBar => {
                    using (IDLWrapper idlw = new IDLWrapper(path)) {
                        tabBar.OpenNewTabOrWindow(idlw);
                    }
                };
                QTTabBarClass threadBar = InstanceManager.GetThreadTabBar();
                if (threadBar != null)
                {
                    open(threadBar);
                }
                else
                {
                    InstanceManager.InvokeMain(open);
                }
            }
            else
            {
                e.HRESULT = 0xfffd;
            }
        }
Example #6
0
 protected override void OnKeyDown(KeyEventArgs e)
 {
     base.OnKeyDown(e);
     if (e.KeyData == (Keys.Control | Keys.C))
     {
         QTTabBarClass.SetStringClipboard(Text + Environment.NewLine + Environment.NewLine + labelMessage.Text);
     }
 }
Example #7
0
 public void PushInstance(IntPtr hwndExplr, QTTabBarClass tabBar)
 {
     try {
         this.rwLockTabBar.AcquireWriterLock(-1);
         this.sdInstancePair.Push(hwndExplr, new InstancePair(tabBar, tabBar.Handle));
     }
     finally {
         this.rwLockTabBar.ReleaseWriterLock();
     }
 }
Example #8
0
        public static void PushTabBarInstance(QTTabBarClass tabbar)
        {
            IntPtr handle = tabbar.Handle;

            using (new Keychain(rwLockTabBar, true)) {
                dictTabInstances[Thread.CurrentThread] = tabbar;
                sdTabHandles.Push(handle, tabbar);
            }
            ICommService service = GetChannel();

            if (service != null)
            {
                service.PushInstance(handle);
            }
        }
Example #9
0
        public bool RemoveInstance(IntPtr hwndExplr, QTTabBarClass tabBar)
        {
            bool flag2;

            try {
                this.rwLockTabBar.AcquireWriterLock(-1);
                bool flag = tabBar == this.CurrentTabBar;
                this.sdInstancePair.Remove(hwndExplr);
                flag2 = flag;
            }
            finally {
                this.rwLockTabBar.ReleaseWriterLock();
            }
            return(flag2);
        }
Example #10
0
 public PluginServer(QTTabBarClass tabBar)
 {
     this.tabBar = tabBar;
     shellBrowser = (QTPlugin.Interop.IShellBrowser)this.tabBar.ShellBrowser.GetIShellBrowser();
     dicLocalizingStrings = new Dictionary<string, string[]>();
     foreach(string file in Config.Lang.PluginLangFiles) {
         if(file.Length <= 0 || !File.Exists(file)) continue;
         var dict = QTUtility.ReadLanguageFile(file);
         if(dict == null) continue;
         foreach(var pair in dict) {
             dicLocalizingStrings[pair.Key] = pair.Value;
         }
     }
     LoadStartupPlugins();
 }
Example #11
0
 public void Dispose()
 {
     // todo check
     ClearEvents();
     foreach (Plugin plugin in dicPluginInstances.Values)
     {
         if (plugin.PluginInformation != null)
         {
             plugin.Close(EndCode.WindowClosed);
         }
     }
     FilterPlugin     = null;
     FilterCorePlugin = null;
     dicPluginInstances.Clear();
     tabBar       = null;
     shellBrowser = null;
 }
        public RebarController(QTTabBarClass tabbar, IntPtr hwndReBar, IOleCommandTarget bandObjectSite) {
            this.tabbar = tabbar;
            this.bandObjectSite = bandObjectSite;
            ExplorerHandle = PInvoke.GetAncestor(hwndReBar, 2);
            Handle = hwndReBar;
            rebarController = new NativeWindowController(hwndReBar);
            rebarController.MessageCaptured += MessageCaptured;

            if(QTUtility.CheckConfig(Settings.ToolbarBGColor)) {
                if(QTUtility.DefaultRebarCOLORREF == -1) {
                    QTUtility.DefaultRebarCOLORREF = (int)PInvoke.SendMessage(Handle, RB.GETBKCOLOR, IntPtr.Zero, IntPtr.Zero);
                }
                int num2 = QTUtility2.MakeCOLORREF(QTUtility.RebarBGColor);
                PInvoke.SendMessage(Handle, RB.SETBKCOLOR, IntPtr.Zero, (IntPtr)num2);
            }

            EnsureMenuBarIsCorrect();
        }
Example #13
0
        public RebarController(QTTabBarClass tabbar, IntPtr hwndReBar, IOleCommandTarget bandObjectSite)
        {
            this.tabbar         = tabbar;
            this.bandObjectSite = bandObjectSite;
            ExplorerHandle      = PInvoke.GetAncestor(hwndReBar, 2);
            Handle          = hwndReBar;
            rebarController = new NativeWindowController(hwndReBar);
            rebarController.MessageCaptured += MessageCaptured;

            if (QTUtility.CheckConfig(Settings.ToolbarBGColor))
            {
                if (QTUtility.DefaultRebarCOLORREF == -1)
                {
                    QTUtility.DefaultRebarCOLORREF = (int)PInvoke.SendMessage(Handle, RB.GETBKCOLOR, IntPtr.Zero, IntPtr.Zero);
                }
                int num2 = QTUtility2.MakeCOLORREF(QTUtility.RebarBGColor);
                PInvoke.SendMessage(Handle, RB.SETBKCOLOR, IntPtr.Zero, (IntPtr)num2);
            }

            EnsureMenuBarIsCorrect();
        }
Example #14
0
        private static void virtualDirectory_ReorderFinished(object sender, ToolStripItemClickedEventArgs e)
        {
            DropDownMenuReorderable reorderable = (DropDownMenuReorderable)sender;

            using (RegistryKey key = Registry.CurrentUser.CreateSubKey(reorderable.Name)) {
                if (key != null)
                {
                    foreach (string str in key.GetValueNames())
                    {
                        key.DeleteValue(str, false);
                    }
                    int      num   = 1;
                    string[] array = new string[] { "separator", string.Empty, string.Empty };
                    foreach (ToolStripItem item in reorderable.Items)
                    {
                        if (item is ToolStripSeparator)
                        {
                            QTUtility2.WriteRegBinary <string>(array, "Separator" + num++, key);
                        }
                        else
                        {
                            QMenuItem item2 = item as QMenuItem;
                            if (item2 != null)
                            {
                                MenuItemArguments menuItemArguments = item2.MenuItemArguments;
                                if (menuItemArguments.Target == MenuTarget.VirtualFolder)
                                {
                                    key.SetValue(item.Name, new byte[0]);
                                    continue;
                                }
                                string[] strArray2 = new string[] { menuItemArguments.Path, menuItemArguments.OriginalArgument, menuItemArguments.OriginalWorkingDirectory, menuItemArguments.KeyShortcut.ToString() };
                                QTUtility2.WriteRegBinary <string>(strArray2, item.Name, key);
                            }
                        }
                    }
                    QTUtility.fRequiredRefresh_App = true;
                    QTTabBarClass.SyncTaskBarMenu();
                }
            }
        }
Example #15
0
        public RebarController(QTTabBarClass tabbar, IntPtr hwndReBar, IOleCommandTarget bandObjectSite)
        {
            BandObjectLib.Logging.Add_DEBUG("Constructor.log", "RebarController");
            this.tabbar         = tabbar;
            this.bandObjectSite = bandObjectSite;
            ExplorerHandle      = PInvoke.GetAncestor(hwndReBar, 2);
            Handle          = hwndReBar;
            rebarController = new NativeWindowController(hwndReBar);
            rebarController.MessageCaptured += RebarMessageCaptured;

            REBARBANDINFO structure = new REBARBANDINFO();

            structure.cbSize = Marshal.SizeOf(structure);
            structure.fMask  = RBBIM.CHILD | RBBIM.ID;
            int num = (int)PInvoke.SendMessage(Handle, RB.GETBANDCOUNT, IntPtr.Zero, IntPtr.Zero);

            for (int i = 0; i < num; i++)
            {
                PInvoke.SendMessage(Handle, RB.GETBANDINFO, (IntPtr)i, ref structure);
                if (PInvoke.GetClassName(structure.hwndChild) == "ToolbarWindow32" && structure.wID == 1)
                {
                    menuController = new NativeWindowController(structure.hwndChild);
                    menuController.MessageCaptured += MenuMessageCaptured;
                    break;
                }
            }

            if (Config.Skin.UseRebarBGColor)
            {
                if (DefaultRebarCOLORREF == -1)
                {
                    DefaultRebarCOLORREF = (int)PInvoke.SendMessage(Handle, RB.GETBKCOLOR, IntPtr.Zero, IntPtr.Zero);
                }
                int num2 = QTUtility2.MakeCOLORREF(Config.Skin.RebarColor);
                PInvoke.SendMessage(Handle, RB.SETBKCOLOR, IntPtr.Zero, (IntPtr)num2);
            }

            EnsureMenuBarIsCorrect();
        }
Example #16
0
 public PluginManager(QTTabBarClass tabBar)
 {
     this.pluginServer = new QTTabBarClass.PluginServer(tabBar, this);
     this.LoadStartupPlugins();
     this.iRefCount++;
 }
Example #17
0
        /// <summary>
        /// Displays shell shortcut menu.
        /// </summary>
        /// <param name="idlw">IDLWrapper object that specifies shell item</param>
        /// <param name="pntShow">location of the shortcut menu, in screen coordinates.</param>
        /// <param name="hwndParent">Handle of parent control. Parent control will get focus, and receives the messages about drawing 'Send to' submenues.</param>
        /// <param name="fCanRemove">set true to add 'remove this' menu item.</param>
        /// <returns>
        /// 0xFFFF	user selected "Remove this item from menu".
        /// 0xFFFE	user selected "Open containing folder".
        /// 0xFFFD	If the user cancels the menu without making a selection, or if an error occurs
        /// </returns>
        public int Open(IDLWrapper idlw, Point pntShow, IntPtr hwndParent, bool fCanRemove)
        {
            const uint   MF_STRING         = 0x00000000;
            const uint   MF_SEPARATOR      = 0x00000800;
            const uint   CMF_NORMAL        = 0x00000000;
            const uint   CMF_EXTENDEDVERBS = 0x00000100;
            const uint   TPM_RETURNCMD     = 0x0100;
            const uint   S_OK = 0;
            const int    COMMANDID_REMOVEITEM = 0xffff; // todo: move to const class
            const int    COMMANDID_OPENPARENT = 0xfffe;
            const int    COMMANDID_USERCANCEL = 0xfffd;
            IShellFolder shellFolderParent    = null;

            try {
                // get IShellFolder
                IntPtr pIDLRelative;
                if (idlw.Available && S_OK == PInvoke.SHBindToParent(idlw.PIDL, ExplorerGUIDs.IID_IShellFolder, out shellFolderParent, out pIDLRelative) && shellFolderParent != null)
                {
                    // get IContextMenu2
                    IntPtr[] pIDLs    = new IntPtr[] { pIDLRelative };
                    uint     reserved = 0;
                    object   oUnk;

                    if (S_OK == shellFolderParent.GetUIObjectOf(IntPtr.Zero, (uint)pIDLs.Length, pIDLs, ExplorerGUIDs.IID_IContextMenu, ref reserved, out oUnk))
                    {
                        pIContextMenu2 = oUnk as IContextMenu2;
                        if (pIContextMenu2 != null)
                        {
                            using (ContextMenu contextMenu = new ContextMenu()) {
                                int  nResult = -1;
                                uint uFlags  = CMF_NORMAL;
                                if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
                                {
                                    uFlags |= CMF_EXTENDEDVERBS;
                                }

                                pIContextMenu2.QueryContextMenu(contextMenu.Handle, 0, 1, 0xffff, uFlags);

                                // append optional menus
                                if (fCanRemove)
                                {
                                    // "Remove this item from menu"
                                    PInvoke.AppendMenu(contextMenu.Handle, MF_SEPARATOR, IntPtr.Zero, null);
                                    PInvoke.AppendMenu(contextMenu.Handle, MF_STRING, new IntPtr(COMMANDID_REMOVEITEM), QTUtility.ResMain[25]);
                                }
                                if (idlw.HasPath && idlw.Path.Length > 3 && idlw.IsFileSystem /*&& ( idlw.IsFileSystemFolder || idlw.IsFileSystemFile )*/)
                                {
                                    // "Open containing folder"
                                    if (!fCanRemove)
                                    {
                                        // separator
                                        PInvoke.AppendMenu(contextMenu.Handle, MF_SEPARATOR, IntPtr.Zero, null);
                                    }
                                    PInvoke.AppendMenu(contextMenu.Handle, MF_STRING, new IntPtr(COMMANDID_OPENPARENT), QTUtility.ResMain[26]);
                                }

                                uint commandID = PInvoke.TrackPopupMenu(contextMenu.Handle, TPM_RETURNCMD, pntShow.X, pntShow.Y, 0, hwndParent, IntPtr.Zero);
                                if (commandID != 0)
                                {
                                    if (commandID == COMMANDID_REMOVEITEM)
                                    {
                                        return(COMMANDID_REMOVEITEM);
                                    }
                                    else if (commandID == COMMANDID_OPENPARENT)
                                    {
                                        if (idlw.HasPath)
                                        {
                                            try {
                                                QTTabBarClass tabbar = InstanceManager.GetThreadTabBar();
                                                if (tabbar != null)
                                                {
                                                    using (IDLWrapper idlwParent = idlw.GetParent()) {
                                                        if (idlwParent.Available)
                                                        {
                                                            tabbar.OpenNewTabOrWindow(idlwParent);
                                                        }
                                                    }
                                                }
                                                // DesktopTool will handle it by itself
                                                nResult = COMMANDID_OPENPARENT;
                                            }
                                            catch {
                                                System.Media.SystemSounds.Asterisk.Play();
                                            }
                                        }
                                    }
                                    else
                                    {
                                        CMINVOKECOMMANDINFO cmInfo = new CMINVOKECOMMANDINFO {
                                            cbSize       = Marshal.SizeOf(typeof(CMINVOKECOMMANDINFO)),
                                            fMask        = 0,
                                            hwnd         = hwndParent,
                                            lpVerb       = (IntPtr)((commandID - 1) & 0xFFFF),
                                            lpParameters = IntPtr.Zero,
                                            lpDirectory  = IntPtr.Zero,
                                            nShow        = 1, //SW_SHOWNORMAL;
                                            dwHotKey     = 0,
                                            hIcon        = IntPtr.Zero
                                        };

                                        // returns S_OK if successful, or an error value otherwise.
                                        // E_ABORT when user clicked "Open folder link target exists" of link file...( E_ABORT  _HRESULT_TYPEDEF_(0x80004004L) )
                                        nResult = pIContextMenu2.InvokeCommand(ref cmInfo);
                                    }
                                }
                                else
                                {
                                    // 'if the user cancels the menu without making a selection, or if an error occurs' (MSDN)
                                    nResult = COMMANDID_USERCANCEL;
                                }

                                return(nResult);
                            }
                        }
                    }
                }

                // if failed to create shell context menu, show 'remove this' menu instead
                if (fCanRemove)
                {
                    using (ContextMenu contextMenu = new ContextMenu()) {
                        PInvoke.AppendMenu(contextMenu.Handle, MF_STRING, new IntPtr(COMMANDID_REMOVEITEM), QTUtility.ResMain[25]);

                        if (COMMANDID_REMOVEITEM == PInvoke.TrackPopupMenu(contextMenu.Handle, TPM_RETURNCMD, pntShow.X, pntShow.Y, 0, hwndParent, IntPtr.Zero))
                        {
                            return(COMMANDID_REMOVEITEM);
                        }
                    }
                }

                return(COMMANDID_USERCANCEL);
            }
            catch {
            }
            finally {
                if (shellFolderParent != null)
                {
                    Marshal.ReleaseComObject(shellFolderParent);
                }

                if (pIContextMenu2 != null)
                {
                    Marshal.ReleaseComObject(pIContextMenu2);
                    pIContextMenu2 = null;
                }
            }
            return(-1);
        }
        private void CopyFileNames(bool fPath)
        {
            List <string>          lstPaths = new List <string>();
            DropDownMenuDropTarget root     = GetRoot(this);

            if (root != null)
            {
                GetCheckedItem(root, lstPaths, false, true);
            }
            if (lstPaths.Count == 0)
            {
                foreach (ToolStripItem item in this.DisplayedItems)
                {
                    if (!item.Selected)
                    {
                        continue;
                    }
                    QMenuItem item2 = item as QMenuItem;
                    if ((item2 != null) && !string.IsNullOrEmpty(item2.Path))
                    {
                        string path = item2.Path;
                        if (!fPath)
                        {
                            try {
                                path = System.IO.Path.GetFileName(path);
                            }
                            catch {
                            }
                        }
                        if (!string.IsNullOrEmpty(path))
                        {
                            QTTabBarClass.SetStringClipboard(path);
                            fContainsFileDropList         = false;
                            this.itemKeyInsertionMarkPrev = null;
                            base.Invalidate();
                        }
                    }
                    break;
                }
            }
            else
            {
                string str = string.Empty;
                foreach (string str3 in lstPaths)
                {
                    if (fPath)
                    {
                        str = str + str3 + Environment.NewLine;
                    }
                    else
                    {
                        try {
                            str = str + System.IO.Path.GetFileName(str3) + Environment.NewLine;
                            continue;
                        }
                        catch {
                            continue;
                        }
                    }
                }
                if (str.Length > 0)
                {
                    QTTabBarClass.SetStringClipboard(str);
                    fContainsFileDropList         = false;
                    this.itemKeyInsertionMarkPrev = null;
                    base.Invalidate();
                }
            }
        }
Example #19
0
 public void Dispose() {
     this.tabBar = null;
     this.pluginManager = null;
     this.shellBrowser = null;
 }
Example #20
0
 public TabWrapper(QTabItem tab, QTTabBarClass tabBar) {
     this.tab = tab;
     this.tabBar = tabBar;
     this.tab.Closed += new EventHandler(this.tab_Closed);
 }
Example #21
0
 private void tab_Closed(object sender, EventArgs e) {
     this.tab.Closed -= new EventHandler(this.tab_Closed);
     this.tab = null;
     this.tabBar = null;
 }
Example #22
0
 public PluginServer(QTTabBarClass tabBar, PluginManager manager) {
     this.tabBar = tabBar;
     shellBrowser = (QTPlugin.Interop.IShellBrowser)this.tabBar.ShellBrowser.GetIShellBrowser();
     pluginManager = manager;
     if((QTUtility.Path_PluginLangFile.Length > 0) && File.Exists(QTUtility.Path_PluginLangFile)) {
         dicLocalizingStrings = QTUtility.ReadLanguageFile(QTUtility.Path_PluginLangFile);
     }
     if(dicLocalizingStrings == null) {
         dicLocalizingStrings = new Dictionary<string, string[]>();
     }
 }
Example #23
0
 public void Dispose() {
     tabBar = null;
     pluginManager = null;
     shellBrowser = null;
 }
Example #24
0
 private void tab_Closed(object sender, EventArgs e)
 {
     tab.Closed -= tab_Closed;
     tab         = null;
     tabBar      = null;
 }
Example #25
0
 public TabWrapper(QTabItem tab, QTTabBarClass tabBar)
 {
     this.tab         = tab;
     this.tabBar      = tabBar;
     this.tab.Closed += tab_Closed;
 }
Example #26
0
 public void Dispose()
 {
     // todo check
     ClearEvents();
     foreach(Plugin plugin in dicPluginInstances.Values) {
         if(plugin.PluginInformation != null) {
             plugin.Close(EndCode.WindowClosed);
         }
     }
     FilterPlugin = null;
     FilterCorePlugin = null;
     dicPluginInstances.Clear();
     tabBar = null;
     shellBrowser = null;
 }
Example #27
0
 private void tab_Closed(object sender, EventArgs e)
 {
     tab.Closed -= tab_Closed;
     tab = null;
     tabBar = null;
 }
Example #28
0
 public TabWrapper(QTabItem tab, QTTabBarClass tabBar)
 {
     this.tab = tab;
     this.tabBar = tabBar;
     this.tab.Closed += tab_Closed;
 }