Vivoe Lite 0.5.0
Lightweight GVA like HMI for military displays.
Loading...
Searching...
No Matches
table.h
Go to the documentation of this file.
1//
2// Copyright (c) 2023, DefenceX PTY LTD
3//
4// This file is part of the VivoeX project developed by DefenceX.
5//
6// Licensed under the Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
7// License. See the LICENSE file in the project root for full license details.
8//
12#ifndef HMICORE_WIDGETS_TABLE_TABLE_H_
13#define HMICORE_WIDGETS_TABLE_TABLE_H_
14
15#include <memory>
16#include <string>
17#include <vector>
18
19#include "hmicore/gva.h"
25
26namespace gva {
27
32class WidgetTable : public WidgetX {
33 public:
41 explicit WidgetTable(const RendererGva &renderer, TouchGva *touch, uint32_t background_colour = 0x000000);
42
47 ~WidgetTable() override = default;
48
54 std::string GetWidgetName() const override { return "WidgetTable"; };
55
60 void Draw() override;
61
71 virtual void AddRow(uint32_t foreground_colour, uint32_t background_colour, uint32_t outline_colour,
72 uint32_t highlight_colour, widget::WeightType font_weight);
73
78 virtual void AddRow();
79
85 virtual void AddRow(widget::WeightType font_weight);
86
93 virtual void AddCell(const std::string text, uint32_t width);
94
102 virtual void AddCell(const std::string text, uint32_t width, uint32_t background_colour);
103
111 virtual void AddCell(const std::string text, uint32_t width, widget::CellAlignType align);
112
121 virtual void AddCell(const std::string text, uint32_t width, widget::CellAlignType align, uint32_t background_colour);
122
127 void Reset();
128
134 uint32_t GetBackgroundColour() const;
135
141 void SetBackgroundColour(uint32_t background_colour);
142
148 void SetCurrentRow(uint32_t row);
149
154 void SetNextRow();
155
160 void SetPreviousRow();
161
168 uint32_t GetCurrentRow() const;
169
175 std::vector<RowType> &GetRows();
176
182 void SetRows(const std::vector<RowType> &rows);
183
184 private:
185 std::vector<RowType> rows_;
186 std::vector<RowType> rows_filtered_;
187 void DrawTable();
188 TouchGva *touch_;
189 uint32_t current_cell_ = 0;
190 uint32_t current_row_ = 0;
191 uint32_t background_colour_;
192 uint32_t foreground_colour_ = Renderer::PackRgb(kHmiWhite);
193 uint32_t outline_colour_ = ConfigData::GetInstance()->GetThemeLabelBorderEnabled();
194 uint32_t highlight_colour_ = ConfigData::GetInstance()->GetThemeLabelBorderEnabledSelected();
195};
196
197} // namespace gva
198
199#endif // HMICORE_WIDGETS_TABLE_TABLE_H_
uint32_t GetThemeLabelBorderEnabled() const
Get the Theme Label Border Enabled object.
Definition config_reader.cc:197
uint32_t GetThemeLabelBorderEnabledSelected() const
Get the Theme Label Border Enabled Selected object.
Definition config_reader.cc:193
static ConfigData * GetInstance()
Get the Instance object.
Definition config_reader.cc:93
Class definition of the GVA renderer.
Definition renderer_gva.h:29
static uint32_t PackRgb(ColourType colour)
Pack the colour to RGB.
Definition renderer.cc:35
Class defining the touch screen events.
Definition touch_gva.h:71
A widget representing a table of elements.
Definition table.h:32
void SetNextRow()
Set the Next Row attribute.
Definition table.cc:143
void SetRows(const std::vector< RowType > &rows)
Get the all the Rows in supplie vector.
Definition table.cc:155
void Reset()
Reset the table.
Definition table.cc:132
uint32_t GetBackgroundColour() const
Get the Background Colour attribute.
Definition table.cc:137
void SetPreviousRow()
Set the Previous Row attribute.
Definition table.cc:147
void SetCurrentRow(uint32_t row)
Set the Current selected row, will be highlighted in the theme colours.
Definition table.cc:141
void Draw() override
The base class override to draw the table once setup.
Definition table.cc:22
virtual void AddCell(const std::string text, uint32_t width)
Add a basic cell.
Definition table.cc:110
std::vector< RowType > & GetRows()
Get the Rows vector.
Definition table.cc:153
~WidgetTable() override=default
Destroy the Widget Keyboard object.
virtual void AddRow()
Add a row to the table.
Definition table.cc:98
uint32_t GetCurrentRow() const
Get the Current selected highlighted row.
Definition table.cc:151
std::string GetWidgetName() const override
Get the Widget Name attribute.
Definition table.h:54
void SetBackgroundColour(uint32_t background_colour)
Set the Background Colour attribute.
Definition table.cc:139
Class defining the base widget.
Definition widget.h:27
const gva::ColourType kHmiWhite
The RGB values for white.
Definition renderer.h:24
WeightType
The line weight for boxes and tables.
Definition widget_types.h:33
CellAlignType
Table (see WidgetTable) cell alignment.
Definition widget_types.h:27