touchgfx::TextAreaWithTwoWildcards class
@class TextAreaWithTwoWildcards TextAreaWithWildcard.hpp touchgfx/widgets/TextAreaWithWildcard.hpp TextArea with two wildcards. TextArea with two wildcards. The format string (i.e. the text pointer set in TextArea::setText) is expected to contain two wildcards %s. @see TextAreaWithWildcardBase
class TextAreaWithTwoWildcards : public TextAreaWithWildcardBase
{
public:
TextAreaWithTwoWildcards() : TextAreaWithWildcardBase(), wc1(0), wc2(0)
{
}
virtual int16_t getTextHeight()
{
return typedText.hasValidId() ? calculateTextHeight(typedText.getText(), wc1, wc2) : 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(), wc1, wc2);
}
}
}
void setWildcard1(const Unicode::UnicodeChar* value)
{
wc1 = value;
}
const Unicode::UnicodeChar* getWildcard1() const
{
return wc1;
}
void setWildcard2(const Unicode::UnicodeChar* value)
{
wc2 = value;
}
const Unicode::UnicodeChar* getWildcard2() const
{
return wc2;
}
virtual uint16_t getTextWidth() const
{
return typedText.hasValidId() ? typedText.getFont()->getStringWidth(typedText.getTextDirection(), typedText.getText(), wc1, wc2) : 0;
}
virtual uint16_t getType() const
{
return (uint16_t)TYPE_TEXTAREAWITHTWOWILDCARDS;
}
protected:
const Unicode::UnicodeChar* wc1;
const Unicode::UnicodeChar* wc2;
};
Methods
getTextHeight()
@fn virtual int16_t TextAreaWithTwoWildcards::getTextHeight() Gets text height. Gets text height.
Read more...
draw() const
@fn virtual void TextAreaWithTwoWildcards::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...
setWildcard1()
@fn void TextAreaWithTwoWildcards::setWildcard1(const Unicode::UnicodeChar* value) Sets the first wildcard in the text. Sets the first wildcard in the text. Must be a zero-terminated UnicodeChar array.
Read more...
getWildcard1() const
@fn const Unicode::UnicodeChar* TextAreaWithTwoWildcards::getWildcard1() const Gets the first wildcard in the text. Gets the first wildcard in the text.
Read more...
setWildcard2()
@fn void TextAreaWithTwoWildcards::setWildcard2(const Unicode::UnicodeChar* value) Sets the second wildcard in the text. Sets the second wildcard in the text. Must be a zero-terminated UnicodeChar array.
Read more...
getWildcard2() const
@fn const Unicode::UnicodeChar* TextAreaWithTwoWildcards::getWildcard2() const Gets the second wildcard in the text. Gets the second wildcard in the text.
Read more...
getTextWidth() const
@fn virtual uint16_t TextAreaWithTwoWildcards::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 TextAreaWithTwoWildcards::getType() const For GUI testing only. For GUI testing only. Returns type of this drawable.
Read more...
Child classes
touchgfx::TextAreaWithTwoWildcards