Overlay Text Element
// Overlay text element.
class RVAPI TextElem
{
public:
// Get text and store in [string].
wcstr GetText(String &string) const;
// Get text element boundary rectangle using parent rectangle [pRect].A zero [pRect]
// uses the window rectangle.
B2i GetRect(const B2i &pRect) const;
// Get meta position.
const MetaPos &GetMetaPos() const;
// Get x position of character at [cn].
uint GetCharX(int cn) const;
// Get character at x position.
uint GetCharN(uint cx) const;
// Get character.
uint GetLen() const;
// Check if text element has any text.
bool operator ! () const;
// Get character.
wchar operator [] (int n) const;
// Draw text. [pRect] is parent rectangle for resolving meta position. [stateColor] is multiplied
// with text color and can be a literal color or the state color returned from UI events object.
void Draw(const B2i &pRect, const Color &stateColor = Color(1)) const;
// Show/hide element.
void Show(bool show = true);
// Add text using named font or 0 for default.
void AddText(wcstr text, uint fontID = 0, const Color &color = Color(1));
// Clear text.
void Clear();
// Set color. Start color change at [start] character and end at [end] character.
void SetColor(const Color &color, int start = 0, int end = -1);
// Set meta position.
void SetMetaPos(const MetaPos &metaPos);
// Internal.
void *operator () () const { return (void *)wobj; }
// Construct text element at [z] order. Higher z overlays lower z. Set [incr] to estimated max
// number of characters.
TextElem(uint z, uint incr = 64);
// Destructor.
~TextElem();
private:
byte wobj[128];
};