Exemplo n.º 1
0
 private bool HandleClick(Point pt, Keys modifierKeys, bool middle)
 {
     IShellItem item = null;
     try {
         TVHITTESTINFO structure = new TVHITTESTINFO { pt = pt };
         IntPtr wParam = PInvoke.SendMessage(treeController.Handle, 0x1111, IntPtr.Zero, ref structure);
         if(wParam != IntPtr.Zero) {
             if((structure.flags & 0x10) == 0 && (structure.flags & 0x80) == 0) {
                 treeControl.HitTest(pt, out item);
                 if(item != null) {
                     IntPtr pidl;
                     if(PInvoke.SHGetIDListFromObject(item, out pidl) == 0) {
                         using(IDLWrapper wrapper = new IDLWrapper(pidl)) {
                             return TreeViewClicked(wrapper, modifierKeys, middle);
                         }
                     }
                 }
             }
         }
     }
     finally {
         if(item != null) {
             Marshal.ReleaseComObject(item);
         }
     }
     return false;
 }
Exemplo n.º 2
0
 private void HandleClick(Point pt) {
     IShellItem item = null;
     IntPtr ptr = IntPtr.Zero;
     try {
         TVHITTESTINFO structure = new TVHITTESTINFO { pt = pt };
         ptr = Marshal.AllocHGlobal(Marshal.SizeOf(structure));
         Marshal.StructureToPtr(structure, ptr, false);
         IntPtr wParam = PInvoke.SendMessage(treeController.Handle, 0x1111, IntPtr.Zero, ptr);
         if(wParam != IntPtr.Zero) {
             structure = (TVHITTESTINFO)Marshal.PtrToStructure(ptr, typeof(TVHITTESTINFO));
             if((structure.flags & 0x10) == 0 && (structure.flags & 0x80) == 0) {
                 treeControl.HitTest(pt, out item);
                 if(item != null) {
                     TreeViewMiddleClicked(item);
                 }
             }
         }
     }
     finally {
         if(item != null) {
             Marshal.ReleaseComObject(item);
         }
         if(ptr != IntPtr.Zero) {
             Marshal.FreeHGlobal(ptr);
         }
     }
 }
Exemplo n.º 3
0
 // TODO
 private void HandleLBUTTON_Tree(MSG msg, bool fMouseDown) {
     IntPtr ptr;
     if(ShellBrowser.IsFolderTreeVisible(out ptr) && msg.hwnd == ptr) {
         TVHITTESTINFO structure = new TVHITTESTINFO();
         structure.pt = QTUtility2.PointFromLPARAM(msg.lParam);
         IntPtr ptr2 = Marshal.AllocHGlobal(Marshal.SizeOf(structure));
         Marshal.StructureToPtr(structure, ptr2, false);
         IntPtr wParam = PInvoke.SendMessage(ptr, 0x1111, IntPtr.Zero, ptr2);
         if(wParam != IntPtr.Zero) {
             structure = (TVHITTESTINFO)Marshal.PtrToStructure(ptr2, typeof(TVHITTESTINFO));
             bool flag;
             if(fMouseDown) {
                 flag = (((structure.flags != 1) && (structure.flags != 0x10)) && ((structure.flags & 2) == 0)) && ((structure.flags & 4) == 0);
             }
             else {
                 flag = ((structure.flags & 2) != 0) || ((structure.flags & 4) != 0);
             }
             if(flag) {
                 int num = (int)PInvoke.SendMessage(ptr, 0x1127, wParam, (IntPtr)2);
                 if((num & 2) == 0) {
                     NavigatedByCode = fNowTravelByTree = true;
                 }
             }
         }
         Marshal.FreeHGlobal(ptr2);
     }
 }        
Exemplo n.º 4
0
 // TODO
 private void Handle_MButtonUp_Tree(MSG msg) {
     IntPtr ptr;
     if(ShellBrowser.IsFolderTreeVisible(out ptr) && msg.hwnd == ptr) {
         TVHITTESTINFO structure = new TVHITTESTINFO();
         structure.pt = QTUtility2.PointFromLPARAM(msg.lParam);
         IntPtr ptr2 = Marshal.AllocHGlobal(Marshal.SizeOf(structure));
         Marshal.StructureToPtr(structure, ptr2, false);
         IntPtr wParam = PInvoke.SendMessage(ptr, 0x1111, IntPtr.Zero, ptr2);
         if(wParam != IntPtr.Zero) {
             int num = (int)PInvoke.SendMessage(ptr, 0x1127, wParam, (IntPtr)2);
             if((num & 2) == 0) {
                 NavigatedByCode = fNowTravelByTree = true;
                 PInvoke.SendMessage(ptr, 0x110b, (IntPtr)9, wParam);
             }
         }
     }
 }
