Exemplo n.º 1
0
        public static void RecursiveToggleLeafVisible(Brother currentBrother)
        {
            var bigBrother = (Brother) currentBrother.GetParent();
            var bigBrothersLabel = bigBrother.Label;
            var currentBrothersLabel = currentBrother.Label;

            if( currentBrothersLabel.Parent == null ) 
            {
                currentBrothersLabel.Visible = !bigBrother.HideChildren; 
            }
            else
            {
                if( bigBrothersLabel.Parent == null ) 
                {
                    currentBrothersLabel.Visible = !currentBrothersLabel.Visible;
                }
                else
                {
                    currentBrothersLabel.Visible = bigBrothersLabel.Visible && !bigBrother.HideChildren;
                }
            }

            if( !currentBrother.HideChildren )
            {
                for ( var i = 0; i < currentBrother.ChildCount; i++ ) 
                {
                    RecursiveToggleLeafVisible( (Brother) currentBrother[i] );
                }
            }
        }
Exemplo n.º 2
0
        private void SwapChildOrder(Brother left, Brother right)
        {
            if( !left.HasParent() ) return;
            if( !right.HasParent() ) return;
            if( (Brother) left.GetParent( true ) != (Brother) right.GetParent( true ) ) return;
            if( (Brother) left.GetParent( true ) != this ) return;
            if( !left.HasRightSibling( true ) ) return;
            if( !right.HasLeftSibling( true ) ) return;
            if( (Brother) left.GetRightSibling( true ) != right ) return;
            if( (Brother) right.GetLeftSibling( true ) != left ) return; 

            if( left == (Brother) GetFirstChild( true ) )
            {
                SetChild( right );
            }

            right.SetLeftSibling( left.GetLeftSibling( true ) );
            left.SetRightSibling( right.GetRightSibling( true ) );

            if( right.HasRightSibling( true ) )
            {
                ((Brother) right.GetRightSibling( true )).SetLeftSibling( left );
            }

            if( left.HasLeftSibling( true ) )
            {
                ((Brother) left.GetLeftSibling( true )).SetRightSibling( right );
            }

            left.SetLeftSibling( right );
            right.SetRightSibling( left );
        }