private void AddBottomcontent(DarkToolWindow toolWindow) { DarkDockGroup Group = null; List <DarkDockContent> BottomContent = MainDock.GetContent(DarkDockArea.Bottom); foreach (DarkDockContent Content in BottomContent) { if ((Content != null)) { Group = Content.DockGroup; break; } } if (Group != null) { MainDock.AddContent(toolWindow, Group); } else { MainDock.AddContent(toolWindow); } }
private void HandleDrag() { var location = Cursor.Position; _insertType = DockInsertType.None; _targetRegion = null; _targetGroup = null; // Check all region drop areas foreach (var area in _regionDropAreas.Values) { if (area.DropArea.Contains(location)) { _insertType = DockInsertType.None; _targetRegion = area.DockRegion; UpdateHighlightForm(area.HighlightArea); return; } } // Check all group drop areas foreach (var collection in _groupDropAreas.Values) { var sameRegion = false; var sameGroup = false; var groupHasOtherContent = false; if (collection.DropArea.DockGroup == _dragContent.DockGroup) { sameGroup = true; } if (collection.DropArea.DockGroup.DockRegion == _dragContent.DockRegion) { sameRegion = true; } if (_dragContent.DockGroup.ContentCount > 1) { groupHasOtherContent = true; } // If we're hovering over the group itself, only allow inserting before/after if multiple content is tabbed. if (!sameGroup || groupHasOtherContent) { var skipBefore = false; var skipAfter = false; // Inserting before/after other content might cause the content to be dropped on to its own location. // Check if the group above/below the hovered group contains our drag content. if (sameRegion && !groupHasOtherContent) { if (collection.InsertBeforeArea.DockGroup.Order == _dragContent.DockGroup.Order + 1) { skipBefore = true; } if (collection.InsertAfterArea.DockGroup.Order == _dragContent.DockGroup.Order - 1) { skipAfter = true; } } if (!skipBefore) { if (collection.InsertBeforeArea.DropArea.Contains(location)) { _insertType = DockInsertType.Before; _targetGroup = collection.InsertBeforeArea.DockGroup; UpdateHighlightForm(collection.InsertBeforeArea.HighlightArea); return; } } if (!skipAfter) { if (collection.InsertAfterArea.DropArea.Contains(location)) { _insertType = DockInsertType.After; _targetGroup = collection.InsertAfterArea.DockGroup; UpdateHighlightForm(collection.InsertAfterArea.HighlightArea); return; } } } // Don't allow content to be dragged on to itself if (!sameGroup) { if (collection.DropArea.DropArea.Contains(location)) { _insertType = DockInsertType.None; _targetGroup = collection.DropArea.DockGroup; UpdateHighlightForm(collection.DropArea.HighlightArea); return; } } } // Not hovering over anything - hide the highlight if (_highlightForm.Visible) { _highlightForm.Hide(); } // Show we can't drag here Cursor.Current = Cursors.No; }
internal DockDropCollection(DarkDockPanel dockPanel, DarkDockGroup group) { DropArea = new DockDropArea(dockPanel, group, DockInsertType.None); InsertBeforeArea = new DockDropArea(dockPanel, group, DockInsertType.Before); InsertAfterArea = new DockDropArea(dockPanel, group, DockInsertType.After); }