public virtual void OnReduce() { if (!IsCompound) { return; } DockObject parent = ParentObject; Widget[] children = Children; if (children.Length <= 1) { if (parent != null) { parent.Freeze(); } Freeze(); Detach(false); foreach (Widget widget in children) { DockObject child = widget as DockObject; child.flags |= DockObjectFlags.InReflow; child.Detach(false); if (parent != null) { parent.Add(child); } child.flags &= ~(DockObjectFlags.InReflow); } reducePending = false; Thaw(); if (parent != null) { parent.Thaw(); } } }
public override void OnDocked(DockObject requestor, DockPlacement position, object data) { DockObject parent = ParentObject; DockObject newParent = null; bool addOurselvesFirst; switch (position) { case DockPlacement.Top: case DockPlacement.Bottom: newParent = new DockPaned(Orientation.Vertical); addOurselvesFirst = (position == DockPlacement.Bottom); break; case DockPlacement.Left: case DockPlacement.Right: newParent = new DockPaned(Orientation.Horizontal); addOurselvesFirst = (position == DockPlacement.Right); break; case DockPlacement.Center: newParent = new DockNotebook(); addOurselvesFirst = true; break; default: Console.WriteLine("Unsupported docking strategy"); return; } if (parent != null) { parent.Freeze(); } DockObjectFlags |= DockObjectFlags.InReflow; Detach(false); newParent.Freeze(); newParent.Bind(Master); if (addOurselvesFirst) { newParent.Add(this); newParent.Add(requestor); } else { newParent.Add(requestor); newParent.Add(this); } if (parent != null) { parent.Add(newParent); } if (Visible) { newParent.Show(); } if (position != DockPlacement.Center && data != null && data is System.Int32) { if (newParent is DockPaned) { ((DockPaned)newParent).Position = (int)data; } } DockObjectFlags &= ~(DockObjectFlags.InReflow); newParent.Thaw(); if (parent != null) { parent.Thaw(); } }
void RecursiveBuild(XmlNode parentNode, DockObject parent) { if (master == null || parentNode == null) return; DockObject obj; // FIXME: if parent is null, we should build toplevels //if (parent == null) foreach (XmlNode node in parentNode.ChildNodes) { obj = SetupObject (node); if (obj != null) { obj.Freeze (); // recurse here to catch placeholders RecursiveBuild (node, obj); // placeholders are later attached to the parent if (obj is DockPlaceholder) obj.Detach (false); // apply "after" parameters obj.FromXmlAfter (node); // add the object to the parent if (parent != null) { if (obj is DockPlaceholder) { ((DockPlaceholder) obj).Attach (parent); } else if (parent.IsCompound) { parent.Add (obj); if (parent.Visible) obj.Show (); } } else { if (master.Controller != obj && master.Controller.Visible) obj.Show (); } // call reduce just in case child is missing if (obj.IsCompound) obj.Reduce (); obj.Thaw (); } } }
void RecursiveBuild(XmlNode parentNode, DockObject parent) { if (master == null || parentNode == null) { return; } DockObject obj; // FIXME: if parent is null, we should build toplevels //if (parent == null) foreach (XmlNode node in parentNode.ChildNodes) { obj = SetupObject(node); if (obj != null) { obj.Freeze(); // recurse here to catch placeholders RecursiveBuild(node, obj); // placeholders are later attached to the parent if (obj is DockPlaceholder) { obj.Detach(false); } // apply "after" parameters obj.FromXmlAfter(node); // add the object to the parent if (parent != null) { if (obj is DockPlaceholder) { ((DockPlaceholder)obj).Attach(parent); } else if (parent.IsCompound) { parent.Add(obj); if (parent.Visible) { obj.Show(); } } } else { if (master.Controller != obj && master.Controller.Visible) { obj.Show(); } } // call reduce just in case child is missing if (obj.IsCompound) { obj.Reduce(); } obj.Thaw(); } } }