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
ButtonControl.h
Go to the documentation of this file.
1
5
6#ifndef BUTTONCONTROL_H_
7#define BUTTONCONTROL_H_
8
9#include "../Core/UIElement.h"
10
11#define DEFAULT_BUTTON_STRING_LENGTH 25
12
17{
18 private:
20
21 public:
23 void(*OnClick)(void* controlContext);
24
34 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);
35
40 {
41 delete _buttonText;
42 _buttonText = NULL;
43 }
44
48 virtual void Draw(bool redraw) override;
49
56 virtual bool KeyInput(Keys_t key) override;
57
65 virtual bool TouchInput(uint16_t x, uint16_t y, TouchTypes touchType) override;
66
70 virtual void RecalculateDimensions() override;
71};
72
73#endif /* BUTTONCONTROL_H_ */
#define DEFAULT_BUTTON_STRING_LENGTH
Default string length for the button text.
Definition ButtonControl.h:11
enum Keys Keys_t
Available input keys.
TouchTypes
Available touch types.
Definition TouchTypes.h:13
Containing the abstract base class for all user interface elements (controls, indicators,...
~ButtonControl()
Destructor of the ButtonControl.
Definition ButtonControl.h:39
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.
Definition ButtonControl.cpp:9
void * ControlContext
Context pointer that is returned with the _onClick function pointer.
Definition ButtonControl.h:22
virtual bool TouchInput(uint16_t x, uint16_t y, TouchTypes touchType) override
Process a touch input at the given point (x, y)
Definition ButtonControl.cpp:50
virtual void RecalculateDimensions() override
Recalculate the Height and Width of the UIElement.
Definition ButtonControl.cpp:60
char * _buttonText
Character buffer holding the string drawn by the button as text.
Definition ButtonControl.h:19
virtual void Draw(bool redraw) override
Method used for drawing of the ButtonControl.
Definition ButtonControl.cpp:18
virtual bool KeyInput(Keys_t key) override
Process the given key.
Definition ButtonControl.cpp:38
void(* OnClick)(void *controlContext)
Function pointer for _onClick event.
Definition ButtonControl.h:23
UIElement(UIElementType type)
Constructor of the UIElement.
Definition UIElement.h:43