void OnNodeExpanded(Node n) { int size = n.VisibleSubtreeSize; RowsInserted(IndexOf(n) + 1, size); rows += size; }
void RenderColumnHeader(IColumn c, Painter p, Node n) { p.SetPosition(c.Left); if (c.Left > 0) p.DrawSeparatorLine(Pens.Black); p.Pad(4); p.DrawString(c.Name, Font, Brushes.Black, 3, c.Left + c.Width); }
void PaintExpander(Rectangle bounds, Node n) { if (n.IsLeaf) return; Image image = provider.GetImage(n.Expanded ? "collapse" : "expand"); g.DrawImage(image, bounds.Left + bounds.Height * (n.Depth - 1), bounds.Top); }
public int IndexOf(Node n) { int i = 0; foreach (Node a in VisibleNodes) if (a == n) return i; else ++i; return -1; }
bool IsDescendentOf(Node n) { Node t = this; while (t != null) if (t == n) return true; else t = t.parent; return false; }
public void RenderCustom(Painter p, Node n, Action<IColumn, Painter, Node> a) { foreach (IColumn c in columns) a(c, p, n); }
public void Render(Painter p, Node n) { foreach (IColumn c in columns) c.Render(p, n); }
public void PaintItem(Node n, Rectangle bounds, bool selected) { PaintBackground(bounds, selected); PaintExpander(bounds, n); }
void OnNodeAdded(Node n) { rows += 1 + n.VisibleSubtreeSize; }
public void Remove(Node node) { if (node == null) throw new ArgumentNullException("Cannot remove null child"); if (!children.Remove(node)) throw new ArgumentException("The node does not contain this child"); node.parent = null; RootNode root = Root as RootNode; if (root != null) root.NotifyNodeRemoved(node); }
public bool Contains(Node node) { return children.Contains(node); }
internal void NotifyNodeRemoved(Node n) { NodeRemoved(n); }
internal void NotifyNodeAdded(Node n) { NodeAdded(n); }
internal void NotifyNodeCollapsed(Node n) { NodeCollapsed(n); }
internal void NotifyNodeExpanded(Node n) { NodeExpanded(n); }
void OnNodeCollapsed(Node n) { int size = n.VisibleSubtreeSize; rows -= size; RowsRemoved(IndexOf(n) + 1, size); }
void OnNodeRemoved(Node n) { rows -= 1 + n.VisibleSubtreeSize; }
public void Add(Node child) { if (child == null) throw new ArgumentNullException("Cannot add null child"); if (children.Contains(child)) throw new ArgumentException("The node already contains this child"); if (child.parent != null) throw new InvalidOperationException("The child already has a parent"); if (this.IsDescendentOf(child)) throw new InvalidOperationException("Cannot create cycle"); children.Add(child); child.parent = this; RootNode root = Root as RootNode; if (root != null) root.NotifyNodeAdded(child); }
public Node CreateView() { Node<CallerFunction> n = new Node<CallerFunction>(this); n.Collapse(); foreach (CallerFunction f in callers.Values) n.Add(f.CreateView()); return n; }
public void Render(Painter p, Node n) { a(this, p, n); }