touchgfx::TextAreaWithOneWildcard class
@class TextAreaWithOneWildcard TextAreaWithWildcard.hpp touchgfx/widgets/TextAreaWithWildcard.hpp TextArea with one wildcard. TextArea with one wildcard. The format string (i.e. the text pointer set in TextArea::setText) is expected to contain a wildcard %s. @see TextAreaWithWildcardBase
class TextAreaWithOneWildcard : public TextAreaWithWildcardBase
{
public:
TextAreaWithOneWildcard() : TextAreaWithWildcardBase(), wildcard(0)
{
}
virtual int16_t getTextHeight()
{
return typedText.hasValidId() ? calculateTextHeight(typedText.getText(), wildcard) : 0;
}
virtual void draw(const Rect& area) const
{
if (typedText.hasValidId())
{
const Font* fontToDraw = typedText.getFont();
if (fontToDraw != 0)
{
LCD::StringVisuals visuals(fontToDraw, color, alpha, typedText.getAlignment(), linespace, rotation, typedText.getTextDirection(), indentation, wideTextAction);
HAL::lcd().drawString(getAbsoluteRect(), area, visuals, typedText.getText(), wildcard);
}
}
}
void setWildcard(const Unicode::UnicodeChar* value)
{
wildcard = value;
}
const Unicode::UnicodeChar* getWildcard() const
{
return wildcard;
}
virtual uint16_t getTextWidth() const
{
return typedText.hasValidId() ? typedText.getFont()->getStringWidth(typedText.getTextDirection(), typedText.getText(), wildcard) : 0;
}
virtual uint16_t getType() const
{
return (uint16_t)TYPE_TEXTAREAWITHONEWILDCARD;
}
protected:
const Unicode::UnicodeChar* wildcard;
};
Methods
getTextHeight()
@fn virtual int16_t TextAreaWithOneWildcard::getTextHeight() Gets text height. Gets text height.
Read more...
draw() const
@fn virtual void TextAreaWithOneWildcard::draw(const Rect& area) const Draws TextArea and its text. Draws TextArea and its text if a Font is set and the TypedText associated with the TextArea is valid.
Read more...
setWildcard()
@fn void TextAreaWithOneWildcard::setWildcard(const Unicode::UnicodeChar* value) Sets the wildcard in the text. Sets the wildcard in the text.Must be a zero-terminated UnicodeChar array.
Read more...
getWildcard() const
@fn const Unicode::UnicodeChar* TextAreaWithOneWildcard::getWildcard() const Gets the wildcard in the text. Gets the wildcard in the text.
Read more...
getTextWidth() const
@fn virtual uint16_t TextAreaWithOneWildcard::getTextWidth() const Gets the width in pixels of the current associated text. Gets the width in pixels of the current associated text in the current selected language. In case of multi-lined text the width of the widest line is returned.
Read more...
getType() const
@fn virtual uint16_t TextAreaWithOneWildcard::getType() const For GUI testing only. For GUI testing only. Returns type of this drawable.
Read more...
Examples
touchgfx::TextAreaWithOneWildcard is referenced by
4 libraries and example projects.
Child classes
touchgfx::TextAreaWithOneWildcard