public class TextRenderer extends Object implements ElementRenderer
Modifier and Type | Class and Description |
---|---|
class |
TextRenderer.RenderFontNull
RenderFont Null Object.
|
Constructor and Description |
---|
TextRenderer(Nifty nifty)
default constructor.
|
TextRenderer(Nifty nifty,
RenderFont newFont,
String newText)
create new renderer with the given font and text.
|
Modifier and Type | Method and Description |
---|---|
Color |
getColor() |
RenderFont |
getFont()
Get RenderFont.
|
String |
getOriginalText()
get original text.
|
protected static int |
getStartXWithHorizontalAlign(int textWidth,
int elementWidth,
HorizontalAlign horizontalAlign)
Get start x for text rendering given the textWidth and the elementWidth.
|
protected static int |
getStartYWithVerticalAlign(int textHeight,
int elementHeight,
VerticalAlign verticalAlign)
Get start Y for text rendering given the textHeight and the elementHeight.
|
HorizontalAlign |
getTextHAlign() |
int |
getTextHeight()
Helper method to get height of text.
|
VerticalAlign |
getTextVAlign() |
int |
getTextWidth()
Helper method to get width of text.
|
String |
getWrappedText() |
boolean |
isLineWrapping() |
void |
render(Element w,
NiftyRenderEngine r)
render the stuff.
|
void |
resetLayout(Element element) |
void |
setColor(Color newColor)
set color.
|
void |
setFont(RenderFont fontParam)
set font.
|
void |
setLineWrapping(boolean lineWrapping) |
void |
setSelection(int selectionStartParam,
int selectionEndParam)
set a new selection.
|
void |
setText(String newText)
set Text.
|
void |
setTextHAlign(HorizontalAlign newTextHAlign)
set text horizontal alignment.
|
void |
setTextLineHeight(SizeValue textLineHeight) |
void |
setTextMinHeight(SizeValue textMinHeight) |
void |
setTextSelectionColor(Color textSelectionColorParam)
set new text selection color.
|
void |
setTextVAlign(VerticalAlign newTextVAlign)
set text vertical alignment.
|
void |
setWidthConstraint(Element element,
SizeValue elementConstraintWidth,
int parentWidth,
NiftyRenderEngine renderEngine) |
void |
setXoffsetHack(int newXoffsetHack)
set thing.
|
public TextRenderer(Nifty nifty)
public TextRenderer(Nifty nifty, RenderFont newFont, String newText)
newFont
- the font to usenewText
- the text to usepublic void setText(String newText)
newText
- textpublic void render(Element w, NiftyRenderEngine r)
render
in interface ElementRenderer
w
- the widget we're connected tor
- the renderDevice we should useprotected static int getStartYWithVerticalAlign(int textHeight, int elementHeight, VerticalAlign verticalAlign)
textHeight
- text heightelementHeight
- element heightverticalAlign
- verticalAlignprotected static int getStartXWithHorizontalAlign(int textWidth, int elementWidth, HorizontalAlign horizontalAlign)
textWidth
- text widthelementWidth
- element widthhorizontalAlign
- horizontalAlignpublic int getTextWidth()
public int getTextHeight()
public void setXoffsetHack(int newXoffsetHack)
newXoffsetHack
- xoffsetpublic RenderFont getFont()
public void setSelection(int selectionStartParam, int selectionEndParam)
selectionStartParam
- startselectionEndParam
- endpublic void setFont(RenderFont fontParam)
fontParam
- fontpublic void setTextSelectionColor(Color textSelectionColorParam)
textSelectionColorParam
- text selection colorpublic void setTextVAlign(VerticalAlign newTextVAlign)
newTextVAlign
- text vertical alignmentpublic void setTextHAlign(HorizontalAlign newTextHAlign)
newTextHAlign
- text horizontal alignmentpublic void setColor(Color newColor)
newColor
- colorpublic String getOriginalText()
public String getWrappedText()
public void setTextLineHeight(SizeValue textLineHeight)
public void setTextMinHeight(SizeValue textMinHeight)
public void setWidthConstraint(Element element, SizeValue elementConstraintWidth, int parentWidth, NiftyRenderEngine renderEngine)
public void setLineWrapping(boolean lineWrapping)
public boolean isLineWrapping()
public VerticalAlign getTextVAlign()
public HorizontalAlign getTextHAlign()
public Color getColor()
public void resetLayout(Element element)
Copyright © 2013. All Rights Reserved.