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.
|
Base class for container elements. More...
#include <Container.h>
Public Member Functions | |
Container (uint8_t maxNumItems=DEFAULT_MAX_CONTAINER_ITEMS) | |
Constructor of the Container. | |
~Container () | |
Destructor of the Container. | |
virtual void | Draw () |
Virtual method used for drawing of the container UIElement. | |
virtual bool | KeyInput (Keys_t key) |
Process the given key. | |
UIElement * | GetSelectedItem () |
Get the selected item. | |
bool | AddItem (UIElement *item) |
Add a new element to the container and activate it as active child. | |
void | ClearAllItems () |
Clear all items in the container. | |
bool | NextItem () |
Select the next item in the container. | |
bool | PreviousItem () |
Select the previous item in the container. | |
bool | NextControlItem () |
Select the next item in the container that is of UI_CONTROL type. | |
bool | PreviousControlItem () |
Select the previous item in the container that is of UI_CONTROL type. | |
void | GetItemsBoundingBox (uint16_t *x, uint16_t *y, uint16_t *w, uint16_t *h) |
Get a bounding box around all items in the Container. | |
![]() | |
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 | 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. | |
Protected Attributes | |
uint8_t | _maxNumItems |
Maximum number of items, each container can hold. | |
UIElement ** | _items |
Array holding pointers to all UIElement that are items of the container. | |
uint8_t | _numItems |
Number of items in the container (number of valid items in the _items array). | |
uint8_t | _selectedItemIndex |
Index of the selected container item. | |
![]() | |
bool | _lastDrawnVisible |
The Visible value that was last drawn. | |
Additional Inherited Members | |
![]() | |
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). | |
Base class for container elements.
Container::Container | ( | uint8_t | maxNumItems = DEFAULT_MAX_CONTAINER_ITEMS | ) |
Constructor of the Container.
maxNumItems | Maximum number of items, each container can hold. Lower this value if you don't need that much items to save memory. |
bool Container::AddItem | ( | UIElement * | item | ) |
Add a new element to the container and activate it as active child.
item | Pointer to the UIElement that should be added to the container. |
void Container::GetItemsBoundingBox | ( | uint16_t * | x, |
uint16_t * | y, | ||
uint16_t * | w, | ||
uint16_t * | h ) |
Get a bounding box around all items in the Container.
x | X coordinate of the upper left corner of the bounding box |
y | Y coordinate of the upper left corner of the bounding box |
w | Width of the bounding box |
h | Height of the bounding box |
UIElement * Container::GetSelectedItem | ( | ) |
|
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 container 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.
key | Key that should be processed. |
Reimplemented from UIElement.
Reimplemented in ContainerGrid, ContainerList, ContainerPage, ContainerStack, and ContainerTabs.
bool Container::NextControlItem | ( | ) |
Select the next item in the container that is of UI_CONTROL type.
bool Container::NextItem | ( | ) |
Select the next item in the container.
bool Container::PreviousControlItem | ( | ) |
Select the previous item in the container that is of UI_CONTROL type.
bool Container::PreviousItem | ( | ) |
Select the previous item in the container.
|
protected |
Maximum number of items, each container can hold.
Lower this value if you don't need that much items to save memory.