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

Class for a tab control that is showing a tab layout and can hold child elements. More...

#include <ContainerTabs.h>

Inheritance diagram for ContainerTabs:
Container UIElement

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)
 
- Public Member Functions inherited from Container
 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.
 
UIElementGetSelectedItem ()
 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.
 
- 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

uint16_t TabRegionSize
 Width or height of the Tabs in pixel.
 
- 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 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

- Protected Attributes inherited from Container
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.
 
- Protected Attributes inherited from UIElement
bool _lastDrawnVisible
 The Visible value that was last drawn.
 

Detailed Description

Class for a tab control that is showing a tab layout and can hold child elements.

Constructor & Destructor Documentation

◆ ContainerTabs() [1/2]

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.

Parameters
widthDrawing width of the ContainerTabs
heightDrawing height of the ContainerTabs
tabPositionPosition of the tabs.
controlContextContext pointer that is returned with the _onSelectedTabChanged function pointer
onSelectedTabChangedFunction pointer for _onSelectedTabChanged event. This function is called when the selected tab is changed.
maxNumItemsMaximum number of items, each container can hold. Lower this value if you don't need that much items to save memory.
tabHeaderMarginMargin around the tab page tabs.

◆ ContainerTabs() [2/2]

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.

Parameters
locXX Location of the upper left corner of the ContainerTabs
locYY Location of the upper left corner of the ContainerTabs
widthDrawing width of the ContainerTabs
heightDrawing height of the ContainerTabs
tabPositionPosition of the tabs.
controlContextContext pointer that is returned with the _onSelectedTabChanged function pointer
onSelectedTabChangedFunction pointer for _onSelectedTabChanged event. This function is called when the selected tab is changed.
maxNumItemsMaximum number of items, each container can hold. Lower this value if you don't need that much items to save memory.
tabHeaderMarginMargin around the tab page tabs.

Member Function Documentation

◆ AddItem()

bool ContainerTabs::AddItem ( UIElement * header,
UIElement * tabContent )

Add a new tab to the tab control.

Parameters
headerTab page tab header UIElement.
tabContentPointer to the tab page content which can be of any UIElement.
Returns
true, if added; otherwise false (if container is full)

◆ Draw()

void ContainerTabs::Draw ( bool redraw)
overridevirtual

Method used for drawing of the ContainerTabs.

Implements UIElement.

◆ GetContentRegionSize()

void ContainerTabs::GetContentRegionSize ( uint16_t * w,
uint16_t * h )

Get the size of the content region of the ContainerTabs.

Parameters
wPointer used to give back the content region width
hPointer used to give back the content region height

◆ KeyInput()

bool ContainerTabs::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.
       @param key Key that should be processed. Supported keys are: KEYLEFT, KEYRIGHT

s *

Returns
true if the key was processed; false if not.

Reimplemented from Container.

◆ RecalculateDimensions()

void ContainerTabs::RecalculateDimensions ( )
overridevirtual

Recalculate the Height and Width of the UIElement.

Implements UIElement.

◆ RecalculateLayout()

void ContainerTabs::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.

◆ SelectTab()

void ContainerTabs::SelectTab ( int index)

Select the tab at the requested index (after range checking).

Parameters
indexIndex of the tab page that should be selected.

◆ TouchInput()

bool ContainerTabs::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

◆ _onSelectedTabChanged

void(* ContainerTabs::_onSelectedTabChanged) (void *controlContext)
private

Function pointer for _onSelectedTabChanged event.

This function is called when the selected tab is changed.


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