예제 #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] );
                }
            }
        }
예제 #2
0
        private void RecursiveCaptureLeaf(Brother brother, MouseEventArgs mouseEvent)
        {
            if( brother.Label.Parent == null ) return; 

            brother.lastPoint = mouseEvent.Location;
            brother.Label.BringToFront();

            if( brother.HasRightSibling() ) 
            {
                RecursiveCaptureLeaf( (Brother) brother.GetRightSibling(), mouseEvent );
            }

            if( brother.HasChild() )
            {
                RecursiveCaptureLeaf( (Brother) brother.GetFirstChild(), mouseEvent );
            }
        }
예제 #3
0
 public void AddChild(Brother child)
 {
     base.AddChild( child );
     RecalculateChildOrder();
 }
예제 #4
0
        private static void RecursiveMoveLeaf(Brother brother, int distanceInXDirection, int distanceInYDirection)
        {
            if( brother.Label.Parent != null )
            {
                brother.Label.Location = new Point( brother.Label.Left + distanceInXDirection,
                    brother.Label.Top + distanceInYDirection );
            }

            if( brother.HasRightSibling() ) 
            {
                RecursiveMoveLeaf( (Brother) brother.GetRightSibling(), distanceInXDirection, distanceInYDirection );
            }

            if( brother.HasChild() ) 
            {
                RecursiveMoveLeaf( (Brother) brother.GetFirstChild(), distanceInXDirection, distanceInYDirection );
            }
        }
예제 #5
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 );
        }