public void LoadLayouts(XmlReader reader) { layouts.Clear(); container.Clear(); currentLayout = null; reader.MoveToContent(); if (reader.IsEmptyElement) { reader.Skip(); return; } reader.ReadStartElement("layouts"); reader.MoveToContent(); while (reader.NodeType != XmlNodeType.EndElement) { if (reader.NodeType == XmlNodeType.Element) { DockLayout layout = DockLayout.Read(this, reader); layouts.Add(layout.Name, layout); } else { reader.Skip(); } reader.MoveToContent(); } reader.ReadEndElement(); container.RelayoutWidgets(); }
public void LoadLayout(DockLayout dl) { // Sticky items currently selected in notebooks will remain // selected after switching the layout List<DockItem> sickyOnTop = new List<DockItem> (); foreach (DockItem it in items) { if ((it.Behavior & DockItemBehavior.Sticky) != 0) { DockGroupItem gitem = FindDockGroupItem (it.Id); if (gitem != null && gitem.ParentGroup.IsSelectedPage (it)) sickyOnTop.Add (it); } } if (layout != null) layout.StoreAllocation (); layout = dl; layout.RestoreAllocation (); // Make sure items not present in this layout are hidden foreach (DockItem it in items) { if ((it.Behavior & DockItemBehavior.Sticky) != 0) it.Visible = it.StickyVisible; if (layout.FindDockGroupItem (it.Id) == null) it.HideWidget (); } RelayoutWidgets (); foreach (DockItem it in sickyOnTop) it.Present (false); }
public static DockLayout Read(DockFrame frame, XmlReader reader) { DockLayout layout = new DockLayout(frame); layout.Read(reader); return(layout); }
DockLayout GetDefaultLayout() { DockLayout group = new DockLayout(this); // Add items which don't have relative defaut positions List <DockItem> todock = new List <DockItem> (); foreach (DockItem item in container.Items) { if (string.IsNullOrEmpty(item.DefaultLocation)) { DockGroupItem dgt = new DockGroupItem(this, item); dgt.SetVisible(item.DefaultVisible); group.AddObject(dgt); } else { todock.Add(item); } } // Add items with relative positions. int lastCount = 0; while (lastCount != todock.Count) { lastCount = todock.Count; for (int n = 0; n < todock.Count; n++) { DockItem it = todock [n]; if (AddDefaultItem(group, it) != null) { todock.RemoveAt(n); n--; } } } // Items which could not be docked because of an invalid default location foreach (DockItem item in todock) { DockGroupItem dgt = new DockGroupItem(this, item); dgt.SetVisible(false); group.AddObject(dgt); } // group.Dump (); return(group); }
public void LoadLayout(DockLayout dl) { // Sticky items currently selected in notebooks will remain // selected after switching the layout List <DockItem> sickyOnTop = new List <DockItem> (); foreach (DockItem it in items) { if ((it.Behavior & DockItemBehavior.Sticky) != 0) { DockGroupItem gitem = FindDockGroupItem(it.Id); if (gitem != null && gitem.ParentGroup.IsSelectedPage(it)) { sickyOnTop.Add(it); } } } if (layout != null) { layout.StoreAllocation(); } layout = dl; layout.RestoreAllocation(); // Make sure items not present in this layout are hidden foreach (DockItem it in items) { if ((it.Behavior & DockItemBehavior.Sticky) != 0) { it.Visible = it.StickyVisible; } if (layout.FindDockGroupItem(it.Id) == null) { it.HideWidget(); } } RelayoutWidgets(); foreach (DockItem it in sickyOnTop) { it.Present(false); } }
public void Clear() { layout = null; }
DockLayout GetDefaultLayout() { DockLayout group = new DockLayout (this); // Add items which don't have relative defaut positions List<DockItem> todock = new List<DockItem> (); foreach (DockItem item in container.Items) { if (string.IsNullOrEmpty (item.DefaultLocation)) { DockGroupItem dgt = new DockGroupItem (this, item); dgt.SetVisible (item.DefaultVisible); group.AddObject (dgt); } else todock.Add (item); } // Add items with relative positions. int lastCount = 0; while (lastCount != todock.Count) { lastCount = todock.Count; for (int n=0; n<todock.Count; n++) { DockItem it = todock [n]; if (AddDefaultItem (group, it) != null) { todock.RemoveAt (n); n--; } } } // Items which could not be docked because of an invalid default location foreach (DockItem item in todock) { DockGroupItem dgt = new DockGroupItem (this, item); dgt.SetVisible (false); group.AddObject (dgt); } // group.Dump (); return group; }
public static DockLayout Read(DockFrame frame, XmlReader reader) { DockLayout layout = new DockLayout (frame); layout.Read (reader); return layout; }