Exemplo n.º 5
0
 private void HandleLBUTTON_Tree(BandObjectLib.MSG msg, bool fMouseDown) {
     IntPtr ptr;
     if((this.ShellBrowser.GetControlWindow(3, out ptr) == 0) && (msg.hwnd == ptr)) {
         BandObjectLib.POINT point;
         TVHITTESTINFO structure = new TVHITTESTINFO();
         point.x = QTUtility2.GET_X_LPARAM(msg.lParam);
         point.y = QTUtility2.GET_Y_LPARAM(msg.lParam);
         structure.pt = point;
         IntPtr ptr2 = Marshal.AllocHGlobal(Marshal.SizeOf(structure));
         Marshal.StructureToPtr(structure, ptr2, false);
         IntPtr wParam = PInvoke.SendMessage(ptr, 0x1111, IntPtr.Zero, ptr2);
         if(wParam != IntPtr.Zero) {
             structure = (TVHITTESTINFO)Marshal.PtrToStructure(ptr2, typeof(TVHITTESTINFO));
             bool flag = false;
             if(fMouseDown) {
                 flag = (((structure.flags != 1) && (structure.flags != 0x10)) && ((structure.flags & 2) == 0)) && ((structure.flags & 4) == 0);
             }
             else {
                 flag = ((structure.flags & 2) != 0) || ((structure.flags & 4) != 0);
             }
             if(flag) {
                 int num = (int)PInvoke.SendMessage(ptr, 0x1127, wParam, (IntPtr)2);
                 if((num & 2) == 0) {
                     this.NavigatedByCode = this.fNowTravelByTree = true;
                 }
             }
         }
         Marshal.FreeHGlobal(ptr2);
     }
 }        
Exemplo n.º 6
0
 private void Handle_MButtonUp_Tree(BandObjectLib.MSG msg) {
     IntPtr ptr;
     if((this.ShellBrowser.GetControlWindow(3, out ptr) == 0) && (msg.hwnd == ptr)) {
         BandObjectLib.POINT point;
         TVHITTESTINFO structure = new TVHITTESTINFO();
         point.x = QTUtility2.GET_X_LPARAM(msg.lParam);
         point.y = QTUtility2.GET_Y_LPARAM(msg.lParam);
         structure.pt = point;
         IntPtr ptr2 = Marshal.AllocHGlobal(Marshal.SizeOf(structure));
         Marshal.StructureToPtr(structure, ptr2, false);
         IntPtr wParam = PInvoke.SendMessage(ptr, 0x1111, IntPtr.Zero, ptr2);
         if(wParam != IntPtr.Zero) {
             int num = (int)PInvoke.SendMessage(ptr, 0x1127, wParam, (IntPtr)2);
             if((num & 2) == 0) {
                 this.NavigatedByCode = this.fNowTravelByTree = true;
                 PInvoke.SendMessage(ptr, 0x110b, (IntPtr)9, wParam);
             }
         }
     }
 }
Exemplo n.º 7
0
 // TODO
 private void Handle_MButtonUp_Tree(MSG msg)
 {
     IntPtr ptr;
     if(ShellBrowser.IsFolderTreeVisible(out ptr) && msg.hwnd == ptr) {
         TVHITTESTINFO structure = new TVHITTESTINFO {pt = QTUtility2.PointFromLPARAM(msg.lParam)};
         IntPtr wParam = PInvoke.SendMessage(ptr, 0x1111, IntPtr.Zero, ref structure);
         if(wParam != IntPtr.Zero) {
             int num = (int)PInvoke.SendMessage(ptr, 0x1127, wParam, (IntPtr)2);
             if((num & 2) == 0) {
                 NavigatedByCode = fNowTravelByTree = true;
                 PInvoke.SendMessage(ptr, 0x110b, (IntPtr)9, wParam);
             }
         }
     }
 }
Exemplo n.º 8
0
 // TODO
 private void HandleLBUTTON_Tree(MSG msg, bool fMouseDown)
 {
     IntPtr ptr;
     if(ShellBrowser.IsFolderTreeVisible(out ptr) && msg.hwnd == ptr) {
         TVHITTESTINFO structure = new TVHITTESTINFO {pt = QTUtility2.PointFromLPARAM(msg.lParam)};
         IntPtr wParam = PInvoke.SendMessage(ptr, 0x1111, IntPtr.Zero, ref structure);
         if(wParam != IntPtr.Zero) {
             bool flag;
             if(fMouseDown) {
                 flag = (((structure.flags != 1) && (structure.flags != 0x10)) && ((structure.flags & 2) == 0)) && ((structure.flags & 4) == 0);
             }
             else {
                 flag = ((structure.flags & 2) != 0) || ((structure.flags & 4) != 0);
             }
             if(flag) {
                 int num = (int)PInvoke.SendMessage(ptr, 0x1127, wParam, (IntPtr)2);
                 if((num & 2) == 0) {
                     NavigatedByCode = fNowTravelByTree = true;
                 }
             }
         }
     }
 }