internal DockDropArea(DarkDockPanel dockPanel, DarkDockRegion region) { DockPanel = dockPanel; DockRegion = region; InsertType = DockInsertType.None; BuildAreas(); }
internal DockDropArea(DarkDockPanel dockPanel, DarkDockGroup group, DockInsertType insertType) { DockPanel = dockPanel; DockGroup = group; InsertType = insertType; BuildAreas(); }
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 void InsertContent(DarkDockContent dockContent, DarkDockGroup dockGroup, DockInsertType insertType) { var order = dockGroup.Order; if (insertType == DockInsertType.After) { order++; } var newGroup = InsertGroup(order); dockContent.DockRegion = this; newGroup.AddContent(dockContent); if (!Visible) { Visible = true; CreateSplitter(); } PositionGroups(); }
public void InsertContent(DarkDockContent dockContent, DarkDockGroup dockGroup, DockInsertType insertType) { if (_contents.Contains(dockContent)) { RemoveContent(dockContent); } dockContent.DockPanel = this; _contents.Add(dockContent); dockContent.DockArea = dockGroup.DockArea; var region = _regions[dockGroup.DockArea]; region.InsertContent(dockContent, dockGroup, insertType); if (ContentAdded != null) { ContentAdded(this, new DockContentEventArgs(dockContent)); } dockContent.Select(); }
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 void InsertContent(DarkDockContent dockContent, DarkDockGroup dockGroup, DockInsertType insertType) { var order = dockGroup.Order; if (insertType == DockInsertType.After) order++; var newGroup = InsertGroup(order); dockContent.DockRegion = this; newGroup.AddContent(dockContent); if (!Visible) { Visible = true; CreateSplitter(); } PositionGroups(); }
public void InsertContent(DarkDockContent dockContent, DarkDockGroup dockGroup, DockInsertType insertType) { if (_contents.Contains(dockContent)) RemoveContent(dockContent); dockContent.DockPanel = this; _contents.Add(dockContent); dockContent.DockArea = dockGroup.DockArea; var region = _regions[dockGroup.DockArea]; region.InsertContent(dockContent, dockGroup, insertType); if (ContentAdded != null) ContentAdded(this, new DockContentEventArgs(dockContent)); dockContent.Select(); }