protected override void OnMouseDragBegin(int x, int y) { DockSite site=this.Control as DockSite; if (this.Control.Dock == DockStyle.Fill && site != null || site.DocumentDockContainer != null) { DocumentDockUIManager m=site.GetDocumentUIManager(); Point pClient=site.PointToClient(new Point(x,y)); Cursor c=m.GetCursor(pClient.X,pClient.Y); if(c!=null) { m.OnMouseDown(new MouseEventArgs(MouseButtons.Left,0,pClient.X,pClient.Y,0)); m_MouseDrag=true; } } base.OnMouseDragBegin(x,y); if(m_MouseDrag) { site.Capture = true; if (site.Dock == DockStyle.Fill || site.GetDocumentUIManager().IsResizingDocument) { WinApi.RECT rect = new WinApi.RECT(0, 0, 0, 0); WinApi.GetWindowRect(site.Handle, ref rect); Rectangle r = Rectangle.FromLTRB(rect.Left, rect.Top, rect.Right, rect.Bottom); Cursor.Clip = r; } #if !FRAMEWORK20 else Cursor.Clip = Rectangle.Empty; #endif } }
protected override void OnMouseDragBegin(int x, int y) { if (m_PassiveContainer) { base.OnMouseDragBegin(x, y); return; } Control bar=this.GetItemContainerControl(); System.Windows.Forms.Control ctrl=this.GetItemContainerControl(); IOwner owner = this.GetIOwner(); BaseItem container=this.GetItemContainer(); Point pos=ctrl.PointToClient(new Point(x,y)); MouseEventArgs e=new MouseEventArgs(MouseButtons.Left,0,pos.X,pos.Y,0); BaseItem dragItem=null; BaseItem previousFocusItem = owner.GetFocusItem(); container.InternalMouseDown(e); dragItem=owner.GetFocusItem(); // // Allow control selection // if (dragItem != null && dragItem == previousFocusItem && (dragItem.SubItems.Count == 0 || !(dragItem is PopupItem))) // { // ArrayList arr = new ArrayList(1); // arr.Add(this.Control); // ISelectionService selection = (ISelectionService)this.GetService(typeof(ISelectionService)); //#if FRAMEWORK20 // selection.SetSelectedComponents(arr, SelectionTypes.Primary); //#else // selection.SetSelectedComponents(arr,SelectionTypes.MouseDown); //#endif // owner.SetFocusItem(null); // dragItem = null; // } if(dragItem!=null) { ISelectionService selection = (ISelectionService) this.GetService(typeof(ISelectionService)); if(selection!=null) { ArrayList arr=new ArrayList(1); arr.Add(dragItem); #if FRAMEWORK20 selection.SetSelectedComponents(arr, SelectionTypes.Primary); #else selection.SetSelectedComponents(arr,SelectionTypes.MouseDown); #endif OnItemSelected(owner.GetFocusItem()); } } if(bar==null || dragItem==null || this.IsDockableWindow || !m_EnableItemDragDrop || !CanDragItem(dragItem)) { if(dragItem==null) base.OnMouseDragBegin(x,y); else this.Control.Capture = true; // Does same as base implementation return; } bar.Capture = true; if (this.IsDockableWindow) { WinApi.RECT rect = new WinApi.RECT(0, 0, 0, 0); WinApi.GetWindowRect(bar.Handle, ref rect); Rectangle r = Rectangle.FromLTRB(rect.Left, rect.Top, rect.Right, rect.Bottom); Cursor.Clip = r; } StartItemDrag(dragItem); // Does same as base implementation this.Control.Capture = true; }
protected override void OnMouseDragBegin(int x, int y) { Bar bar=this.Control as Bar; m_DragDrop=false; if(bar!=null && this.IsDockableWindow) { m_MouseDownSelectedTabIndex=GetTabAt(x,y); if(m_MouseDownSelectedTabIndex!=-1) { if(bar.SelectedDockTab!=m_MouseDownSelectedTabIndex) SelectDockTab(m_MouseDownSelectedTabIndex); m_DragDrop=true; } else if(IsInTabSystemBox(x,y)) { MouseDownTabSystemBox(x,y); } else if(IsCaptionGrabHandle(bar)) { Point clientPos=bar.PointToClient(new Point(x,y)); if(bar.GrabHandleRect.Contains(clientPos)) m_DragDrop=true; } } else if (bar != null && this.IsDockableToolbar && bar.GrabHandleStyle != eGrabHandleStyle.None) { Point clientPos = bar.PointToClient(new Point(x, y)); if (bar.GrabHandleRect.Contains(clientPos)) m_DragDrop = true; } base.OnMouseDragBegin(x,y); if(m_MouseDownSelectedTabIndex!=-1) { ISelectionService selection = (ISelectionService) this.GetService(typeof(ISelectionService)); if(selection!=null && selection.PrimarySelection!=bar.Items[m_MouseDownSelectedTabIndex]) { ArrayList arr=new ArrayList(1); arr.Add(bar.Items[m_MouseDownSelectedTabIndex]); #if FRAMEWORK20 selection.SetSelectedComponents(arr, SelectionTypes.Primary); #else selection.SetSelectedComponents(arr,SelectionTypes.Click); #endif } } if(m_DragDrop) { bar.Capture = true; if (IsDocumentDock) { WinApi.RECT rect = new WinApi.RECT(0, 0, 0, 0); WinApi.GetWindowRect(bar.Parent.Handle, ref rect); Rectangle r = Rectangle.FromLTRB(rect.Left, rect.Top, rect.Right, rect.Bottom); Cursor.Clip = r; } #if !FRAMEWORK20 else { Cursor.Clip = Rectangle.Empty; } #endif } }