Пример #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);
		}