6#ifndef CONTAINERGRID_H_
7#define CONTAINERGRID_H_
11#define DEFAULT_MAX_CONTAINERGRID_ROWS 10
12#define DEFAULT_MAX_CONTAINERGRID_COLUMNS 10
95 virtual void Draw(
bool redraw)
override;
126 bool SetRowHeight(uint8_t rowIndex, uint16_t rowHeight);
Containing the base class for container elements.
#define DEFAULT_MAX_CONTAINER_ITEMS
Default maximum number of items, each container can hold.
Definition Container.h:11
#define DEFAULT_MAX_CONTAINERGRID_COLUMNS
Default maximum number of columns, each container grid can hold.
Definition ContainerGrid.h:12
enum GridCellAlignment GridCellAlignment_t
Available alignment in cell.
#define DEFAULT_MAX_CONTAINERGRID_ROWS
Default maximum number of rows, each container grid can hold.
Definition ContainerGrid.h:11
GridCellAlignment
Available alignment in cell.
Definition ContainerGrid.h:18
@ GRID_CELL_ALIGNMENT_TOP_LEFT
Alignment top left.
Definition ContainerGrid.h:19
@ GRID_CELL_ALIGNMENT_MIDDLE
Alignment middle.
Definition ContainerGrid.h:23
@ GRID_CELL_ALIGNMENT_TOP_RIGHT
Alignment top right.
Definition ContainerGrid.h:25
@ GRID_CELL_ALIGNMENT_BOTTOM_LEFT
Alignment bottom left.
Definition ContainerGrid.h:21
@ GRID_CELL_ALIGNMENT_TOP
Alignment top.
Definition ContainerGrid.h:22
@ GRID_CELL_ALIGNMENT_LEFT
Alignment left.
Definition ContainerGrid.h:20
@ GRID_CELL_ALIGNMENT_BOTTOM_RIGHT
Alignment bottom right.
Definition ContainerGrid.h:27
@ GRID_CELL_ALIGNMENT_BOTTOM
Alignment bottom.
Definition ContainerGrid.h:24
@ GRID_CELL_ALIGNMENT_RIGHT
Alignment right.
Definition ContainerGrid.h:26
enum Keys Keys_t
Available input keys.
TouchTypes
Available touch types.
Definition TouchTypes.h:13
uint8_t _maxGridColumns
Maximum number of columns, each container grid can hold.
Definition ContainerGrid.h:50
GridItemConfig * _itemConfiguration
Configuration data for all items inside the grid.
Definition ContainerGrid.h:57
uint16_t * _initialColumnWidths
Widths for the individual columns.
Definition ContainerGrid.h:54
void InitItems()
This method selects the first UIElement in the container that is of UI_CONTROL type.
Definition ContainerGrid.cpp:96
bool _autoSizingFillLast
If true, keep all columns or rows as small as possible except the last one set to auto size; if false...
Definition ContainerGrid.h:52
virtual void RecalculateDimensions() override
Recalculate the Height and Width of the UIElement.
Definition ContainerGrid.cpp:139
uint8_t _maxGridRows
Maximum number of rows, each container grid can hold.
Definition ContainerGrid.h:49
uint16_t * _columnWidths
Widths for the individual columns.
Definition ContainerGrid.h:56
bool _showGridCells
Enable this to draw the grid cells.
Definition ContainerGrid.h:51
virtual bool TouchInput(uint16_t x, uint16_t y, TouchTypes touchType) override
Process a touch input at the given point (x, y)
Definition ContainerGrid.cpp:79
ContainerGrid(uint8_t maxNumItems=DEFAULT_MAX_CONTAINER_ITEMS, uint8_t maxGridRows=DEFAULT_MAX_CONTAINERGRID_ROWS, uint8_t maxGridColumns=DEFAULT_MAX_CONTAINERGRID_COLUMNS, bool showGridCells=false, bool autoSizingFillLast=true, uint16_t locX=0, uint16_t locY=0, uint16_t width=0, uint16_t height=0)
Constructor of the ContainerGrid.
Definition ContainerGrid.cpp:8
uint16_t * _initialRowHeights
Heights for the individual rows.
Definition ContainerGrid.h:53
uint16_t * _rowHeights
Heights for the individual rows.
Definition ContainerGrid.h:55
bool SetRowHeight(uint8_t rowIndex, uint16_t rowHeight)
Set the height of a specific row.
Definition ContainerGrid.cpp:105
virtual void RecalculateLayout() override
Recalculate the UIElement layout (containers update the X- and Y-Location of all their items,...
Definition ContainerGrid.cpp:168
bool AddItem(UIElement *item, uint8_t columnIndex, uint8_t rowIndex, GridCellAlignment_t cellAlignment=GRID_CELL_ALIGNMENT_MIDDLE, uint8_t columnSpan=1, uint8_t rowSpan=1)
Add the item to the elements of this container and adapt the item location accordingly.
Definition ContainerGrid.cpp:121
bool SetColumnWidth(uint8_t columnIndex, uint16_t columnWidth)
Set the width of a specific column.
Definition ContainerGrid.cpp:113
virtual bool KeyInput(Keys_t key) override
Process the given key.
Definition ContainerGrid.cpp:66
~ContainerGrid()
Destructor of the ContainerGrid.
Definition ContainerGrid.h:78
virtual void Draw()
Virtual method used for drawing of the container UIElement.
Definition Container.h:43
Container(uint8_t maxNumItems=DEFAULT_MAX_CONTAINER_ITEMS)
Constructor of the Container.
Definition Container.cpp:7
Abstract base class for all user interface elements (controls, indicators, containers).
Definition UIElement.h:24
Struct used to store the column, row and alignment of a item inside the grid.
Definition ContainerGrid.h:34
GridCellAlignment_t cellAlignment
Alignment of the item inside the grid cell.
Definition ContainerGrid.h:38
uint8_t columnIndex
Column inside the grid where the item is placed.
Definition ContainerGrid.h:36
uint8_t columnSpan
Number of columns over which the item is placed (starting from column index)
Definition ContainerGrid.h:39
uint8_t rowIndex
Row inside the grid where the item is placed.
Definition ContainerGrid.h:37
uint8_t rowSpan
Number of rows over which the item is placed (starting from row index)
Definition ContainerGrid.h:40
UIElement * item
Pointer to the item for which this configuration applies.
Definition ContainerGrid.h:35