UI_Lib  a1366e08a59cc549a65fa26081e6409aa12f26d5
This is a user interface library for graphical LCDs. It offers many different controls and indicators that can be nested depending on the element types.
Loading...
Searching...
No Matches
Label Class Reference

Class for an Label indicator that is drawing a string to the screen. More...

#include <Label.h>

Inheritance diagram for Label:
UIElement

Public Member Functions

 Label (const char *text, uint16_t color=LABEL_COLOR_NOTSET, const GFXfont *font=NULL, uint16_t locX=0, uint16_t locY=0, uint16_t maxStringLength=DEFAULT_LABEL_STRING_LENGTH)
 Constructor of the Label.
 
 ~Label ()
 Destructor of the Label.
 
virtual void Draw (bool redraw) override
 Method used for drawing of the Label.
 
void SetText (const char *text)
 Change the string that is drawn to the screen by this Label.
 
virtual void RecalculateDimensions () override
 Recalculate the Height and Width of the UIElement.
 
- Public Member Functions inherited from UIElement
 UIElement (UIElementType type)
 Constructor of the UIElement.
 
 UIElement (uint16_t locX, uint16_t locY, UIElementType type)
 Constructor of the UIElement.
 
virtual bool KeyInput (Keys_t key)
 Process the given key.
 
virtual bool TouchInput (uint16_t x, uint16_t y, TouchTypes touchType)
 Process a touch input at the given point (x, y)
 
virtual void RecalculateLayout ()
 Recalculate the UIElement layout (containers update the X- and Y-Location of all their items, all other items can do other layout update stuff)
 
bool HitTest (uint16_t x, uint16_t y)
 Check if the given point (x, y) is inside this UIElement.
 

Public Attributes

char * Text
 Character buffer holding the string drawn by the Label.
 
bool WasTextChangedSinceLastDraw
 Flag indicating if the Text was changed since the last draw.
 
- Public Attributes inherited from UIElement
UIElementType Type
 Element type (control, indicator, container)
 
uint16_t LocX
 X Location of the upper left corner of the UIElement.
 
uint16_t LocY
 Y Location of the upper left corner of the UIElement.
 
uint16_t Width
 Drawing width of the UIElement.
 
uint16_t Height
 Drawing height of the UIElement.
 
bool Visible
 The UIElement is only drawn if the visibility is set to true.
 
bool IsInEditMode
 Is the UIElement in edit mode?
 
UIElementParent
 Parent UIElement that this UIElement belongs to.
 
UIElementActiveChild
 Child element that is currently active (receiving all key inputs).
 

Private Attributes

uint16_t _maxStringLength
 Maximum string length that the Label can hold.
 
const GFXfont * _font
 Font that is used to draw the Label.
 
uint16_t _color
 Text color that is used to draw the Label.
 

Additional Inherited Members

- Protected Attributes inherited from UIElement
bool _lastDrawnVisible
 The Visible value that was last drawn.
 

Detailed Description

Class for an Label indicator that is drawing a string to the screen.

Constructor & Destructor Documentation

◆ Label()

Label::Label ( const char * text,
uint16_t color = LABEL_COLOR_NOTSET,
const GFXfont * font = NULL,
uint16_t locX = 0,
uint16_t locY = 0,
uint16_t maxStringLength = DEFAULT_LABEL_STRING_LENGTH )

Constructor of the Label.

Parameters
textString that is draw to the screen by the label.
colorText color that is used to draw the Label. The color is only used to draw this Label. All other UIElements are using the default color again.
fontFont that is used to draw the Label. The font is only used to draw this Label. All other UIElements are using the default font again.
locXX Location of the upper left corner of the Label
locYY Location of the upper left corner of the Label
maxStringLengthMaximum string length that the Label can hold. This is used as buffer length for the internal character buffer.

Member Function Documentation

◆ Draw()

void Label::Draw ( bool redraw)
overridevirtual

Method used for drawing of the Label.

Implements UIElement.

◆ RecalculateDimensions()

void Label::RecalculateDimensions ( )
overridevirtual

Recalculate the Height and Width of the UIElement.

Implements UIElement.

◆ SetText()

void Label::SetText ( const char * text)

Change the string that is drawn to the screen by this Label.

Parameters
textNew text string of the Label.

Member Data Documentation

◆ _color

uint16_t Label::_color
private

Text color that is used to draw the Label.

The color is only used to draw this Label. All other UIElements are using the default color again. Use values < 0 to use the UiManager.ColorForeground

◆ _font

const GFXfont* Label::_font
private

Font that is used to draw the Label.

The font is only used to draw this Label. All other UIElements are using the default font again.

◆ _maxStringLength

uint16_t Label::_maxStringLength
private

Maximum string length that the Label can hold.

This is used as buffer length for the internal character buffer.

◆ WasTextChangedSinceLastDraw

bool Label::WasTextChangedSinceLastDraw

Flag indicating if the Text was changed since the last draw.

This is set to true by the SetText() method and back to false after drawing.


The documentation for this class was generated from the following files: