Exemplo n.º 1
0
 protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style)
 {
     style = base.applyTextStyleAttributes(style);
     style.PreserveWhitespace = true;
     style.Preformatted = true;
     if (style.Align == dfMarkupTextAlign.Justify)
     {
         style.Align = dfMarkupTextAlign.Left;
     }
     dfMarkupBox _dfMarkupBox = null;
     if (style.BackgroundColor.a <= 0.1f)
     {
         _dfMarkupBox = new dfMarkupBox(this, dfMarkupDisplayType.block, style);
     }
     else
     {
         dfMarkupBoxSprite _dfMarkupBoxSprite = new dfMarkupBoxSprite(this, dfMarkupDisplayType.block, style);
         _dfMarkupBoxSprite.LoadImage(base.Owner.Atlas, base.Owner.BlankTextureSprite);
         _dfMarkupBoxSprite.Style.Color = style.BackgroundColor;
         _dfMarkupBox = _dfMarkupBoxSprite;
     }
     dfMarkupAttribute _dfMarkupAttribute = base.findAttribute(new string[] { "margin" });
     if (_dfMarkupAttribute != null)
     {
         _dfMarkupBox.Margins = dfMarkupBorders.Parse(_dfMarkupAttribute.Value);
     }
     dfMarkupAttribute _dfMarkupAttribute1 = base.findAttribute(new string[] { "padding" });
     if (_dfMarkupAttribute1 != null)
     {
         _dfMarkupBox.Padding = dfMarkupBorders.Parse(_dfMarkupAttribute1.Value);
     }
     container.AddChild(_dfMarkupBox);
     base._PerformLayoutImpl(_dfMarkupBox, style);
     _dfMarkupBox.FitToContents(false);
 }
Exemplo n.º 2
0
    private dfMarkupBox createImageBox(dfAtlas atlas, string source, dfMarkupStyle style)
    {
        if (source.ToLowerInvariant().StartsWith("http://"))
        {
            return(null);
        }
        else if (atlas != null && atlas[source] != null)
        {
            var spriteBox = new dfMarkupBoxSprite(this, dfMarkupDisplayType.inline, style);
            spriteBox.LoadImage(atlas, source);

            return(spriteBox);
        }
        else
        {
            var texture = dfMarkupImageCache.Load(source);
            if (texture != null)
            {
                var textureBox = new dfMarkupBoxTexture(this, dfMarkupDisplayType.inline, style);
                textureBox.LoadTexture(texture);

                return(textureBox);
            }
        }

        return(null);
    }
Exemplo n.º 3
0
    protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style)
    {
        style = applyTextStyleAttributes(style);

        style.PreserveWhitespace = true;
        style.Preformatted       = true;

        if (style.Align == dfMarkupTextAlign.Justify)
        {
            style.Align = dfMarkupTextAlign.Left;
        }

        dfMarkupBox paragraphBox = null;

        if (style.BackgroundColor.a > 0.1f)
        {
            var spriteBox = new dfMarkupBoxSprite(this, dfMarkupDisplayType.block, style);
            spriteBox.LoadImage(this.Owner.Atlas, this.Owner.BlankTextureSprite);
            spriteBox.Style.Color = style.BackgroundColor;

            paragraphBox = spriteBox;
        }
        else
        {
            paragraphBox = new dfMarkupBox(this, dfMarkupDisplayType.block, style);
        }

        #region Allow overriding of margins and padding

        var marginAttribute = findAttribute("margin");
        if (marginAttribute != null)
        {
            paragraphBox.Margins = dfMarkupBorders.Parse(marginAttribute.Value);
        }

        var paddingAttribute = findAttribute("padding");
        if (paddingAttribute != null)
        {
            paragraphBox.Padding = dfMarkupBorders.Parse(paddingAttribute.Value);
        }

        #endregion

        container.AddChild(paragraphBox);

        base._PerformLayoutImpl(paragraphBox, style);

        paragraphBox.FitToContents();
    }
Exemplo n.º 4
0
 private dfMarkupBox createImageBox(dfAtlas atlas, string source, dfMarkupStyle style)
 {
     if (!source.ToLowerInvariant().StartsWith("http://"))
     {
         if ((atlas != null) && (atlas[source] != null))
         {
             dfMarkupBoxSprite sprite = new dfMarkupBoxSprite(this, dfMarkupDisplayType.inline, style);
             sprite.LoadImage(atlas, source);
             return(sprite);
         }
         Texture texture = dfMarkupImageCache.Load(source);
         if (texture != null)
         {
             dfMarkupBoxTexture texture2 = new dfMarkupBoxTexture(this, dfMarkupDisplayType.inline, style);
             texture2.LoadTexture(texture);
             return(texture2);
         }
     }
     return(null);
 }
