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 int DragOver(int grfKeyState, BandObjectLib.POINT pt, ref DragDropEffects pdwEffect) { this.iLastKeyState = grfKeyState; if (this.DragFileOver != null) { DragEventArgs e = new DragEventArgs(null, grfKeyState, pt.x, pt.y, DragDropEffects.Move | DragDropEffects.Copy | DragDropEffects.Scroll, DragDropEffects.None); this.DragFileOver(null, e); pdwEffect = e.Effect; } else { pdwEffect = DragDropEffects.Copy; } return(0); }
public int DragDrop(System.Runtime.InteropServices.ComTypes.IDataObject pDataObj, int grfKeyState, BandObjectLib.POINT pt, ref DragDropEffects pdwEffect) { try { if (this.DragFileOver != null) { DragEventArgs e = new DragEventArgs(null, grfKeyState, pt.x, pt.y, DragDropEffects.Move | DragDropEffects.Copy | DragDropEffects.Scroll, pdwEffect); this.DragFileOver(null, e); pdwEffect = e.Effect; } else { pdwEffect = DragDropEffects.Copy; } if (pdwEffect != DragDropEffects.None) { if (this.DragFileDrop != null) { IntPtr ptr; byte[] buffer; switch (this.DragFileDrop(out ptr, out buffer)) { case -1: return(0); case 0: { IShellFolder ppv = null; object obj2 = null; Guid riid = ExplorerGUIDs.IID_IShellFolder; Guid guid2 = ExplorerGUIDs.IID_IDropTarget; using (IDLWrapper wrapper = new IDLWrapper(buffer)) { if (wrapper.Available && wrapper.IsDropTarget) { try { IntPtr ptr2; if (PInvoke.SHBindToParent(wrapper.PIDL, riid, out ppv, out ptr2) == 0) { uint rgfReserved = 0; IntPtr[] apidl = new IntPtr[] { ptr2 }; if (ppv.GetUIObjectOf(ptr, 1, apidl, ref guid2, ref rgfReserved, out obj2) == 0) { _IDropTarget target = obj2 as _IDropTarget; if (target != null) { DragDropEffects effects = pdwEffect; if (target.DragEnter(pDataObj, this.iLastKeyState, pt, ref effects) == 0) { effects = pdwEffect; if (target.DragOver(this.iLastKeyState, pt, ref effects) == 0) { if ((this.iLastKeyState & 2) != 0) { pdwEffect = DragDropEffects.Link | DragDropEffects.Move | DragDropEffects.Copy; } return(target.DragDrop(pDataObj, this.iLastKeyState, pt, ref pdwEffect)); } } } } } } catch { } finally { if (ppv != null) { Marshal.ReleaseComObject(ppv); } if (obj2 != null) { Marshal.ReleaseComObject(obj2); } if (this.DragDropEnd != null) { this.DragDropEnd(this, EventArgs.Empty); } } } } return(0); } } } FORMATETC format = new FORMATETC(); format.cfFormat = 15; format.ptd = IntPtr.Zero; format.dwAspect = DVASPECT.DVASPECT_CONTENT; format.lindex = -1; format.tymed = TYMED.TYMED_HGLOBAL; STGMEDIUM medium = new STGMEDIUM(); try { pDataObj.GetData(ref format, out medium); PInvoke.SendMessage(this.hwnd, 0x233, medium.unionmember, IntPtr.Zero); } catch { } finally { PInvoke.ReleaseStgMedium(ref medium); } } } finally { if (pDataObj != null) { Marshal.FinalReleaseComObject(pDataObj); } } return(0); }
public int DragEnter(System.Runtime.InteropServices.ComTypes.IDataObject pDataObj, int grfKeyState, BandObjectLib.POINT pt, ref DragDropEffects pdwEffect) { try { if (this.DragFileEnter != null) { FORMATETC format = new FORMATETC(); format.cfFormat = 15; format.ptd = IntPtr.Zero; format.dwAspect = DVASPECT.DVASPECT_CONTENT; format.lindex = -1; format.tymed = TYMED.TYMED_HGLOBAL; if (pDataObj.QueryGetData(ref format) >= 0) { STGMEDIUM medium = new STGMEDIUM(); try { try { pDataObj.GetData(ref format, out medium); pdwEffect = this.DragFileEnter(medium.unionmember, pt, grfKeyState); } catch { pdwEffect = DragDropEffects.None; } goto Label_00A0; } finally { PInvoke.ReleaseStgMedium(ref medium); } } pdwEffect = DragDropEffects.None; } else { pdwEffect = DragDropEffects.Copy; } } finally { if (pDataObj != null) { Marshal.FinalReleaseComObject(pDataObj); } } Label_00A0: return(0); }
private bool travelBtnController_MessageCaptured(ref System.Windows.Forms.Message m) { if(this.CurrentTab == null) { return false; } switch(m.Msg) { case WM.LBUTTONDOWN: case WM.LBUTTONUP: { BandObjectLib.POINT structure = new BandObjectLib.POINT(); structure.x = QTUtility2.GET_X_LPARAM(m.LParam); structure.y = QTUtility2.GET_Y_LPARAM(m.LParam); IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(structure)); Marshal.StructureToPtr(structure, ptr, false); int num = (int)PInvoke.SendMessage(this.travelBtnController.Handle, 0x445, IntPtr.Zero, ptr); Marshal.FreeHGlobal(ptr); bool flag = this.CurrentTab.HistoryCount_Back > 1; bool flag2 = this.CurrentTab.HistoryCount_Forward > 0; if(m.Msg != 0x202) { PInvoke.SetCapture(this.travelBtnController.Handle); if(((flag && (num == 0)) || (flag2 && (num == 1))) || ((flag || flag2) && (num == 2))) { int num5 = (int)PInvoke.SendMessage(this.travelBtnController.Handle, 0x412, (IntPtr)(0x100 + num), IntPtr.Zero); int num6 = num5 | 2; PInvoke.SendMessage(this.travelBtnController.Handle, 0x411, (IntPtr)(0x100 + num), (IntPtr)num6); } if((num == 2) && (flag || flag2)) { RECT rect; IntPtr hWnd = PInvoke.SendMessage(this.travelBtnController.Handle, 0x423, IntPtr.Zero, IntPtr.Zero); if(hWnd != IntPtr.Zero) { PInvoke.SendMessage(hWnd, 0x41c, IntPtr.Zero, IntPtr.Zero); } PInvoke.GetWindowRect(this.travelBtnController.Handle, out rect); this.NavigationButtons_DropDownOpening(this.buttonNavHistoryMenu, new EventArgs()); this.buttonNavHistoryMenu.DropDown.Show(new Point(rect.left - 2, rect.bottom + 1)); } break; } PInvoke.ReleaseCapture(); for(int i = 0; i < 3; i++) { int num3 = (int)PInvoke.SendMessage(this.travelBtnController.Handle, 0x412, (IntPtr)(0x100 + i), IntPtr.Zero); int num4 = num3 & -3; PInvoke.SendMessage(this.travelBtnController.Handle, 0x411, (IntPtr)(0x100 + i), (IntPtr)num4); } if((num == 0) && flag) { this.NavigateCurrentTab(true); } else if((num == 1) && flag2) { this.NavigateCurrentTab(false); } break; } case WM.LBUTTONDBLCLK: m.Result = IntPtr.Zero; return true; case WM.USER+1: if(((((int)((long)m.LParam)) >> 0x10) & 0xffff) == 1) { goto Label_0427; } m.Result = (IntPtr)1; return true; case WM.MOUSEACTIVATE: if(this.buttonNavHistoryMenu.DropDown.Visible) { m.Result = (IntPtr)4; this.buttonNavHistoryMenu.DropDown.Close(ToolStripDropDownCloseReason.AppClicked); return true; } goto Label_0427; case WM.NOTIFY: { NMHDR nmhdr = (NMHDR)Marshal.PtrToStructure(m.LParam, typeof(NMHDR)); if(nmhdr.code != -530) { goto Label_0427; } NMTTDISPINFO nmttdispinfo = (NMTTDISPINFO)Marshal.PtrToStructure(m.LParam, typeof(NMTTDISPINFO)); string str = string.Empty; if(nmttdispinfo.hdr.idFrom == ((IntPtr)0x100)) { str = this.MakeTravelBtnTooltipText(true); if(str.Length > 0x4f) { str = "Back"; } } else if(nmttdispinfo.hdr.idFrom == ((IntPtr)0x101)) { str = this.MakeTravelBtnTooltipText(false); if(str.Length > 0x4f) { str = "Forward"; } } else { return false; } nmttdispinfo.szText = str; Marshal.StructureToPtr(nmttdispinfo, m.LParam, false); m.Result = IntPtr.Zero; return true; } default: goto Label_0427; } m.Result = IntPtr.Zero; return true; Label_0427: return false; }
private void tabControl1_MouseUp(object sender, MouseEventArgs e) { if(this.NowTabDragging && (e.Button == MouseButtons.Left)) { QTabItem tabMouseOn = (QTabItem)this.tabControl1.GetTabMouseOn(); Keys modifierKeys = Control.ModifierKeys; if(((tabMouseOn == null) && (this.DraggingTab != null)) && ((modifierKeys == Keys.Control) || (modifierKeys == (Keys.Control | Keys.Shift)))) { bool flag = false; BandObjectLib.POINT pt = new BandObjectLib.POINT(this.tabControl1.PointToScreen(e.Location)); if(QTUtility.IsVista) { RECT rect; PInvoke.GetWindowRect(base.ReBarHandle, out rect); flag = PInvoke.PtInRect(ref rect, pt); } else { RECT rect2; IntPtr ptr; if(QTUtility.instanceManager.TryGetButtonBarHandle(this.ExplorerHandle, out ptr) && PInvoke.IsWindowVisible(ptr)) { PInvoke.GetWindowRect(ptr, out rect2); if(PInvoke.PtInRect(ref rect2, pt)) { flag = true; } } PInvoke.GetWindowRect(base.Handle, out rect2); if(PInvoke.PtInRect(ref rect2, pt)) { flag = true; } } if(flag) { this.CloneTabButton(this.DraggingTab, null, false, this.tabControl1.TabCount); } } else if(((tabMouseOn != null) && (tabMouseOn == this.DraggingTab)) && ((modifierKeys == Keys.Control) && (this.DraggingDestRect == Rectangle.Empty))) { this.DraggingTab.TabLocked = !this.DraggingTab.TabLocked; } this.NowTabDragging = false; this.DraggingTab = null; this.DraggingDestRect = Rectangle.Empty; this.SyncButtonBarCurrent(12); } else if((e.Button == MouseButtons.Middle) && !base.Explorer.Busy) { this.DraggingTab = null; this.NowTabDragging = false; QTabItem clickedTab = (QTabItem)this.tabControl1.GetTabMouseOn(); if((clickedTab != null) && ((Control.ModifierKeys & Keys.Control) != Keys.Control)) { this.HandleTabClickAction(clickedTab, true); } } this.Cursor = Cursors.Default; }
public static extern bool PtInRect(ref QTTabBarLib.Interop.RECT lprc, BandObjectLib.POINT pt);