internal override void Read(XmlReader reader) { base.Read(reader); type = (DockGroupType)Enum.Parse(typeof(DockGroupType), reader.GetAttribute("type")); if (type == DockGroupType.Tabbed) { string s = reader.GetAttribute("currentTabPage"); if (s != null) { currentTabPage = int.Parse(s); } } reader.MoveToElement(); if (reader.IsEmptyElement) { reader.Skip(); return; } reader.ReadStartElement(); reader.MoveToContent(); while (reader.NodeType != XmlNodeType.EndElement) { if (reader.NodeType == XmlNodeType.Element) { if (reader.LocalName == "item") { string id = reader.GetAttribute("id"); DockItem it = Frame.GetItem(id); if (it == null) { it = Frame.AddItem(id); it.IsPositionMarker = true; } DockGroupItem gitem = new DockGroupItem(Frame, it); gitem.Read(reader); AddObject(gitem); reader.MoveToElement(); reader.Skip(); } else if (reader.LocalName == "group") { DockGroup grp = new DockGroup(Frame); grp.Read(reader); AddObject(grp); } } else { reader.Skip(); } reader.MoveToContent(); } reader.ReadEndElement(); }
public override void CopyFrom(DockObject other) { base.CopyFrom(other); DockGroup grp = (DockGroup)other; dockObjects = new List <DockObject> (); foreach (DockObject ob in grp.dockObjects) { DockObject cob = ob.Clone(); cob.ParentGroup = this; dockObjects.Add(cob); } type = grp.type; ResetVisibleGroups(); boundTabStrip = null; tabFocus = null; }
public DockGroup(DockFrame frame, DockGroupType type) : base(frame) { this.type = type; }
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); }
public DockGroup (DockFrame frame, DockGroupType type): base (frame) { this.type = type; }
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; }
internal override void Read (XmlReader reader) { base.Read (reader); type = (DockGroupType) Enum.Parse (typeof(DockGroupType), reader.GetAttribute ("type")); if (type == DockGroupType.Tabbed) { string s = reader.GetAttribute ("currentTabPage"); if (s != null) currentTabPage = int.Parse (s); } reader.MoveToElement (); if (reader.IsEmptyElement) { reader.Skip (); return; } reader.ReadStartElement (); reader.MoveToContent (); while (reader.NodeType != XmlNodeType.EndElement) { if (reader.NodeType == XmlNodeType.Element) { if (reader.LocalName == "item") { string id = reader.GetAttribute ("id"); DockItem it = Frame.GetItem (id); if (it == null) { it = Frame.AddItem (id); it.IsPositionMarker = true; } DockGroupItem gitem = new DockGroupItem (Frame, it); gitem.Read (reader); AddObject (gitem); reader.MoveToElement (); reader.Skip (); } else if (reader.LocalName == "group") { DockGroup grp = new DockGroup (Frame); grp.Read (reader); AddObject (grp); } } else reader.Skip (); reader.MoveToContent (); } reader.ReadEndElement (); }
public override void CopyFrom (DockObject other) { base.CopyFrom (other); DockGroup grp = (DockGroup) other; dockObjects = new List<DockObject> (); foreach (DockObject ob in grp.dockObjects) { DockObject cob = ob.Clone (); cob.ParentGroup = this; dockObjects.Add (cob); } type = grp.type; ResetVisibleGroups (); boundTabStrip = null; tabFocus = null; }