public class TextWidget extends MapWidget2
Modifier and Type | Class and Description |
---|---|
static interface |
TextWidget.OnColorChangedListener |
static interface |
TextWidget.OnHasBackgroundChangedListener |
static interface |
TextWidget.OnTextChangedListener |
MapWidget2.OnWidgetSizeChangedListener
MapWidget.Factory, MapWidget.OnClickListener, MapWidget.OnLongPressListener, MapWidget.OnMoveListener, MapWidget.OnPressListener, MapWidget.OnUnpressListener, MapWidget.OnVisibleChangedListener, MapWidget.OnWidgetPointChangedListener
Modifier and Type | Field and Description |
---|---|
protected int |
_lineCount |
protected java.lang.String |
_text |
protected MapTextFormat |
_textFormat |
protected int |
background |
static int |
TRANSLUCENT |
static int |
TRANSLUCENT_BLACK |
Constructor and Description |
---|
TextWidget() |
TextWidget(java.lang.String text) |
TextWidget(java.lang.String text,
MapTextFormat textFormat) |
TextWidget(java.lang.String text,
MapTextFormat textFormat,
boolean hasBackgound) |
TextWidget(java.lang.String text,
MapTextFormat textFormat,
int background)
The Text widget created with some text, formating and the background set to a specific color.
|
Modifier and Type | Method and Description |
---|---|
void |
addOnColorChangedListener(ITextWidget.OnColorChangedListener l) |
void |
addOnHasBackgroundChangedListener(ITextWidget.OnHasBackgroundChangedListener l) |
void |
addOnTextChangedListener(ITextWidget.OnTextChangedListener l) |
int |
getBackground() |
int |
getColor()
Get the first color in the color array or white if the color is not set.
|
int |
getColor(int lineNumber)
Returns the color of a line.
|
int[] |
getColors() |
int |
getLineCount() |
java.lang.String |
getText()
Get the text for the TextWidget.
|
MapTextFormat |
getTextFormat() |
TextFormat |
getWidgetTextFormat() |
protected void |
onTextChanged() |
void |
orientationChanged()
Subclass to allow for a new x,y,height,width to be computed when the orientation
has changed.
|
protected void |
recalcSize() |
void |
removeOnColorChangedListener(ITextWidget.OnColorChangedListener l) |
void |
removeOnHasBackgroundChangedListener(ITextWidget.OnHasBackgroundChangedListener l) |
void |
removeOnTextChangedListener(ITextWidget.OnTextChangedListener l) |
void |
setBackground(int background)
Should be set to true if the TextWidget needs to render a background.
|
void |
setColor(int color) |
void |
setColors(int[] colors)
An array of the colors with each postition in the array corresponding to a line in the text.
|
void |
setText(java.lang.CharSequence text) |
void |
setText(java.lang.String text)
Set the test for the widget.
|
void |
setTextFormat(MapTextFormat textFormat) |
addOnWidgetSizeChangedListener, getSize, onSizeChanged, removeOnWidgetSizeChangedListener, seekHit, seekHit, seekWidgetHit, testHit
addOnClickListener, addOnHoverListener, addOnLongPressListener, addOnMoveListener, addOnPressListener, addOnUnpressListener, addOnVisibleChangedListener, addOnWidgetPointChangedListener, equals, getAbsolutePath, getAbsolutePosition, getAbsoluteWidgetPosition, getHeight, getMargins, getName, getPadding, getParent, getPointX, getPointY, getPropertyValue, getSize, getWidth, getZOrder, hashCode, isEnterable, isTouchable, isVisible, onClick, onClick, onHover, onLongPress, onMove, onMove, onPointChanged, onPress, onPress, onUnpress, onUnpress, onVisibleChanged, registerForwardedListener, removeOnClickListener, removeOnHoverListener, removeOnLongPressListener, removeOnMoveListener, removeOnPressListener, removeOnUnpressListener, removeOnVisibleChangedListener, removeOnWidgetPointChangedListener, setHeight, setMargins, setName, setPadding, setPadding, setParent, setPoint, setSize, setTouchable, setVisible, setWidth, setZOrder, unregisterForwardedListener, visitPropertyInfos
protected java.lang.String _text
protected int _lineCount
protected MapTextFormat _textFormat
protected int background
public static final int TRANSLUCENT_BLACK
public static final int TRANSLUCENT
public TextWidget(java.lang.String text, MapTextFormat textFormat, boolean hasBackgound)
public TextWidget(java.lang.String text, MapTextFormat textFormat, int background)
text
- the text which can be broken up by newlines.textFormat
- the format to use when rendering the textbackground
- the background color.public TextWidget(java.lang.String text, MapTextFormat textFormat)
public TextWidget(java.lang.String text)
public TextWidget()
public final void addOnTextChangedListener(ITextWidget.OnTextChangedListener l)
public final void removeOnTextChangedListener(ITextWidget.OnTextChangedListener l)
public final void addOnColorChangedListener(ITextWidget.OnColorChangedListener l)
public final void removeOnColorChangedListener(ITextWidget.OnColorChangedListener l)
public final void addOnHasBackgroundChangedListener(ITextWidget.OnHasBackgroundChangedListener l)
public final void removeOnHasBackgroundChangedListener(ITextWidget.OnHasBackgroundChangedListener l)
public int getLineCount()
public void setText(java.lang.String text)
text
- The text to be contained in the Widget.public void setText(java.lang.CharSequence text)
public void setColor(int color)
public void setColors(int[] colors)
colors
- an integer array that contains the int color values for each line.public int getColor()
public int getColor(int lineNumber)
lineNumber
- A zero based index for the linepublic int[] getColors()
public void setBackground(int background)
background
- the background to be used for rendering the widget.public int getBackground()
public java.lang.String getText()
public void setTextFormat(MapTextFormat textFormat)
public MapTextFormat getTextFormat()
public TextFormat getWidgetTextFormat()
protected void onTextChanged()
protected void recalcSize()
public void orientationChanged()
MapWidget
orientationChanged
in class MapWidget