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 boolean control that is showing a boolean variable value and offers the possibility to toggle the value. More...
#include <BoolControl.h>
Public Member Functions | |
BoolControl (bool *valuePointer, void *controlContext=NULL, void(*onValueChanged)(void *controlContext)=NULL, BoolControlStyles_t style=BOOLCONTROL_STYLE_TOGGLESWITCH, uint16_t locX=0, uint16_t locY=0) | |
Constructor of the BoolControl. | |
virtual void | Draw (bool redraw) override |
Method used for drawing of the BoolControl. | |
virtual bool | KeyInput (Keys_t key) override |
Process the given key. | |
virtual bool | TouchInput (uint16_t x, uint16_t y, TouchTypes touchType) override |
Process a touch input at the given point (x, y) | |
void | ToggleValue () |
Toggle the value of the boolean variable referenced by the valuePointer. | |
virtual void | RecalculateDimensions () override |
Recalculate the Height and Width of the UIElement. | |
![]() | |
UIElement (UIElementType type) | |
Constructor of the UIElement. | |
UIElement (uint16_t locX, uint16_t locY, UIElementType type) | |
Constructor of the UIElement. | |
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 | |
void * | ControlContext |
Context pointer that is returned with the OnValueChanged function pointer. | |
void(* | OnValueChanged )(void *controlContext) |
Function pointer for OnValueChanged event. | |
![]() | |
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). | |
Protected Attributes | |
bool * | _valuePointer |
Pointer to the boolean variable that is shown by this control. | |
bool | _lastValueDraw |
Last drawn bool value. | |
BoolControlStyles_t | _style |
Style used by the boolean control. | |
![]() | |
bool | _lastDrawnVisible |
The Visible value that was last drawn. | |
Class for a boolean control that is showing a boolean variable value and offers the possibility to toggle the value.
BoolControl::BoolControl | ( | bool * | valuePointer, |
void * | controlContext = NULL, | ||
void(* | onValueChanged )(void *controlContext) = NULL, | ||
BoolControlStyles_t | style = BOOLCONTROL_STYLE_TOGGLESWITCH, | ||
uint16_t | locX = 0, | ||
uint16_t | locY = 0 ) |
Constructor of the BoolControl.
valuePointer | Pointer to the boolean variable that is shown and manipulated by this control. |
controlContext | Context pointer that is returned with the OnValueChanged function pointer |
onValueChanged | Function pointer for OnValueChanged event. This function is called when the value of the valuePointer is changed. |
style | Style used by the boolean control. |
locX | X Location of the upper left corner of the BoolControl |
locY | Y Location of the upper left corner of the BoolControl |
|
overridevirtual |
Method used for drawing of the BoolControl.
Implements UIElement.
|
overridevirtual |
Process the given key.
If this element doesn't support the key type, the key is forwarded to the parent. This is done until the key is processed or the root of the visual tree is reached.
key | Key that should be processed. Supported keys are: KEYOK |
Reimplemented from UIElement.
|
overridevirtual |
|
overridevirtual |
Process a touch input at the given point (x, y)
x | X-Coordinate of the touched point |
y | Y-Coordinate of the touched point |
touchType | Type of the touch |
Reimplemented from UIElement.
|
protected |
Last drawn bool value.
Only if the _valuePointer value differs from this value, the control is redrawn.
void(* BoolControl::OnValueChanged) (void *controlContext) |
Function pointer for OnValueChanged event.
This function is called when the value of the valuePointer is changed.