com.threerings.opengl.gui
Class TextComponent

java.lang.Object
  extended by com.threerings.opengl.gui.Component
      extended by com.threerings.opengl.gui.TextComponent
All Implemented Interfaces:
ConfigUpdateListener<ManagedConfig>
Direct Known Subclasses:
EditableTextComponent, Label

public abstract class TextComponent
extends Component

Defines methods and mechanisms common to components that render a string of text.


Field Summary
protected  Color4f[] _effcols
           
protected  int[] _effsizes
           
protected  int[] _haligns
           
protected  int[] _lineSpacings
           
protected  int[] _teffects
           
protected  TextFactory[] _textfacts
           
protected  int[] _valigns
           
 
Fields inherited from class com.threerings.opengl.gui.Component
_alpha, _backgrounds, _borders, _colors, _ctx, _cursor, _enabled, _height, _hover, _hoverable, _insets, _listeners, _parent, _preferredSize, _properties, _rect, _styleConfigs, _tipmouse, _tiptext, _tooltipStyle, _transferHandler, _valid, _visible, _width, _x, _y, DEFAULT, DISABLED, HOVER, STATE_COUNT, STATE_PCLASSES
 
Constructor Summary
TextComponent(GlContext ctx)
          Creates a new text component.
 
Method Summary
 Color4f getEffectColor()
          Returns the color to use for our text effect.
 int getEffectSize()
          Returns the effect size for this component's text.
 int getHorizontalAlignment()
          Returns the horizontal alignment for this component's text.
protected  LabelRenderer.Config getLabelRendererConfig(LabelRenderer forLabel, int twidth)
          Creates a text configuration for the supplied label renderer (for which we are by definition acting as container).
 int getLineSpacing()
          Returns the line spacing for our text.
abstract  String getText()
          Returns the text currently being displayed by this component.
 int getTextEffect()
          Returns the effect for this component's text.
 TextFactory getTextFactory()
          Returns a text factory suitable for creating text in the style defined by the component's current state.
protected  TextFactory getTextFactory(LabelRenderer forLabel)
          Returns the text factory that should be used by the supplied label renderer (for which we are by definition acting as container) to generate its text.
 int getVerticalAlignment()
          Returns the vertical alignment for this component's text.
abstract  void setText(String text)
          Updates the text displayed by this component.
protected  void updateFromStyleConfig(int state, StyleConfig.Original config)
          Updates from the resolved style config.
 
Methods inherited from class com.threerings.opengl.gui.Component
acceptsFocus, addListener, boundsToString, changeCursor, computePreferredSize, configUpdated, contains, createDefaultTooltipComponent, createDefaultTooltipComponent, createTooltipComponent, dispatchEvent, emitEvent, getAbsoluteX, getAbsoluteY, getAlpha, getBackground, getBorder, getBounds, getColor, getContext, getCursor, getDefaultStyleConfig, getFallbackState, getFirstDescendantFocus, getFocusTarget, getHeight, getHitComponent, getInsets, getLastDescendantFocus, getNextFocus, getParent, getPreferredSize, getPreviousFocus, getProperty, getState, getStateCount, getStatePseudoClass, getStyleConfigs, getTooltipText, getTooltipTimeout, getTooltipWindowStyle, getTransferHandler, getWidth, getWindow, getX, getY, hasFocus, intersectScissor, invalidate, isAdded, isEnabled, isHoverable, isShowing, isTooltipRelativeToMouse, isValid, isVisible, layout, removeAllListeners, removeAllListeners, removeListener, render, renderBackground, renderBorder, renderComponent, requestFocus, scrollRectToVisible, scrollRectToVisible, setAlpha, setBackground, setBounds, setCursor, setEnabled, setHoverable, setLocation, setParent, setPreferredSize, setPreferredSize, setProperty, setSize, setStyleConfig, setStyleConfig, setStyleConfig, setStyleConfigs, setTooltipRelativeToMouse, setTooltipText, setTransferHandler, setVisible, stateDidChange, updateCursor, updateFromStyleConfig, validate, wasAdded, wasRemoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_haligns

protected int[] _haligns

_valigns

protected int[] _valigns

_teffects

protected int[] _teffects

_effsizes

protected int[] _effsizes

_lineSpacings

protected int[] _lineSpacings

_effcols

protected Color4f[] _effcols

_textfacts

protected TextFactory[] _textfacts
Constructor Detail

TextComponent

public TextComponent(GlContext ctx)
Creates a new text component.

Method Detail

setText

public abstract void setText(String text)
Updates the text displayed by this component.


getText

public abstract String getText()
Returns the text currently being displayed by this component.


getTextFactory

public TextFactory getTextFactory()
Returns a text factory suitable for creating text in the style defined by the component's current state.


getHorizontalAlignment

public int getHorizontalAlignment()
Returns the horizontal alignment for this component's text.


getVerticalAlignment

public int getVerticalAlignment()
Returns the vertical alignment for this component's text.


getTextEffect

public int getTextEffect()
Returns the effect for this component's text.


getEffectSize

public int getEffectSize()
Returns the effect size for this component's text.


getEffectColor

public Color4f getEffectColor()
Returns the color to use for our text effect.


getLineSpacing

public int getLineSpacing()
Returns the line spacing for our text.


updateFromStyleConfig

protected void updateFromStyleConfig(int state,
                                     StyleConfig.Original config)
Description copied from class: Component
Updates from the resolved style config.

Overrides:
updateFromStyleConfig in class Component

getTextFactory

protected TextFactory getTextFactory(LabelRenderer forLabel)
Returns the text factory that should be used by the supplied label renderer (for which we are by definition acting as container) to generate its text.


getLabelRendererConfig

protected LabelRenderer.Config getLabelRendererConfig(LabelRenderer forLabel,
                                                      int twidth)
Creates a text configuration for the supplied label renderer (for which we are by definition acting as container).