Example #1
0
        KellTreeNode[] ITreeInfo.GetVisibleNodes()
        {
            List <KellTreeNode> nodes = new List <KellTreeNode>();

            Utility.Collections.Set <KellTreeNode> disallowParents = new Utility.Collections.Set <KellTreeNode>();
            int top = ClientRectangle.Top, bottom = ClientRectangle.Bottom;

            top    -= AutoScrollPosition.Y;
            bottom -= AutoScrollPosition.Y;

            foreach (KellTreeNode treeNode in _verticalPositioning.GetNodesBetween(top, bottom))
            {
                KellTreeNode parent = treeNode.ParentCollection.ParentNode;

                if (parent != null && disallowParents.Contains(parent))
                {
                    if (!disallowParents.Contains(treeNode))
                    {
                        disallowParents.Add(treeNode);
                    }
                }
                else
                {
                    nodes.Add(treeNode);

                    if (!_treeState.IsExpanded(treeNode) && !disallowParents.Contains(treeNode))
                    {
                        disallowParents.Add(treeNode);
                    }
                }
            }

            return(nodes.ToArray());
        }
Example #2
0
        TreeNode[] ITreeInfo.GetVisibleNodes()
        {
            List<TreeNode> nodes = new List<TreeNode>();
            Utility.Collections.Set<TreeNode> disallowParents = new Utility.Collections.Set<TreeNode>();
            int top = ClientRectangle.Top, bottom = ClientRectangle.Bottom;

            top -= AutoScrollPosition.Y;
            bottom -= AutoScrollPosition.Y;

            foreach( TreeNode treeNode in _verticalPositioning.GetNodesBetween( top, bottom ) )
            {
                TreeNode parent = treeNode.ParentCollection.ParentNode;

                if( parent != null && disallowParents.Contains( parent ) )
                {
                    if( !disallowParents.Contains( treeNode ) )
                    {
                        disallowParents.Add( treeNode );
                    }
                }
                else
                {
                    nodes.Add( treeNode );

                    if( !_treeState.IsExpanded( treeNode ) && !disallowParents.Contains( treeNode ) )
                    {
                        disallowParents.Add( treeNode );
                    }
                }
            }

            return nodes.ToArray();
        }
        internal override TreeNode[] GetNodesBetween( int top, int bottom )
        {
            List<TreeNode> nodes = new List<TreeNode>();

            if( _animating )
            {
                bottom += (int) _distance;

                int extra = Math.Abs( GetValue( 0, _movement ) );
                int changeBottom = _changeTop + extra;
                Utility.Collections.Set<TreeNode> done = new Utility.Collections.Set<TreeNode>();
                StaticVerticalPositioning source;

                if( _expanding )
                {
                    source = _to;
                }
                else
                {
                    source = _from;
                }

                foreach( TreeNode tn in source.GetNodesBetween( top, _changeTop ) )
                {
                    if( !done.Contains( tn ) )
                    {
                        nodes.Add( tn );
                        done.Add( tn );
                    }
                }
                foreach( TreeNode tn in source.GetNodesBetween( Math.Max( top, _changeTop ), Math.Min( bottom - extra, changeBottom ) ) )
                {
                    if( !done.Contains( tn ) )
                    {
                        nodes.Add( tn );
                        done.Add( tn );
                    }
                }
                foreach( TreeNode tn in source.GetNodesBetween( changeBottom, bottom ) )
                {
                    if( !done.Contains( tn ) )
                    {
                        nodes.Add( tn );
                        done.Add( tn );
                    }
                }
            }
            else
            {
                foreach( TreeNode tn in _from.GetNodesBetween( top, bottom ) )
                {
                    nodes.Add( tn );
                }
            }

            return nodes.ToArray();
        }