Search in sources :

Example 1 with FallbackParagraphRenderStyle

use of org.terasology.rendering.nui.widgets.browser.ui.style.FallbackParagraphRenderStyle in project Terasology by MovingBlocks.

the class MultiBlockParagraphRenderable method getContentsMinWidth.

@Override
public int getContentsMinWidth(ParagraphRenderStyle defaultStyle) {
    FallbackParagraphRenderStyle fallbackStyle = new FallbackParagraphRenderStyle(paragraphRenderStyle, defaultStyle);
    int paragraphIndents = fallbackStyle.getParagraphMarginLeft().getValue(0) + fallbackStyle.getParagraphPaddingLeft().getValue(0) + fallbackStyle.getParagraphPaddingRight().getValue(0) + fallbackStyle.getParagraphMarginRight().getValue(0);
    return paragraphIndents + DocumentRenderer.getParagraphsMinimumWidth(0, fallbackStyle, paragraphs);
}
Also used : FallbackParagraphRenderStyle(org.terasology.rendering.nui.widgets.browser.ui.style.FallbackParagraphRenderStyle)

Example 2 with FallbackParagraphRenderStyle

use of org.terasology.rendering.nui.widgets.browser.ui.style.FallbackParagraphRenderStyle in project Terasology by MovingBlocks.

the class MultiBlockParagraphRenderable method getPreferredContentsHeight.

@Override
public int getPreferredContentsHeight(ParagraphRenderStyle defaultStyle, int yStart, ContainerRenderSpace containerRenderSpace, int sideIndents) {
    FallbackParagraphRenderStyle fallbackStyle = new FallbackParagraphRenderStyle(paragraphRenderStyle, defaultStyle);
    int containerWidth = containerRenderSpace.getContainerWidth();
    int topIndent = fallbackStyle.getParagraphMarginTop().getValue(containerWidth) + fallbackStyle.getParagraphPaddingTop().getValue(containerWidth);
    int paragraphIndents = topIndent + fallbackStyle.getParagraphPaddingBottom().getValue(containerWidth) + fallbackStyle.getParagraphMarginBottom().getValue(containerWidth);
    return paragraphIndents + DocumentRenderer.getParagraphsPreferredHeight(fallbackStyle, paragraphs, containerRenderSpace, yStart + topIndent);
}
Also used : FallbackParagraphRenderStyle(org.terasology.rendering.nui.widgets.browser.ui.style.FallbackParagraphRenderStyle)

Example 3 with FallbackParagraphRenderStyle

use of org.terasology.rendering.nui.widgets.browser.ui.style.FallbackParagraphRenderStyle in project Terasology by MovingBlocks.

the class MultiBlockParagraphRenderable method renderContents.

@Override
public void renderContents(Canvas canvas, Vector2i startPos, ContainerRenderSpace containerRenderSpace, int leftIndent, int rightIndent, ParagraphRenderStyle defaultStyle, HorizontalAlign horizontalAlign, HyperlinkRegister hyperlinkRegister) {
    FallbackParagraphRenderStyle fallbackStyle = new FallbackParagraphRenderStyle(paragraphRenderStyle, defaultStyle);
    int containerWidth = containerRenderSpace.getContainerWidth();
    int leftIndents = fallbackStyle.getParagraphMarginLeft().getValue(containerWidth) + fallbackStyle.getParagraphPaddingLeft().getValue(containerWidth);
    int rightIndents = fallbackStyle.getParagraphPaddingRight().getValue(containerWidth) + fallbackStyle.getParagraphMarginRight().getValue(containerWidth);
    int topIndents = fallbackStyle.getParagraphMarginTop().getValue(containerWidth) + fallbackStyle.getParagraphPaddingTop().getValue(containerWidth);
    DocumentRenderer.renderParagraphs(canvas, hyperlinkRegister, fallbackStyle, startPos.x, startPos.y + topIndents, leftIndent + leftIndents, rightIndent + rightIndents, paragraphs, containerRenderSpace);
}
Also used : FallbackParagraphRenderStyle(org.terasology.rendering.nui.widgets.browser.ui.style.FallbackParagraphRenderStyle)

Aggregations

FallbackParagraphRenderStyle (org.terasology.rendering.nui.widgets.browser.ui.style.FallbackParagraphRenderStyle)3