private DivisionList CreateDivisionList(SplitFormat info, PaneCreationDelegate creation, DockStyle host_dock) { DivisionList list = new DivisionList(this, info.Direction, host_dock); list.FirstNode = CreateDivisionNodeList(list, info, creation); return(list); }
private DivisionNode CreateDivisionNodeList(DivisionList list, SplitFormat info, PaneCreationDelegate creation) { SplitFormat.Node tag = info.FirstTag; DivisionNode firstnode = null; DivisionNode prev = null; double remain = 1.0; while (tag != null) { DivisionNode node = null; if (tag.Content != null) { DockStyle dock = tag.Next == null ? (info.Direction == Direction.TB ? DockStyle.Bottom : DockStyle.Right) : DockStyle.Fill; node = new DivisionNode(list, CreateDivisionList(tag.Content, creation, dock), tag.GetActualRatio(remain)); } else { node = new DivisionNode(list, creation(tag.Label), tag.GetActualRatio(remain)); } remain -= tag.Ratio; if (firstnode == null) { firstnode = node; } else { prev.Next = node; } Debug.Assert(node.ParentList == list); prev = node; tag = tag.Next; } return(firstnode); }
public void ApplySplitInfo(Control parent, Control prev_content, string format, PaneCreationDelegate creation) { bool was_empty = this.IsEmpty; SplitFormat info = SplitFormat.Parse(format); _rootList = CreateDivisionList(info, creation, DockStyle.Fill); _count = _rootList.GetDivisionCount(); Rebuild(); if (prev_content == null) { parent.Controls.Add(_rootList.HostingControl); } else { Debug.Assert(prev_content.Parent == parent); UIUtil.ReplaceControl(parent, prev_content, _rootList.HostingControl); } DoLayout(); }
private DivisionNode CreateDivisionNodeList(DivisionList list, SplitFormat info, PaneCreationDelegate creation) { SplitFormat.Node tag = info.FirstTag; DivisionNode firstnode = null; DivisionNode prev = null; double remain = 1.0; while (tag != null) { DivisionNode node = null; if (tag.Content != null) { DockStyle dock = tag.Next == null ? (info.Direction == Direction.TB ? DockStyle.Bottom : DockStyle.Right) : DockStyle.Fill; node = new DivisionNode(list, CreateDivisionList(tag.Content, creation, dock), tag.GetActualRatio(remain)); } else { node = new DivisionNode(list, creation(tag.Label), tag.GetActualRatio(remain)); } remain -= tag.Ratio; if (firstnode == null) firstnode = node; else prev.Next = node; Debug.Assert(node.ParentList == list); prev = node; tag = tag.Next; } return firstnode; }
private DivisionList CreateDivisionList(SplitFormat info, PaneCreationDelegate creation, DockStyle host_dock) { DivisionList list = new DivisionList(this, info.Direction, host_dock); list.FirstNode = CreateDivisionNodeList(list, info, creation); return list; }
public void ApplySplitInfo(Control parent, Control prev_content, string format, PaneCreationDelegate creation) { bool was_empty = this.IsEmpty; SplitFormat info = SplitFormat.Parse(format); _rootList = CreateDivisionList(info, creation, DockStyle.Fill); _count = _rootList.GetDivisionCount(); Rebuild(); if (prev_content == null) parent.Controls.Add(_rootList.HostingControl); else { Debug.Assert(prev_content.Parent == parent); UIUtil.ReplaceControl(parent, prev_content, _rootList.HostingControl); } DoLayout(); }