LayoutFarm.CustomWidgets.EaseBox.PerformContentLayout C# (CSharp) Method

PerformContentLayout() public method

public PerformContentLayout ( ) : void
return void
        public override void PerformContentLayout()
        {
            this.InvalidateGraphics();
            //temp : arrange as vertical stack***
            switch (this.ContentLayoutKind)
            {
                case CustomWidgets.BoxContentLayoutKind.VerticalStack:
                    {
                        int count = this.ChildCount;
                        int ypos = 0;
                        int maxRight = 0;
                        for (int i = 0; i < count; ++i)
                        {
                            var element = this.GetChild(i) as UIBox;
                            if (element != null)
                            {
                                //if (element.dbugBreakMe)
                                //{

                                //}
                                element.PerformContentLayout();
                                //int elemH = element.HasSpecificHeight ?
                                //    element.Height :
                                //    element.DesiredHeight;
                                //int elemW = element.HasSpecificWidth ?
                                //    element.Width :
                                //    element.DesiredWidth;
                                //element.SetBounds(0, ypos, element.Width, elemH);
                                element.SetBounds(0, ypos, element.Width, element.Height);
                                ypos += element.Height;
                                int tmp_right = element.DesiredWidth + element.Left;
                                if (tmp_right > maxRight)
                                {
                                    maxRight = tmp_right;
                                }
                            }
                        }

                        this.SetDesiredSize(maxRight, ypos);
                    }
                    break;
                case CustomWidgets.BoxContentLayoutKind.HorizontalStack:
                    {
                        int count = this.ChildCount;
                        int xpos = 0;
                        int maxBottom = 0;
                        for (int i = 0; i < count; ++i)
                        {
                            var element = this.GetChild(i) as UIBox;
                            if (element != null)
                            {
                                element.PerformContentLayout();
                                element.SetBounds(xpos, 0, element.DesiredWidth, element.DesiredHeight);
                                xpos += element.DesiredWidth;
                                int tmp_bottom = element.DesiredHeight + element.Top;
                                if (tmp_bottom > maxBottom)
                                {
                                    maxBottom = tmp_bottom;
                                }
                            }
                        }

                        this.SetDesiredSize(xpos, maxBottom);
                    }
                    break;
                default:
                    {
                        int count = this.ChildCount;
                        int maxRight = 0;
                        int maxBottom = 0;
                        for (int i = 0; i < count; ++i)
                        {
                            var element = this.GetChild(i) as UIBox;
                            if (element != null)
                            {
                                element.PerformContentLayout();
                                int tmp_right = element.DesiredWidth + element.Left;
                                if (tmp_right > maxRight)
                                {
                                    maxRight = tmp_right;
                                }
                                int tmp_bottom = element.DesiredHeight + element.Top;
                                if (tmp_bottom > maxBottom)
                                {
                                    maxBottom = tmp_bottom;
                                }
                            }
                        }

                        if (!this.HasSpecificWidth)
                        {
                            this.SetDesiredSize(maxRight, this.DesiredHeight);
                        }
                        if (!this.HasSpecificHeight)
                        {
                            this.SetDesiredSize(this.DesiredWidth, maxBottom);
                        }
                    }
                    break;
            }
            //------------------------------------------------
            base.RaiseLayoutFinished();
        }
        protected override void Describe(UIVisitor visitor)