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.
|
Class for a tab control that is showing a tab layout and can hold child elements. More...
#include <ContainerTabs.h>
Public Member Functions | |
ContainerTabs (uint16_t width, uint16_t height, TabPositions_t tabPosition=TAB_POSITION_LEFT, void *controlContext=NULL, void(*onSelectedTabChanged)(void *controlContext)=NULL, uint8_t maxNumItems=DEFAULT_MAX_ContainerTabs_TABS, uint8_t tabHeaderMargin=DEFAULT_ContainerTabs_TABHEADER_MARGIN) | |
Constructor of the ContainerTabs. | |
ContainerTabs (uint16_t locX, uint16_t locY, uint16_t width, uint16_t height, TabPositions_t tabPosition=TAB_POSITION_LEFT, void *controlContext=NULL, void(*onSelectedTabChanged)(void *controlContext)=NULL, uint8_t maxNumItems=DEFAULT_MAX_ContainerTabs_TABS, uint8_t tabHeaderMargin=DEFAULT_ContainerTabs_TABHEADER_MARGIN) | |
Constructor of the ContainerTabs. | |
~ContainerTabs () | |
Destructor of the ContainerTabs. | |
virtual void | Draw (bool redraw) override |
Method used for drawing of the ContainerTabs. | |
virtual bool | KeyInput (Keys_t key) override |
virtual bool | TouchInput (uint16_t x, uint16_t y, TouchTypes touchType) override |
Process a touch input at the given point (x, y) | |
bool | AddItem (UIElement *header, UIElement *tabContent) |
Add a new tab to the tab control. | |
void | SelectTab (int index) |
Select the tab at the requested index (after range checking). | |
int | GetSelectedTabIndex () |
Return the value of the selected tab index. | |
void | GetContentRegionSize (uint16_t *w, uint16_t *h) |
Get the size of the content region of the ContainerTabs. | |
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) | |
![]() | |
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. | |
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. | |
bool | HitTest (uint16_t x, uint16_t y) |
Check if the given point (x, y) is inside this UIElement. | |
Public Attributes | |
uint16_t | TabRegionSize |
Width or height of the Tabs in pixel. | |
![]() | |
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). | |
Private Attributes | |
UIElement ** | _headers |
Array with all tab page tab header elements. | |
uint8_t | _lastDrawnTabIndex |
Index of the last drawn tab. | |
TabPositions_t | _tabPosition |
Position of the tabs. | |
uint8_t | _tabHeaderMargin |
Margin around the tab page tabs. | |
void * | _controlContext |
Context pointer that is returned with the _onSelectedTabChanged function pointer. | |
void(* | _onSelectedTabChanged )(void *controlContext) |
Function pointer for _onSelectedTabChanged event. | |
Additional Inherited Members | |
![]() | |
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. | |
Class for a tab control that is showing a tab layout and can hold child elements.
ContainerTabs::ContainerTabs | ( | uint16_t | width, |
uint16_t | height, | ||
TabPositions_t | tabPosition = TAB_POSITION_LEFT, | ||
void * | controlContext = NULL, | ||
void(* | onSelectedTabChanged )(void *controlContext) = NULL, | ||
uint8_t | maxNumItems = DEFAULT_MAX_ContainerTabs_TABS, | ||
uint8_t | tabHeaderMargin = DEFAULT_ContainerTabs_TABHEADER_MARGIN ) |
Constructor of the ContainerTabs.
width | Drawing width of the ContainerTabs |
height | Drawing height of the ContainerTabs |
tabPosition | Position of the tabs. |
controlContext | Context pointer that is returned with the _onSelectedTabChanged function pointer |
onSelectedTabChanged | Function pointer for _onSelectedTabChanged event. This function is called when the selected tab is changed. |
maxNumItems | Maximum number of items, each container can hold. Lower this value if you don't need that much items to save memory. |
tabHeaderMargin | Margin around the tab page tabs. |
ContainerTabs::ContainerTabs | ( | uint16_t | locX, |
uint16_t | locY, | ||
uint16_t | width, | ||
uint16_t | height, | ||
TabPositions_t | tabPosition = TAB_POSITION_LEFT, | ||
void * | controlContext = NULL, | ||
void(* | onSelectedTabChanged )(void *controlContext) = NULL, | ||
uint8_t | maxNumItems = DEFAULT_MAX_ContainerTabs_TABS, | ||
uint8_t | tabHeaderMargin = DEFAULT_ContainerTabs_TABHEADER_MARGIN ) |
Constructor of the ContainerTabs.
locX | X Location of the upper left corner of the ContainerTabs |
locY | Y Location of the upper left corner of the ContainerTabs |
width | Drawing width of the ContainerTabs |
height | Drawing height of the ContainerTabs |
tabPosition | Position of the tabs. |
controlContext | Context pointer that is returned with the _onSelectedTabChanged function pointer |
onSelectedTabChanged | Function pointer for _onSelectedTabChanged event. This function is called when the selected tab is changed. |
maxNumItems | Maximum number of items, each container can hold. Lower this value if you don't need that much items to save memory. |
tabHeaderMargin | Margin around the tab page tabs. |
|
overridevirtual |
Method used for drawing of the ContainerTabs.
Implements UIElement.
void ContainerTabs::GetContentRegionSize | ( | uint16_t * | w, |
uint16_t * | h ) |
Get the size of the content region of the ContainerTabs.
w | Pointer used to give back the content region width |
h | Pointer used to give back the content region height |
|
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. @param key Key that should be processed. Supported keys are: KEYLEFT, KEYRIGHT
s *
Reimplemented from Container.
|
overridevirtual |
|
overridevirtual |
void ContainerTabs::SelectTab | ( | int | index | ) |
Select the tab at the requested index (after range checking).
index | Index of the tab page that should be selected. |
|
overridevirtual |
Process a touch input at the given point (x, y)
x | X-Coordinate of the touched point |
y | Y-Coordinate of the touched point |
touchType | Type of the touch |
Reimplemented from UIElement.
|
private |
Function pointer for _onSelectedTabChanged event.
This function is called when the selected tab is changed.