DockGroup Copy() { DockGroup grp = new DockGroup(Frame, type); grp.dockObjects = new List <DockObject> (dockObjects); foreach (DockObject obj in grp.dockObjects) { obj.ParentGroup = grp; } grp.CopySizeFrom(this); return(grp); }
DockGroupItem Split(DockGroupType newType, bool addFirst, DockItem obj, int npos) { DockGroupItem item = new DockGroupItem(Frame, obj); if (npos == -1 || type == DockGroupType.Tabbed) { if (ParentGroup != null && ParentGroup.Type == newType) { // No need to split. Just add the new item as a sibling of this one. int i = ParentGroup.Objects.IndexOf(this); if (addFirst) { ParentGroup.Objects.Insert(i, item); } else { ParentGroup.Objects.Insert(i + 1, item); } item.ParentGroup = ParentGroup; item.ResetDefaultSize(); } else { DockGroup grp = Copy(); dockObjects.Clear(); if (addFirst) { dockObjects.Add(item); dockObjects.Add(grp); } else { dockObjects.Add(grp); dockObjects.Add(item); } item.ParentGroup = this; item.ResetDefaultSize(); grp.ParentGroup = this; grp.ResetDefaultSize(); Type = newType; } } else { DockGroup grp = new DockGroup(Frame, newType); DockObject replaced = dockObjects[npos]; if (addFirst) { grp.AddObject(item); grp.AddObject(replaced); } else { grp.AddObject(replaced); grp.AddObject(item); } grp.CopySizeFrom(replaced); dockObjects [npos] = grp; grp.ParentGroup = this; } return(item); }