Example #1
0
        protected float ProcessChildsVAlign(ILayout childLayout, float contentHeight)
        {
            float yPos = 0;

            switch (childLayout.VerticalAlign)
            {
            case VerticalAlign.None:
                yPos = childLayout.Y;
                break;

            case VerticalAlign.Top:
                yPos = 0;
                break;

            case VerticalAlign.Middle:
                yPos = (contentHeight - childLayout.GetCalculatedHeight()) * 0.5f;
                break;

            case VerticalAlign.Bottom:
                yPos = contentHeight - childLayout.GetCalculatedHeight();
                break;
            }
            return(yPos);
        }
Example #2
0
        protected virtual void CalculateChild(ILayout childLayout, float x, float y, float contentWidth, float contentHeight, float absoluteX, float absoluteY)
        {
            // check if item has a percentual width
            var calcedWidth = childLayout.HasPercentualWidth ? contentWidth * childLayout.PercentualWidth : childLayout.GetCalculatedWidth();
            // check if item hat a percentual height
            var calcedHeight = childLayout.HasPercentualHeight ? contentHeight * childLayout.PercentualHeight : childLayout.GetCalculatedHeight();

            var processingData = childLayout.GetProcessingData();

            processingData.SetAbsoluteGeometry(absoluteX, absoluteY, calcedWidth, calcedHeight);
            processingData.SetDrawingGeometry(x, y, calcedWidth, calcedHeight);
            processingData.SetClipRect(absoluteX, absoluteY, calcedWidth, calcedHeight);

            if (childLayout is IContainerLayout)
            {
                ((IContainerLayout)childLayout).CalculateChildLayouts(x, y, calcedWidth, calcedHeight, absoluteX, absoluteY);
            }
        }