private void HandleDragAbsoluteMoveTabInPlace(DragUndockHeader header, DragAbsoluteEventArgs args) { DraggedTabInfo draggedTabInfo = DockManager.Instance.DraggedTabInfo; bool flag = draggedTabInfo.GetTabIndexAt(args.ScreenPoint) == draggedTabInfo.DraggedTabPosition; if (flag) { draggedTabInfo.ClearVirtualTabRect(); } if (header.ViewElement == null && draggedTabInfo.DraggedViewElement == null) { return; } ViewElement tab = header.ViewElement ?? draggedTabInfo.DraggedViewElement; if (!draggedTabInfo.TabStripRect.Contains(args.ScreenPoint) || flag || draggedTabInfo.VirtualTabRect.Contains(args.ScreenPoint)) { return; } int tabIndexAt = draggedTabInfo.GetTabIndexAt(args.ScreenPoint); if (-1 == tabIndexAt) { return; } DockOperations.MoveTab(tab, tabIndexAt); draggedTabInfo.SetVirtualTabRect(tabIndexAt); draggedTabInfo.MoveTabRect(draggedTabInfo.DraggedTabPosition, tabIndexAt); draggedTabInfo.DraggedTabPosition = tabIndexAt; }
private void HandleDockIntoTabStrip(DraggedTabInfo tabInfo, DragUndockHeader header, DragAbsoluteEventArgs args) { int dockPosition = tabInfo.GetClosestTabIndexAt(args.ScreenPoint); if (-1 == dockPosition) { return; } ViewElement viewElement = tabInfo.TargetElement; if (viewElement == null && tabInfo.GroupContainer != null) { viewElement = (ViewElement)DockOperations.CreateDocumentGroupAt(tabInfo.GroupContainer, tabInfo.GroupPosition); viewElement.DockedHeight = tabInfo.GroupDockedHeight; viewElement.DockedWidth = tabInfo.GroupDockedWidth; viewElement.FloatingHeight = tabInfo.GroupFloatingHeight; viewElement.FloatingWidth = tabInfo.GroupFloatingWidth; } if (!DockOperations.AreDockRestrictionsFulfilled(header.ViewElement, viewElement)) { return; } bool flag = false; ViewGroup viewGroup = tabInfo.NestedGroup as ViewGroup; if (viewGroup != null) { flag = viewGroup.Children.Contains(header.ViewElement); } if (!flag && tabInfo.TabRects.Count > 0 && args.ScreenPoint.X > tabInfo.TabRects[tabInfo.TabRects.Count - 1].Right) { dockPosition = tabInfo.TabRects.Count; } if (tabInfo.TabRects.Count == 0) { dockPosition = 0; } if (DockManager.Instance.DraggedTabInfo != null && -1 != DockManager.Instance.DraggedTabInfo.DraggedTabPosition) { DockManager.Instance.DraggedTabInfo.RemoveTabRect(DockManager.Instance.DraggedTabInfo.DraggedTabPosition); } DockOperations.DockAt(viewElement, header.ViewElement, dockPosition); tabInfo.TabStrip.IsNotificationNeeded = true; tabInfo.DraggedTabPosition = dockPosition; tabInfo.ClearVirtualTabRect(); DockManager.Instance.ClearAdorners(); }