Defines a simple text box for displaying dynamic text onto a Canvas. More...
#include <TextBox.h>
Public Types | |
| enum | TextAlign { LEFT , CENTER , RIGHT } |
| Enumeration used to specify text alignment within the DynamicText. More... | |
Public Member Functions | |
| DynamicText (Canvas &DestCanvas, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t baseline, FontList::FontID Font, TextAlign align=CENTER) | |
| DynamicText Constructor. | |
| virtual void | begin (void) |
| Initializes the DynamicText. This method must be called before using calling DynamicText::update() | |
| virtual void | align (TextAlign align) |
| Changes the text alignment. Takes effect after next call to DynamicText::update() | |
| void | update (const char *text, uint16_t textBuffSize) |
| Updates the text inside a DynamicText. | |
| void | update (int value) |
| Updates the numerical value (int) inside a DynamicText. | |
Public Attributes | |
| const uint16_t | X |
| UL x position of the text box within _DestCanvas. | |
| const uint16_t | Y |
| UL y position of the text box within _DestCanvas. | |
| const uint16_t | WIDTH |
| Width of the text box within _DestCanvas. | |
| const uint16_t | HEIGHT |
| Height of the text box within _DestCanvas. | |
Defines a simple text box for displaying dynamic text onto a Canvas.
Before attempting to use this class, the caller must do two things. First the caller must fully initialize the font object provided to the DynamicText constructor. This means instantiating the GrFont object followed by a call to the GrFont::begin(), which loads and colorizes the fonts. Second, the caller must call the DynamicText::begin() method after object instantiation.
Enumeration used to specify text alignment within the DynamicText.
| Enumerator | |
|---|---|
| LEFT | |
| CENTER | |
| RIGHT | |
|
inline |
DynamicText Constructor.
| [in] | DestCanvas | Canvas that will 'display' the DynamicText |
| [in] | x | UL x-position of the DynamicText within Canvas |
| [in] | y | UL y-position of the DynamicText within Canvas |
| [in] | width | Width of the DynamicText in pixels |
| [in] | height | Height of the DynamicText in pixels |
| [in] | baseline | Position of the font's baseline within the DynamicText |
| [in] | Font | GrFont object to be used |
| [in] | align | Alignment of the text within the box. Defaults to DynamicText::CENTER. |
|
inlinevirtual |
Changes the text alignment. Takes effect after next call to DynamicText::update()
| [in] | align | Text alignment |
|
virtual |
Initializes the DynamicText. This method must be called before using calling DynamicText::update()
| void DynamicText::update | ( | const char * | text, |
| uint16_t | textBuffSize ) |
Updates the text inside a DynamicText.
| [in] | text | Null-terminated character array containing the text |
| [in] | textBuffSize | Number of characters in text |
| void DynamicText::update | ( | int | value | ) |
Updates the numerical value (int) inside a DynamicText.
| [in] | value | Value to be written to DynamicText |
| const uint16_t DynamicText::HEIGHT |
Height of the text box within _DestCanvas.
| const uint16_t DynamicText::WIDTH |
Width of the text box within _DestCanvas.
| const uint16_t DynamicText::X |
UL x position of the text box within _DestCanvas.
| const uint16_t DynamicText::Y |
UL y position of the text box within _DestCanvas.