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
UIElement Class Referenceabstract

Abstract base class for all user interface elements (controls, indicators, containers). More...

#include <UIElement.h>

Inheritance diagram for UIElement:
BoolControl BoolIndicator ButtonControl Container EnumIndicator< T > Icon Label MessageDialog NumericIndicator< T > ProgressBar< T > VirtualKeys

Public Member Functions

 UIElement (UIElementType type)
 Constructor of the UIElement.
 
 UIElement (uint16_t locX, uint16_t locY, UIElementType type)
 Constructor of the UIElement.
 
virtual void Draw (bool redraw)=0
 Virtual method used for drawing 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 RecalculateDimensions ()=0
 Recalculate the Height and Width 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

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).
 

Protected Attributes

bool _lastDrawnVisible
 The Visible value that was last drawn.
 

Detailed Description

Abstract base class for all user interface elements (controls, indicators, containers).

Constructor & Destructor Documentation

◆ UIElement() [1/2]

UIElement::UIElement ( UIElementType type)
inline

Constructor of the UIElement.

Parameters
typeElement type (control, indicator, container)

◆ UIElement() [2/2]

UIElement::UIElement ( uint16_t locX,
uint16_t locY,
UIElementType type )
inline

Constructor of the UIElement.

Parameters
locXX Location of the upper left corner of the UIElement
locYY Location of the upper left corner of the UIElement
typeElement type (control, indicator, container)

Member Function Documentation

◆ Draw()

virtual void UIElement::Draw ( bool redraw)
pure virtual

Virtual method used for drawing of the UIElement.

This method must be overwritten in all derived classes. Use the UiManager.Gfx object for drawing.

Implemented in BoolControl, BoolIndicator, ButtonControl, ContainerGrid, ContainerList, ContainerPage, ContainerStack, ContainerTabs, EnumControl< T >, EnumIndicator< T >, Icon, Label, MessageDialog, NumericControl< T >, NumericIndicator< T >, ProgressBar< T >, and VirtualKeys.

◆ HitTest()

bool UIElement::HitTest ( uint16_t x,
uint16_t y )
inline

Check if the given point (x, y) is inside this UIElement.

Parameters
xX-Coordinate of the point to test
yY-Coordinate of the point to test
Returns
true, if the given point is inside the UIElement (including the frame) and the element is visible; otherwise false

◆ KeyInput()

virtual bool UIElement::KeyInput ( Keys_t key)
inlinevirtual

Process the given key.

This method can be overwritten in all derived classes. If it's not overwritten, no keys are supported by the UIElement. 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.
Returns
true if the key was processed; false if not.

Reimplemented in BoolControl, ButtonControl, Container, ContainerGrid, ContainerList, ContainerPage, ContainerStack, ContainerTabs, EnumControl< T >, MessageDialog, NumericControl< T >, and VirtualKeys.

◆ RecalculateDimensions()

virtual void UIElement::RecalculateDimensions ( )
pure virtual

◆ RecalculateLayout()

virtual void UIElement::RecalculateLayout ( )
inlinevirtual

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 in ContainerGrid, ContainerList, ContainerPage, ContainerStack, ContainerTabs, MessageDialog, ProgressBar< T >, and VirtualKeys.

◆ TouchInput()

virtual bool UIElement::TouchInput ( uint16_t x,
uint16_t y,
TouchTypes touchType )
inlinevirtual

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 in BoolControl, ButtonControl, ContainerGrid, ContainerList, ContainerPage, ContainerStack, ContainerTabs, EnumControl< T >, MessageDialog, NumericControl< T >, and VirtualKeys.

Member Data Documentation

◆ _lastDrawnVisible

bool UIElement::_lastDrawnVisible
protected

The Visible value that was last drawn.

Used to detect changes in the Visible property.

◆ ActiveChild

UIElement* UIElement::ActiveChild

Child element that is currently active (receiving all key inputs).

This property is only set for elements that contain children (mostly containers). Simple controls or indicators should set this to NULL.

◆ IsInEditMode

bool UIElement::IsInEditMode

Is the UIElement in edit mode?

This property is only used by some controls. Use the UI_Manager::UpdateIsInEditModeElement() method to change this value to make sure, only one UIElement has this property set to true!


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