private void CreateRegions() { var documentRegion = new DarkDockRegion(this, DarkDockArea.Document); _regions.Add(DarkDockArea.Document, documentRegion); var leftRegion = new DarkDockRegion(this, DarkDockArea.Left); _regions.Add(DarkDockArea.Left, leftRegion); var rightRegion = new DarkDockRegion(this, DarkDockArea.Right); _regions.Add(DarkDockArea.Right, rightRegion); var bottomRegion = new DarkDockRegion(this, DarkDockArea.Bottom); _regions.Add(DarkDockArea.Bottom, bottomRegion); // Add the regions in this order to force the bottom region to be positioned // between the left and right regions properly. Controls.Add(documentRegion); Controls.Add(bottomRegion); Controls.Add(leftRegion); Controls.Add(rightRegion); // Create tab index for intuitive tabbing order documentRegion.TabIndex = 0; rightRegion.TabIndex = 1; bottomRegion.TabIndex = 2; leftRegion.TabIndex = 3; }
internal DockDropArea(DarkDockPanel dockPanel, DarkDockRegion region) { DockPanel = dockPanel; DockRegion = region; InsertType = DockInsertType.None; BuildAreas(); }
internal DockDropArea(DarkDockPanel dockPanel, DarkDockRegion region) { DockPanel = dockPanel; DockRegion = region; InsertType = DockInsertType.None; BuildAreas(); }
public DarkDockGroup(DarkDockPanel dockPanel, DarkDockRegion dockRegion, int order) { SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true); DockPanel = dockPanel; DockRegion = dockRegion; DockArea = dockRegion.DockArea; Order = order; _tabArea = new DarkDockTabArea(DockArea); DockPanel.ActiveContentChanged += DockPanel_ActiveContentChanged; }
public DarkDockGroup(DarkDockPanel dockPanel, DarkDockRegion dockRegion, int order) { SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true); DockPanel = dockPanel; DockRegion = dockRegion; DockArea = dockRegion.DockArea; Order = order; _tabArea = new DarkDockTabArea(DockArea); DockPanel.ActiveContentChanged += DockPanel_ActiveContentChanged; }
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; }
private void CreateRegions() { var documentRegion = new DarkDockRegion(this, DarkDockArea.Document); _regions.Add(DarkDockArea.Document, documentRegion); var leftRegion = new DarkDockRegion(this, DarkDockArea.Left); _regions.Add(DarkDockArea.Left, leftRegion); var rightRegion = new DarkDockRegion(this, DarkDockArea.Right); _regions.Add(DarkDockArea.Right, rightRegion); var bottomRegion = new DarkDockRegion(this, DarkDockArea.Bottom); _regions.Add(DarkDockArea.Bottom, bottomRegion); // Add the regions in this order to force the bottom region to be positioned // between the left and right regions properly. Controls.Add(documentRegion); Controls.Add(bottomRegion); Controls.Add(leftRegion); Controls.Add(rightRegion); // Create tab index for intuitive tabbing order documentRegion.TabIndex = 0; rightRegion.TabIndex = 1; bottomRegion.TabIndex = 2; leftRegion.TabIndex = 3; }