|
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.
|
Class for a numeric indicator that is only showing a numeric variable value. More...
#include <NumericIndicator.h>
Public Member Functions | |
| NumericIndicator (T *valuePointer, const char *baseUnit, T maxValue, unsigned char numFractionalDigits, uint16_t locX=0, uint16_t locY=0, uint8_t maxStringBufferLength=DEFAULT_NUMERIC_INDICATOR_STRING_LENGTH) | |
| Constructor of the NumericIndicator. | |
| ~NumericIndicator () | |
| Destructor of the NumericIndicator. | |
| virtual void | Draw (bool redraw) override |
| Method used for drawing of the NumericIndicator. | |
| 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. | |
Protected Attributes | |
| const char * | _baseUnit |
| Base unit that is appended to the calculated prefix. | |
| T * | _valuePointer |
| Pointer to the numeric variable that is shown by this indicator. | |
| T | _lastValueDraw |
| Last drawn numeric value. | |
| T | _maxValue |
| Maximum value that can be shown by this numeric indicator. | |
| uint8_t | _numFractionalDigits |
| Number of fractional digits that are shown by this indicator. | |
| uint8_t | _numDigits |
| Number of digits calculated from the maxValue (_numFractionalDigits + numNonFractionalDigits). | |
| float | _displayValue |
| Value that is displayed by Draw(). | |
| int8_t | _unitPrefixPower |
| Current display prefix power (m = -3, k = 3, M = 6) | |
Protected Attributes inherited from UIElement | |
| bool | _lastDrawnVisible |
| The Visible value that was last drawn. | |
Private Member Functions | |
| void | calculateDisplayValue (float value) |
| Calculate the _displayValue and the _unitPrefix from the given value. | |
| uint8_t | numNonFractionalDigits (T number) |
| Calculate the number of non-fractional digits of the given number. | |
Private Attributes | |
| const char * | _unitPrefix |
| Current display prefix character ("m", "k", "M") | |
| char * | _stringDrawBuffer |
| Buffer holding the string that is drawn to the screen. | |
Additional Inherited Members | |
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? | |
| UIElement * | Parent |
| Parent UIElement that this UIElement belongs to. | |
| UIElement * | ActiveChild |
| Child element that is currently active (receiving all key inputs). | |
Class for a numeric indicator that is only showing a numeric variable value.
| T | Type of numeric variable handled by this indicator. This can be e.g. float or int. |
| NumericIndicator< T >::NumericIndicator | ( | T * | valuePointer, |
| const char * | baseUnit, | ||
| T | maxValue, | ||
| unsigned char | numFractionalDigits, | ||
| uint16_t | locX = 0, | ||
| uint16_t | locY = 0, | ||
| uint8_t | maxStringBufferLength = DEFAULT_NUMERIC_INDICATOR_STRING_LENGTH ) |
Constructor of the NumericIndicator.
| valuePointer | Pointer to the numeric variable that is shown by this indicator. |
| baseUnit | Base unit that is appended to the calculated prefix. E.g. "V" for voltage values. To use the "%" sign as unit, you have to use "%%" as string. |
| maxValue | Maximum value that can be shown by this numeric indicator. It is used to determine the number of non-fractional digits. |
| numFractionalDigits | Number of fractional digits that are shown by this indicator. E.g. 1.234 V has 3 fractional digits. |
| locX | X Location of the upper left corner of the NumericIndicator |
| locY | Y Location of the upper left corner of the NumericIndicator |
| maxStringBufferLength | Length for the internally used _stringDrawBuffer. Make sure this is large enough to hold all character displayed by this element + 1 termination character '\0' (e.g. "1234.56mV" needs at least a length of 10; 9 characters + 1 termination character). |
|
overridevirtual |
Method used for drawing of the NumericIndicator.
Implements UIElement.
Reimplemented in NumericControl< T >.
|
private |
Calculate the number of non-fractional digits of the given number.
|
overridevirtual |
Recalculate the Height and Width of the UIElement.
Implements UIElement.
Reimplemented in NumericControl< T >.
|
protected |
Base unit that is appended to the calculated prefix.
E.g. "V" for voltage values. To use the "%" sign as unit, you have to use "%%" as string.
|
protected |
Value that is displayed by Draw().
E.g. 999.760 if control value is 999760 Hz.
|
protected |
Last drawn numeric value.
Only if the _valueDraw differs from this value, the _stringDrawBuffer is recalculated and the indicator redrawn.
|
protected |
Maximum value that can be shown by this numeric indicator.
It is used to determine the number of non-fractional digits.
|
protected |
Number of fractional digits that are shown by this indicator.
E.g. 1.234 V has 3 fractional digits.
|
private |
Buffer holding the string that is drawn to the screen.
This is only recalculated on the firstPage and if the value has changed. char stringBufferLen = _numDigits + 1 + strlen(_unitPrefix) + strlen(_baseUnit) + 1;