Esempio n. 1
0
        /// <summary>
        /// Allocate a tag
        /// </summary>
        /// <param name="aTag">a tag</param>
        /// <param name="anAlign">hAlign</param>
        /// <param name="aWidth">widthLimit</param>
        /// <param name="aHeight">height</param>
        /// <param name="anExtraInfo">extrainfo to be stored</param>
        /// <returns>relative position where the tag should be drawn</returns>
        internal RectangleF AllocateSpace(HtmlTag aTag, hAlignType anAlign, float aWidth, float aHeight, Int32 anExtraInfo)
        {
            if ((anAlign == hAlignType.Left) && (!(CanAllocateSpace(aWidth))))
            {
                NewLine();
            }
            if ((anAlign == hAlignType.Right) && (currentX + aWidth > WidthLimit()))
            {
                NewLine();
            }
            lineInfo[currentLine].UpdateHeight(aHeight);

            switch (anAlign)
            {
            case hAlignType.Right:
                allocList.Add(aTag, anAlign, WidthLimit() - aWidth, currentY, aWidth, aHeight, currentLine, anExtraInfo);
                currentX += (WidthLimit() - aWidth) + 1;
                NewLine();
                break;

            case hAlignType.Centre:
                allocList.Add(aTag, anAlign, (WidthLimit() - aWidth) / 2, currentY, aWidth, aHeight, currentLine, anExtraInfo);
                currentX += (WidthLimit() - aWidth) / 2 + 1;
                NewLine();
                break;

            default:
                allocList.Add(aTag, anAlign, currentX, currentY, aWidth, aHeight, currentLine, anExtraInfo);
                currentX += aWidth + 1;
                break;
            }
            return(allocList[allocList.Count - 1].allocatedRect);
        }
Esempio n. 2
0
 internal Int32 Add(HtmlTag aTag, hAlignType anAlign, float aLeft, float aTop, float aWidth,
                    float aHeight, Int32 aCurrentLine, Int32 anExtraInfo)
 {
     return(Add(new anAllocatedItem(aTag, anAlign,
                                    new RectangleF(aLeft, aTop, aWidth, aHeight),
                                    aCurrentLine, anExtraInfo, this[aTag])));
 }
Esempio n. 3
0
 internal anAllocatedItem(HtmlTag aTag, hAlignType anAlign, float aLeft, float aTop, float aWidth, float aHeight,
                          Int32 aCurrentLine, Int32 anExtraInfo, anAllocatedItem aLink)
 {
     allocatedTag  = aTag;
     align         = anAlign;
     allocatedRect = new RectangleF(aLeft, aTop, aWidth, aHeight);
     currentLine   = aCurrentLine;
     extraInfo     = anExtraInfo;
     link          = aLink;
 }
Esempio n. 4
0
        internal anAllocatedItem link;                                  // Link to first item

        internal anAllocatedItem(HtmlTag aTag, hAlignType anAlign, RectangleF aRect, Int32 aCurrentLine,
                                 Int32 anExtraInfo, anAllocatedItem aLink)
        {
            allocatedTag  = aTag;
            align         = anAlign;
            allocatedRect = aRect;
            currentLine   = aCurrentLine;
            extraInfo     = anExtraInfo;
            link          = aLink;
        }
Esempio n. 5
0
        public float GetLeftOffset(hAlignType anAlign, float aWidthLimit)
        {
            switch (anAlign)
            {
            //TODO: Figure out what Align.right goes wrong
            case hAlignType.Right:
                return(lineWidthLimit - lineWidth - 10);

            case hAlignType.Centre:
                return((lineWidthLimit - lineWidth) / 2);

            default:
                return(0);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Initialize the current CurrentStateType object, required by UpdateState()
        /// </summary>
        public void InitState()
        {
            stateChanged  = true;
            pFont         = new Font(Defines.defaultFntName, Defines.defaultFntSize, FontStyle.Regular);
            targetURL     = "";
            bkColor       = Color.Transparent;
            fntColor      = Color.Black;
            linkColor     = Color.Red;
            activeColor   = Color.DarkRed;
            visitedColor  = Color.Purple;
            URLColor      = Color.Blue;
            bulletType    = bulletStyleType.Decimal;
            hAlign        = hAlignType.Left;
            vAlign        = vAlignType.Unknown;
            startPosition = 0;
            endPosition   = origWidthLimit;
            isHeader      = false;
            isScript      = false;
            visible       = true;
            subScript     = false;
            supScript     = false;
            formName      = "";
            formAction    = "";
            formMethod    = formMethodType.Default;

            for (Int32 i = 0; i <= 4; i++)
            {
                margin[i]      = 0;
                padding[i]     = 0;
                borderColor[i] = Color.Transparent;
                borderStyle[i] = borderStyleType.None;
                borderWidth[i] = 0;
            }
            position      = new Point(0, 0);
            height        = -1;
            width         = -1;
            textTransform = textTransformType.None;
            positionStyle = positionStyleType.Static;
            cursor        = Cursors.Default;
        }