Exemplo n.º 5
0
    protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style)
    {
        style = base.applyTextStyleAttributes(style);
        style.PreserveWhitespace = true;
        style.Preformatted       = true;
        if (style.Align == dfMarkupTextAlign.Justify)
        {
            style.Align = dfMarkupTextAlign.Left;
        }
        dfMarkupBox box = null;

        if (style.BackgroundColor.a > 0.1f)
        {
            dfMarkupBoxSprite sprite = new dfMarkupBoxSprite(this, dfMarkupDisplayType.block, style);
            sprite.LoadImage(base.Owner.Atlas, base.Owner.BlankTextureSprite);
            sprite.Style.Color = style.BackgroundColor;
            box = sprite;
        }
        else
        {
            box = new dfMarkupBox(this, dfMarkupDisplayType.block, style);
        }
        string[]          names     = new string[] { "margin" };
        dfMarkupAttribute attribute = base.findAttribute(names);

        if (attribute != null)
        {
            box.Margins = dfMarkupBorders.Parse(attribute.Value);
        }
        string[]          textArray2 = new string[] { "padding" };
        dfMarkupAttribute attribute2 = base.findAttribute(textArray2);

        if (attribute2 != null)
        {
            box.Padding = dfMarkupBorders.Parse(attribute2.Value);
        }
        container.AddChild(box);
        base._PerformLayoutImpl(box, style);
        box.FitToContents(false);
    }
Exemplo n.º 6
0
    protected override void _PerformLayoutImpl( dfMarkupBox container, dfMarkupStyle style )
    {
        style = applyTextStyleAttributes( style );

        style.PreserveWhitespace = true;
        style.Preformatted = true;

        if( style.Align == dfMarkupTextAlign.Justify )
        {
            style.Align = dfMarkupTextAlign.Left;
        }

        dfMarkupBox paragraphBox = null;

        if( style.BackgroundColor.a > 0.1f )
        {

            var spriteBox = new dfMarkupBoxSprite( this, dfMarkupDisplayType.block, style );
            spriteBox.LoadImage( this.Owner.Atlas, this.Owner.BlankTextureSprite );
            spriteBox.Style.Color = style.BackgroundColor;

            paragraphBox = spriteBox;

        }
        else
        {
            paragraphBox = new dfMarkupBox( this, dfMarkupDisplayType.block, style );
        }

        #region Allow overriding of margins and padding

        var marginAttribute = findAttribute( "margin" );
        if( marginAttribute != null )
        {
            paragraphBox.Margins = dfMarkupBorders.Parse( marginAttribute.Value );
        }

        var paddingAttribute = findAttribute( "padding" );
        if( paddingAttribute != null )
        {
            paragraphBox.Padding = dfMarkupBorders.Parse( paddingAttribute.Value );
        }

        #endregion

        container.AddChild( paragraphBox );

        base._PerformLayoutImpl( paragraphBox, style );

        paragraphBox.FitToContents();
    }
Exemplo n.º 7
0
    private dfMarkupBox createImageBox( dfAtlas atlas, string source, dfMarkupStyle style )
    {
        if( source.ToLowerInvariant().StartsWith( "http://" ) )
        {
            return null;
        }
        else if( atlas != null && atlas[ source ] != null )
        {

            var spriteBox = new dfMarkupBoxSprite( this, dfMarkupDisplayType.inline, style );
            spriteBox.LoadImage( atlas, source );

            return spriteBox;

        }
        else
        {
            var texture = dfMarkupImageCache.Load( source );
            if( texture != null )
            {

                var textureBox = new dfMarkupBoxTexture( this, dfMarkupDisplayType.inline, style );
                textureBox.LoadTexture( texture );

                return textureBox;

            }
        }

        return null;
    }
Exemplo n.º 8
0
 private dfMarkupBox createImageBox(dfAtlas atlas, string source, dfMarkupStyle style)
 {
     if (source.ToLowerInvariant().StartsWith("http://"))
     {
         return null;
     }
     if (atlas != null && atlas[source] != null)
     {
         dfMarkupBoxSprite _dfMarkupBoxSprite = new dfMarkupBoxSprite(this, dfMarkupDisplayType.inline, style);
         _dfMarkupBoxSprite.LoadImage(atlas, source);
         return _dfMarkupBoxSprite;
     }
     Texture texture = dfMarkupImageCache.Load(source);
     if (texture == null)
     {
         return null;
     }
     dfMarkupBoxTexture _dfMarkupBoxTexture = new dfMarkupBoxTexture(this, dfMarkupDisplayType.inline, style);
     _dfMarkupBoxTexture.LoadTexture(texture);
     return _dfMarkupBoxTexture;
 }