예제 #1
0
		void OnNodeExpanded(Node n)
		{
			int size = n.VisibleSubtreeSize;

			RowsInserted(IndexOf(n) + 1, size);
			rows += size;
		}
예제 #2
0
		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);
		}
예제 #3
0
		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);
		}
예제 #4
0
		public int IndexOf(Node n)
		{
			int i = 0;
			foreach (Node a in VisibleNodes)
				if (a == n)
					return i;
				else
					++i;

			return -1;
		}
예제 #5
0
		bool IsDescendentOf(Node n)
		{
			Node t = this;
			while (t != null)
				if (t == n)
					return true;
				else
					t = t.parent;

			return false;
		}
예제 #6
0
		public void RenderCustom(Painter p, Node n, Action<IColumn, Painter, Node> a)
		{
			foreach (IColumn c in columns)
				a(c, p, n);
		}
예제 #7
0
		public void Render(Painter p, Node n)
		{
			foreach (IColumn c in columns)
				c.Render(p, n);
		}
예제 #8
0
		public void PaintItem(Node n, Rectangle bounds, bool selected)
		{
			PaintBackground(bounds, selected);
			PaintExpander(bounds, n);
		}
예제 #9
0
		void OnNodeAdded(Node n)
		{
			rows += 1 + n.VisibleSubtreeSize;
		}
예제 #10
0
		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);
		}
예제 #11
0
		public bool Contains(Node node)
		{
			return children.Contains(node);
		}
예제 #12
0
		internal void NotifyNodeRemoved(Node n) { NodeRemoved(n); }
예제 #13
0
		internal void NotifyNodeAdded(Node n) { NodeAdded(n); }
예제 #14
0
		internal void NotifyNodeCollapsed(Node n) { NodeCollapsed(n); }
예제 #15
0
		internal void NotifyNodeExpanded(Node n) { NodeExpanded(n); }
예제 #16
0
		void OnNodeCollapsed(Node n)
		{
			int size = n.VisibleSubtreeSize;
			rows -= size;
			RowsRemoved(IndexOf(n) + 1, size);
		}
예제 #17
0
		void OnNodeRemoved(Node n)
		{
			rows -= 1 + n.VisibleSubtreeSize;
		}
예제 #18
0
		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);
		}
예제 #19
0
        public Node CreateView()
        {
            Node<CallerFunction> n = new Node<CallerFunction>(this);
            n.Collapse();

            foreach (CallerFunction f in callers.Values)
                n.Add(f.CreateView());

            return n;
        }
예제 #20
0
		public void Render(Painter p, Node n)
		{
			a(this, p, n);
		}