Class for a button control that is showing a clickable button used to trigger some action.
More...
#include <ButtonControl.h>
|
| ButtonControl (const char *buttonText, void *controlContext=NULL, void(*onClick)(void *controlContext)=NULL, uint16_t locX=0, uint16_t locY=0, int maxStringLength=DEFAULT_BUTTON_STRING_LENGTH) |
| Constructor of the ButtonControl.
|
|
| ~ButtonControl () |
| Destructor of the ButtonControl.
|
|
virtual void | Draw (bool redraw) override |
| Method used for drawing of the ButtonControl.
|
|
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)
|
|
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.
|
|
|
void * | ControlContext |
| Context pointer that is returned with the _onClick function pointer.
|
|
void(* | OnClick )(void *controlContext) |
| Function pointer for _onClick 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).
|
|
|
char * | _buttonText |
| Character buffer holding the string drawn by the button as text.
|
|
Class for a button control that is showing a clickable button used to trigger some action.
◆ ButtonControl()
ButtonControl::ButtonControl |
( |
const char * | buttonText, |
|
|
void * | controlContext = NULL, |
|
|
void(* | onClick )(void *controlContext) = NULL, |
|
|
uint16_t | locX = 0, |
|
|
uint16_t | locY = 0, |
|
|
int | maxStringLength = DEFAULT_BUTTON_STRING_LENGTH ) |
Constructor of the ButtonControl.
- Parameters
-
buttonText | String that is draw to the screen as button text. |
controlContext | Context pointer that is returned with the _onClick function pointer |
onClick | Function pointer for _onClick event. This function is called when the button is clicked. |
locX | X Location of the upper left corner of the ButtonControl |
locY | Y Location of the upper left corner of the ButtonControl |
maxStringLength | Maximum string length that the button text can hold. This is used as buffer length for the internal _buttonText character buffer. |
◆ Draw()
void ButtonControl::Draw |
( |
bool | redraw | ) |
|
|
overridevirtual |
◆ KeyInput()
bool ButtonControl::KeyInput |
( |
Keys_t | key | ) |
|
|
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.
- Parameters
-
key | Key that should be processed. Supported keys are: KEYOK |
- Returns
- true if the key was processed; false if not.
Reimplemented from UIElement.
◆ RecalculateDimensions()
void ButtonControl::RecalculateDimensions |
( |
| ) |
|
|
overridevirtual |
◆ TouchInput()
bool ButtonControl::TouchInput |
( |
uint16_t | x, |
|
|
uint16_t | y, |
|
|
TouchTypes | touchType ) |
|
overridevirtual |
Process a touch input at the given point (x, y)
- Parameters
-
x | X-Coordinate of the touched point |
y | Y-Coordinate of the touched point |
touchType | Type of the touch |
- Returns
- true if the touch was processed; false if not.
Reimplemented from UIElement.
◆ OnClick
void(* ButtonControl::OnClick) (void *controlContext) |
Function pointer for _onClick event.
This function is called when the button is clicked.
The documentation for this class was generated from the following files:
- /github/workspace/include/Controls/ButtonControl.h
- /github/workspace/src/Controls/ButtonControl.cpp