internal void AddContent(DarkDockContent dockContent, DarkDockGroup dockGroup) { // If no existing group is specified then create a new one if (dockGroup == null) { // If this is the document region, then default to first group if it exists if (DockArea == DarkDockArea.Document && _groups.Count > 0) { dockGroup = _groups[0]; } else { dockGroup = CreateGroup(); } } dockContent.DockRegion = this; dockGroup.AddContent(dockContent); if (!Visible) { Visible = true; CreateSplitter(); } PositionGroups(); }
public void AddContent(DarkDockContent dockContent, DarkDockGroup dockGroup) { if (_contents.Contains(dockContent)) { RemoveContent(dockContent); } dockContent.DockPanel = this; _contents.Add(dockContent); if (dockGroup != null) { dockContent.DockArea = dockGroup.DockArea; } if (dockContent.DockArea == DarkDockArea.None) { dockContent.DockArea = dockContent.DefaultDockArea; } DarkDockRegion region = _regions[dockContent.DockArea]; region.AddContent(dockContent, dockGroup); ContentAdded?.Invoke(this, new DockContentEventArgs(dockContent)); if (_contents.Count == 1) { dockContent.Select(); } }
internal DockDropArea(DarkDockPanel dockPanel, DarkDockGroup group, DockInsertType insertType) { DockPanel = dockPanel; DockGroup = group; InsertType = insertType; BuildAreas(); }
private void RemoveGroup(DarkDockGroup group) { var lastOrder = group.Order; _groups.Remove(group); Controls.Remove(group); foreach (var otherGroup in _groups) { if (otherGroup.Order > lastOrder) { otherGroup.Order--; } } }
private DarkDockGroup InsertGroup(int order) { foreach (var group in _groups) { if (group.Order >= order) { group.Order++; } } var newGroup = new DarkDockGroup(DockPanel, this, order); _groups.Add(newGroup); Controls.Add(newGroup); return(newGroup); }
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(); }
private DarkDockGroup CreateGroup() { var order = 0; if (_groups.Count >= 1) { order = -1; foreach (var group in _groups) { if (group.Order >= order) { order = group.Order + 1; } } } var newGroup = new DarkDockGroup(DockPanel, this, order); _groups.Add(newGroup); Controls.Add(newGroup); return(newGroup); }
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); ContentAdded?.Invoke(this, new DockContentEventArgs(dockContent)); if (_contents.Count == 1) { dockContent.Select(); } }