Example #1
0
        public void Validate()
        {
            if (!_layoutEnabled)
            {
                return;
            }

            if (FillParent && parent != null)
            {
                var   stage = GetStage();
                float parentWidth, parentHeight;

                if (stage != null && parent == stage.GetRoot())
                {
                    parentWidth  = stage.GetWidth();
                    parentHeight = stage.GetHeight();
                }
                else
                {
                    parentWidth  = parent.GetWidth();
                    parentHeight = parent.GetHeight();
                }

                if (width != parentWidth || height != parentHeight)
                {
                    SetSize(parentWidth, parentHeight);
                    Invalidate();
                }
            }

            if (!_needsLayout)
            {
                return;
            }

            _needsLayout = false;
            Layout();
        }