Exemplo n.º 1
0
 internal Rectangle GetNodeBounds(TreeNodeAdv node)
 {
     return(GetNodeBounds(GetNodeControls(node)));
 }
Exemplo n.º 2
0
 public TreeViewAdvCancelEventArgs(TreeNodeAdv node)
     : base(node)
 {
 }
Exemplo n.º 3
0
 private void AddExpandingNode(TreeNodeAdv node)
 {
     node.IsExpandingNow = true;
     _expandingNodes.Add(node);
     ExpandingIcon.Start();
 }
Exemplo n.º 4
0
 private void RemoveExpandingNode(TreeNodeAdv node)
 {
     node.IsExpandingNow = false;
     _expandingNodes.Remove(node);
 }
Exemplo n.º 5
0
        private void AddNewNode(TreeNodeAdv parent, object tag, int index)
        {
            TreeNodeAdv node = new TreeNodeAdv(this, tag);

            AddNode(parent, index, node);
        }
Exemplo n.º 6
0
 internal void ReadChilds(TreeNodeAdv parentNode)
 {
     ReadChilds(parentNode, false);
 }
Exemplo n.º 7
0
        internal IEnumerable <NodeControlInfo> GetNodeControls(TreeNodeAdv node, Rectangle rowRect)
        {
            if (node == null)
            {
                yield break;
            }

            int       y     = rowRect.Y;
            int       x     = (node.Level - 1) * _indent + LeftMargin;
            int       width = 0;
            Rectangle rect  = Rectangle.Empty;

            if (ShowPlusMinus)
            {
                width = _plusMinus.GetActualSize(node, _measureContext).Width;
                rect  = new Rectangle(x, y, width, rowRect.Height);
                if (UseColumns && Columns.Count > 0 && Columns[0].Width < rect.Right)
                {
                    rect.Width = Columns[0].Width - x;
                }

                yield return(new NodeControlInfo(_plusMinus, rect, node));

                x += width;
            }

            if (!UseColumns)
            {
                foreach (NodeControl c in NodeControls)
                {
                    Size s = c.GetActualSize(node, _measureContext);
                    if (!s.IsEmpty)
                    {
                        width = s.Width;
                        rect  = new Rectangle(x, y, width, rowRect.Height);
                        x    += rect.Width;
                        yield return(new NodeControlInfo(c, rect, node));
                    }
                }
            }
            else
            {
                int right = 0;
                foreach (TreeColumn col in Columns)
                {
                    if (col.IsVisible && col.Width > 0)
                    {
                        right += col.Width;
                        for (int i = 0; i < NodeControls.Count; i++)
                        {
                            NodeControl nc = NodeControls[i];
                            if (nc.ParentColumn == col)
                            {
                                Size s = nc.GetActualSize(node, _measureContext);
                                if (!s.IsEmpty)
                                {
                                    bool isLastControl = true;
                                    for (int k = i + 1; k < NodeControls.Count; k++)
                                    {
                                        if (NodeControls[k].ParentColumn == col)
                                        {
                                            isLastControl = false;
                                            break;
                                        }
                                    }

                                    width = right - x;
                                    if (!isLastControl)
                                    {
                                        width = s.Width;
                                    }
                                    int maxWidth = Math.Max(0, right - x);
                                    rect = new Rectangle(x, y, Math.Min(maxWidth, width), rowRect.Height);
                                    x   += width;
                                    yield return(new NodeControlInfo(nc, rect, node));
                                }
                            }
                        }
                        x = right;
                    }
                }
            }
        }