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
VirtualKeys Class Reference

Class for a control that can be used to emulate key presses via touch inputs. More...

#include <VirtualKeys.h>

Inheritance diagram for VirtualKeys:
UIElement

Public Member Functions

 VirtualKeys (void(*onVirtualKeyPressed)(Keys_t key)=NULL)
 Constructor of the VirtualKeys.
 
void ShowVirtualKeys (UIElement *targetElement)
 Change the visual tree root to show the virtual keys with the given target element that will be edited.
 
void ExitVirtualKeys ()
 Exit the virtual keys and change the visual tree root back to the _previousVisualTreeRoot.
 
virtual void Draw (bool redraw) override
 Method used for drawing of the VirtualKeys.
 
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.
 
virtual void RecalculateLayout () override
 Recalculate the UIElement layout (containers update the X- and Y-Location of all their items, all other items can do other layout update stuff)
 
- 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.
 
bool HitTest (uint16_t x, uint16_t y)
 Check if the given point (x, y) is inside this UIElement.
 

Public Attributes

void(* OnVirtualKeyPressed )(Keys_t key)
 Function pointer for OnVirtualKeyPressed event.
 
- 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 Member Functions

void _handleButtonPress (Keys_t key)
 Method that is called whenever a button is pressed.
 

Static Private Member Functions

static void _onButton0Click (void *controlContext)
 
static void _onButton1Click (void *controlContext)
 
static void _onButton2Click (void *controlContext)
 
static void _onButton3Click (void *controlContext)
 
static void _onButton4Click (void *controlContext)
 
static void _onButton5Click (void *controlContext)
 
static void _onButton6Click (void *controlContext)
 
static void _onButton7Click (void *controlContext)
 
static void _onButton8Click (void *controlContext)
 
static void _onButton9Click (void *controlContext)
 
static void _onButtonLeftClick (void *controlContext)
 
static void _onButtonRightClick (void *controlContext)
 
static void _onButtonMilliClick (void *controlContext)
 
static void _onButtonKiloClick (void *controlContext)
 
static void _onButtonX1Click (void *controlContext)
 
static void _onButtonMinusClick (void *controlContext)
 
static void _onButtonUpClick (void *controlContext)
 
static void _onButtonOkClick (void *controlContext)
 
static void _onButtonDownClick (void *controlContext)
 
static void _onButtonExitVirtualKeysClick (void *controlContext)
 

Private Attributes

ContainerGrid _grid
 Grid used to combine all virtual keys.
 
ButtonControl _button0
 Virtual keys button 0.
 
ButtonControl _button1
 Virtual keys button 1.
 
ButtonControl _button2
 Virtual keys button 2.
 
ButtonControl _button3
 Virtual keys button 3.
 
ButtonControl _button4
 Virtual keys button 4.
 
ButtonControl _button5
 Virtual keys button 5.
 
ButtonControl _button6
 Virtual keys button 6.
 
ButtonControl _button7
 Virtual keys button 7.
 
ButtonControl _button8
 Virtual keys button 8.
 
ButtonControl _button9
 Virtual keys button 9.
 
ButtonControl _buttonLeft
 Virtual keys button Left.
 
ButtonControl _buttonRight
 Virtual keys button Right.
 
ButtonControl _buttonMilli
 Virtual keys button Milli.
 
ButtonControl _buttonKilo
 Virtual keys button Kilo.
 
ButtonControl _buttonX1
 Virtual keys button x1.
 
ButtonControl _buttonMinus
 Virtual keys button Minus.
 
ButtonControl _buttonUp
 Virtual keys button Up.
 
ButtonControl _buttonOk
 Virtual keys button Ok.
 
ButtonControl _buttonDown
 Virtual keys button Down.
 
ButtonControl _buttonExitVirtualKeys
 Virtual keys button Exit.
 
UIElement_targetElement
 UI_Element that is edited by the virtual keys.
 
UIElement_previousVisualTreeRoot
 Previous visual tree root.
 

Additional Inherited Members

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

Detailed Description

Class for a control that can be used to emulate key presses via touch inputs.

It displays one UI_Element that receives all emulated key presses and a matrix with many BoolControl elements to input key presses.

Constructor & Destructor Documentation

◆ VirtualKeys()

VirtualKeys::VirtualKeys ( void(* onVirtualKeyPressed )(Keys_t key) = NULL)

Constructor of the VirtualKeys.

Parameters
onVirtualKeyPressedFunction pointer for OnVirtualKeyPressed event

Member Function Documentation

◆ _handleButtonPress()

void VirtualKeys::_handleButtonPress ( Keys_t key)
private

Method that is called whenever a button is pressed.

Parameters
keyPressed key

◆ Draw()

void VirtualKeys::Draw ( bool redraw)
overridevirtual

Method used for drawing of the VirtualKeys.

Implements UIElement.

◆ KeyInput()

bool VirtualKeys::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
keyKey that should be processed. Supported keys are: KEYOK, KEYUP, KEYDOWN
Returns
true if the key was processed; false if not.

Reimplemented from UIElement.

◆ RecalculateDimensions()

void VirtualKeys::RecalculateDimensions ( )
overridevirtual

Recalculate the Height and Width of the UIElement.

Implements UIElement.

◆ RecalculateLayout()

void VirtualKeys::RecalculateLayout ( )
overridevirtual

Recalculate the UIElement layout (containers update the X- and Y-Location of all their items, all other items can do other layout update stuff)

Reimplemented from UIElement.

◆ ShowVirtualKeys()

void VirtualKeys::ShowVirtualKeys ( UIElement * targetElement)

Change the visual tree root to show the virtual keys with the given target element that will be edited.

Parameters
targetElementUI_Element that is edited by the virtual keys.

◆ TouchInput()

bool VirtualKeys::TouchInput ( uint16_t x,
uint16_t y,
TouchTypes touchType )
overridevirtual

Process a touch input at the given point (x, y)

Parameters
xX-Coordinate of the touched point
yY-Coordinate of the touched point
touchTypeType of the touch
Returns
true if the touch was processed; false if not.

Reimplemented from UIElement.

Member Data Documentation

◆ _previousVisualTreeRoot

UIElement* VirtualKeys::_previousVisualTreeRoot
private

Previous visual tree root.

This is used to change the visual tree root back on exit.


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