LayoutFarm.UI.SpacePart.ArrangeContent C# (CSharp) Method

ArrangeContent() public method

public ArrangeContent ( ) : void
return void
        public void ArrangeContent()
        {
            var uiContent = this.Content;
            if (uiContent != null)
            {
                uiContent.PerformContentLayout();
            }
        }
        public void CalculateContentSize()

Usage Example

        public override void ArrangeAllSpaces()
        {
#if DEBUG
            //vinv.dbug_SetInitObject(this);
            //vinv.dbug_StartLayoutTrace(dbugVisualElementLayoutMsg.DockSpaceLayer_ArrAllDockSpaces);
#endif
            for (int i = spaces.Length - 1; i >= 0; --i)
            {
                spaces[i].CalculateContentSize();
            }
#if DEBUG
            //vinv.dbug_EnterLayerReArrangeContent(this);
#endif


            //-------------------------------------------------
            // this.BeginLayerGraphicUpdate(vinv);
            //-------------------------------------------------
            int w = this.sizeW;
            int h = this.sizeH;
            if (dockSpaceConcept == SpaceConcept.FourSpace)
            {
                //-------------------------------------------------
                if (!this.HasSpecificBottomSpaceHeight)
                {
                }
                if (!this.HasSpecificTopSpaceHeight)
                {
                }
                if (!this.HasSpecificRightSpaceWidth)
                {
                }
                if (!this.HasSpecificLeftSpaceWidth)
                {
                }
                //-------------------------------------------------
                SetDockBound(spaces[FOURSPACE_LT],
                             0,
                             0,
                             leftSpaceWidth,
                             topSpaceHeight);
                //-------------------------------------------------------
                SetDockBound(spaces[FOURSPACE_LB],
                             0,
                             topSpaceHeight,
                             leftSpaceWidth,
                             OwnerVisualElement.Height - (topSpaceHeight));
                //------------------------------------------------------
                SetDockBound(spaces[FOURSPACE_RT],
                             leftSpaceWidth,
                             0,
                             w - leftSpaceWidth,
                             topSpaceHeight);
                //------------------------------------------------------
                SetDockBound(spaces[FOURSPACE_RB],
                             leftSpaceWidth,
                             topSpaceHeight,
                             w - (leftSpaceWidth),
                             h - (topSpaceHeight));
                //------------------------------------------------------
            }
            else
            {
                //start with ninespace , the extend to proper form

                //-------------------------------------------------
                var b_space = spaces[B];
                var t_space = spaces[T];
                var l_space = spaces[L];
                var r_space = spaces[R];
                if (!this.HasSpecificBottomSpaceHeight && b_space != null)
                {
                    b_space.CalculateContentSize();
                    //if (b_space.NeedReCalculateContentSize)
                    //{
                    //    b_space.TopDownReCalculateContentSize(vinv);
                    //}
                    this.bottomSpaceHeight = b_space.DesiredHeight;
                }

                if (!this.HasSpecificTopSpaceHeight && t_space != null)
                {
                    t_space.CalculateContentSize();
                    //if (t_space.NeedReCalculateContentSize)
                    //{
                    //    t_space.TopDownReCalculateContentSize(vinv);
                    //}
                    this.topSpaceHeight = t_space.DesiredHeight;
                }
                if (!this.HasSpecificRightSpaceWidth && r_space != null)
                {
                    r_space.CalculateContentSize();
                    //if (r_space.NeedReCalculateContentSize)
                    //{
                    //    r_space.TopDownReCalculateContentSize(vinv);
                    //}
                    this.rightSpaceWidth = r_space.DesiredWidth;
                }
                if (!this.HasSpecificLeftSpaceWidth && l_space != null)
                {
                    l_space.CalculateContentSize();
                    //if (l_space.NeedReCalculateContentSize)
                    //{
                    //    l_space.TopDownReCalculateContentSize(vinv);
                    //}
                    this.leftSpaceWidth = l_space.DesiredWidth;
                }
                //-------------------------------------------------

                if (l_space != null)
                {
                    int left_y = topSpaceHeight;
                    int left_h = h - topSpaceHeight - bottomSpaceHeight;
                    if ((leftBoxVerticalExpansionFlags & VerticalBoxExpansion.Top) == VerticalBoxExpansion.Top)
                    {
                        left_y  = 0;
                        left_h += topSpaceHeight;
                    }
                    if ((leftBoxVerticalExpansionFlags & VerticalBoxExpansion.Bottom) == VerticalBoxExpansion.Bottom)
                    {
                        left_h += bottomSpaceHeight;
                    }
                    SetDockBound(spaces[L],
                                 0,//x
                                 left_y,
                                 leftSpaceWidth,
                                 left_h);
                }
                //-------------------------------------------------
                if (r_space != null)
                {
                    int right_y = topSpaceHeight;
                    int right_h = h - topSpaceHeight - bottomSpaceHeight;
                    if (HasSpecificCenterSpaceWidth)
                    {
                        rightSpaceWidth = OwnerVisualElement.Width - (leftSpaceWidth + centerSpaceWidth);
                    }

                    if ((rightBoxVerticalExpansionFlags & VerticalBoxExpansion.Top) == VerticalBoxExpansion.Top)
                    {
                        right_y  = 0;
                        right_h += topSpaceHeight;
                    }
                    if ((rightBoxVerticalExpansionFlags & VerticalBoxExpansion.Bottom) == VerticalBoxExpansion.Bottom)
                    {
                        right_h += bottomSpaceHeight;
                    }
                    SetDockBound(spaces[R],
                                 w - rightSpaceWidth,
                                 right_y,
                                 rightSpaceWidth,
                                 right_h);
                    //spaces[R].InvalidateArrangeStatus();
                }
                //-------------------------------------------------
                if (t_space != null)
                {
                    //top
                    int top_x = 0;
                    int top_w = w;
                    if (this.dockSpaceConcept == SpaceConcept.NineSpace)
                    {
                        top_x = leftSpaceWidth;
                        top_w = w - (leftSpaceWidth + rightSpaceWidth);
                    }
                    //-------------------------------------------------------

                    if ((leftBoxVerticalExpansionFlags & VerticalBoxExpansion.Top) == VerticalBoxExpansion.Top)
                    {
                        top_x = leftSpaceWidth;
                        //top_w -= leftSpaceWidth;
                    }
                    if ((rightBoxVerticalExpansionFlags & VerticalBoxExpansion.Top) == VerticalBoxExpansion.Top)
                    {
                        //top_w -= rightSpaceWidth;
                    }
                    SetDockBound(spaces[T],
                                 top_x,
                                 0,
                                 top_w,
                                 topSpaceHeight);
                }
                //-------------------------------------------------
                if (b_space != null)
                {
                    int bottom_x = 0;
                    int bottom_w = w;
                    if (this.dockSpaceConcept == SpaceConcept.NineSpace)
                    {
                        bottom_x = leftSpaceWidth;
                        bottom_w = w - (leftSpaceWidth + rightSpaceWidth);
                    }
                    //-----------------------------------------------------

                    if ((leftBoxVerticalExpansionFlags & VerticalBoxExpansion.Bottom) == VerticalBoxExpansion.Bottom)
                    {
                        bottom_x = leftSpaceWidth;
                        //bottom_w -= leftSpaceWidth;
                    }
                    if ((rightBoxVerticalExpansionFlags & VerticalBoxExpansion.Bottom) == VerticalBoxExpansion.Bottom)
                    {
                        //bottom_w -= rightSpaceWidth;
                    }


                    bottom_x += leftSplitterWidth;
                    //-----------------------------------------------------
                    SetDockBound(spaces[B],
                                 bottom_x,
                                 h - bottomSpaceHeight,
                                 bottom_w,
                                 bottomSpaceHeight);
                }


                //---------------------------------------------------------------------------------
                if (spaces[C] != null)
                {
                    w = OwnerVisualElement.Width - (rightSpaceWidth + leftSpaceWidth) - (leftSplitterWidth + rightSplitterWidth);
                    h = OwnerVisualElement.Height - (topSpaceHeight + bottomSpaceHeight);
                    if (w < 1)
                    {
                        w = 1;
                    }
                    if (h < 1)
                    {
                        h = 1;
                    }

                    int x = leftSpaceWidth + leftSplitterWidth;
                    SetDockBound(spaces[C],
                                 x,
                                 topSpaceHeight,
                                 w,
                                 h);
                }
                if (dockSpaceConcept == SpaceConcept.NineSpace)
                {
                    h = OwnerVisualElement.Height;
                    w = OwnerVisualElement.Width;
                    SetDockBound(spaces[LT], 0, 0, leftSpaceWidth, topSpaceHeight);
                    SetDockBound(spaces[LB], 0, h - bottomSpaceHeight, leftSpaceWidth, bottomSpaceHeight);
                    SetDockBound(spaces[RT], w - rightSpaceWidth, 0, rightSpaceWidth, topSpaceHeight);
                    SetDockBound(spaces[RB], w - rightSpaceWidth, h - bottomSpaceHeight, rightSpaceWidth, bottomSpaceHeight);
                }
                //-----------------------------
            }
            for (int i = spaces.Length - 1; i >= 0; i--)
            {
                SpacePart dockSpace = spaces[i];
                if (dockSpace.SpaceName == SpaceName.Left ||
                    dockSpace.SpaceName == SpaceName.Right)
                {
                }
                if (dockSpace != null)
                {
                    dockSpace.ArrangeContent();
                }
            }

            //-------------------------------------------------

            if (this.FinishNineSpaceArrangement != null)
            {
                FinishNineSpaceArrangement(this, EventArgs.Empty);
            }

#if DEBUG
            //vinv.dbug_EndLayoutTrace();
#endif
        }