UiUiUi
A user interface library for micro controller sketches based on U8g2
|
A widget containing a line of text which is set dynamically during runtime using setText(). More...
#include <UITextLine.h>
Public Member Functions | |
UITextLine (const uint8_t *font, UIAlignment alignment, bool useUTF8=false, UIWidget *next=nullptr) | |
Create a text line with the given font and alignment and a potential successor. | |
UITextLine (const uint8_t *font, UIAlignment alignment, UIWidget *next) | |
Create a text line with the given font and alignment, not using UTF8 and a potential successor. | |
UITextLine (const uint8_t *font, bool useUTF8, UIWidget *next=nullptr) | |
Create a text line with the given font, centered alignment, the given UTF8 flag and a potential successor. | |
UITextLine (const uint8_t *font, UIWidget *next) | |
Create a text line with the given font, centered alignment and a potential successor. | |
UITextLine (const uint8_t *font) | |
Create a text line with the given font and no successor. | |
void | setText (const char *text) |
Set the text of the text line. More... | |
void | clearText () |
Clear the text in this text line. | |
void | updateText () |
Insist that on the next render() call, the text line will update its content. More... | |
UIArea * | render (U8G2 *display, bool force) |
Render the text line. More... | |
![]() | |
UISize | preferredSize (U8G2 *display) |
Return the preferred size of this widget, will be called before a call to layout(). More... | |
virtual void | layout (U8G2 *display, UIArea *area) |
Layout widget in the given rectanglar area, will be called before first call to render(). More... | |
virtual UIArea * | render (U8G2 *display, bool force)=0 |
Render component in the space given in layout(). More... | |
virtual void | setParent (UIParent *parent) |
Set the parent widget group (if it exists). More... | |
Protected Member Functions | |
void | computePreferredSize (U8G2 *display, UISize *preferredSize) |
Generate the preferred size from the font size. More... | |
![]() | |
UIWidget (UIWidget *next=nullptr) | |
Initialize this widget and potentially set its successor. | |
void | clearBox (U8G2 *display, UIArea *dimm) |
Clear the given area. | |
void | clearFull (U8G2 *display) |
Clear the full area of this widget. | |
void | clip (U8G2 *display) |
Set U8g2's clip window to the area of this widget, should be called from render(). | |
virtual void | computePreferredSize (U8G2 *display, UISize *preferredSize)=0 |
Store preferred size of this widget into the preferredSize reference. More... | |
void | signalNeedsRendering () |
Called internally: Signals to parent that this widget needs to be rendered. | |
Protected Attributes | |
const uint8_t * | font |
The font of this text line. | |
![]() | |
UIArea | dim |
Actual area of this widget, set in layout(). | |
UIParent * | parent |
Reference to the group this widget is connected to. | |
Additional Inherited Members | |
![]() | |
UIWidget * | next |
Pointer to the next widget on the same level. | |
A widget containing a line of text which is set dynamically during runtime using setText().
Height is derived from the assigned font. Width is "as wide as possible". The text line keeps track of its former rendered content and will clear only the portion of its area which has to be cleaned.
A text line can align itself according to the Alignment possibilities. You do not need to enclose it in a UIEnvelope.
|
protectedvirtual |
Generate the preferred size from the font size.
Implements UIWidget.
|
virtual |
Render the text line.
This method is carefully designed so that it only draws and changes those parts of the display which actually have to be changed.
Implements UIWidget.
void UITextLine::setText | ( | const char * | text | ) |
Set the text of the text line.
This method can be called dynamically at any time. It's the heart of the text line (and of the dynamic behaviour of UiUiUi generally...)
void UITextLine::updateText | ( | ) |
Insist that on the next render() call, the text line will update its content.
Use this if you use a static text field which you update from outside so that the setText() change detection does not work.
You should use setText() only once and clearText() never in this setup.