Esempio n. 1
0
        public override Status Layout(Area area)
        {
            if (this.marker == MarkerStart)
            {
                AbsolutePositionProps mAbsProps = propMgr.GetAbsolutePositionProps();
                BorderAndPadding      bap       = propMgr.GetBorderAndPadding();
                BackgroundProps       bProps    = propMgr.GetBackgroundProps();
                MarginProps           mProps    = propMgr.GetMarginProps();

                this.marker   = 0;
                this.position = this.properties.GetProperty("position").GetEnum();
                this.top      = this.properties.GetProperty("top").GetLength().MValue();
                this.bottom   = this.properties.GetProperty("bottom").GetLength().MValue();
                this.left     = this.properties.GetProperty("left").GetLength().MValue();
                this.right    = this.properties.GetProperty("right").GetLength().MValue();
                this.width    = this.properties.GetProperty("width").GetLength().MValue();
                this.height   = this.properties.GetProperty("height").GetLength().MValue();
                span          = this.properties.GetSpanKind();
                area.GetMyRefs().InitializeID(this.properties.GetId(), area);
            }

            AreaContainer container = (AreaContainer)area;

            if ((this.width == 0) && (this.height == 0))
            {
                width  = right - left;
                height = bottom - top;
            }

            this.areaContainer =
                new AreaContainer(propMgr.GetFontState(container.getFontInfo()),
                                  container.getXPosition() + left,
                                  container.GetYPosition() - top, width, height,
                                  position);

            areaContainer.setPage(area.getPage());
            areaContainer.setBackground(propMgr.GetBackgroundProps());
            areaContainer.setBorderAndPadding(propMgr.GetBorderAndPadding());
            areaContainer.start();

            areaContainer.setAbsoluteHeight(0);
            areaContainer.setIDReferences(area.getIDReferences());

            int numChildren = this.children.Count;

            for (int i = this.marker; i < numChildren; i++)
            {
                FObj   fo     = (FObj)children[i];
                Status status = fo.Layout(areaContainer);
            }

            areaContainer.end();
            if (position == Position.ABSOLUTE)
            {
                areaContainer.SetHeight(height);
            }
            area.addChild(areaContainer);

            return(new Status(Status.OK));
        }
Esempio n. 2
0
        public void RenderAreaContainer(AreaContainer area)
        {
            int saveY = this.currentYPosition;
            int saveX = this.currentAreaContainerXPosition;

            if (area.getPosition() == Position.ABSOLUTE)
            {
                // XPosition and YPosition give the content rectangle position
                this.currentYPosition = area.GetYPosition();
                this.currentAreaContainerXPosition = area.getXPosition();
            }
            else if (area.getPosition() == Position.RELATIVE)
            {
                this.currentYPosition -= area.GetYPosition();
                this.currentAreaContainerXPosition += area.getXPosition();
            }
            else if (area.getPosition() == Position.STATIC)
            {
                this.currentYPosition -= area.getPaddingTop()
                                         + area.getBorderTopWidth();
            }

            this.currentXPosition = this.currentAreaContainerXPosition;
            DoFrame(area);

            foreach (Box b in area.getChildren())
            {
                b.render(this);
            }

            // Restore previous origin
            this.currentYPosition = saveY;
            this.currentAreaContainerXPosition = saveX;
            if (area.getPosition() == Position.STATIC)
            {
                this.currentYPosition -= area.GetHeight();
            }
        }