OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
TableCfg.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
12
13// std header
14#include <string>
15#include <vector>
16
17namespace ot {
18
20 public:
21 enum class TableHeaderMode {
22 NoHeader,
25 };
26
27 static std::string toString(TableHeaderMode _headerMode);
28 static TableHeaderMode stringToHeaderMode(const std::string& _headerMode);
29
30 TableCfg(int _rows = 0, int _columns = 0, WidgetViewBase _baseInfo = WidgetViewBase(WidgetViewBase::ViewTable, WidgetViewBase::ViewIsCentral | WidgetViewBase::ViewIsCloseable));
31 TableCfg(const ot::GenericDataStructMatrix& _matrix, TableCfg::TableHeaderMode _headerMode);
32 TableCfg(const TableCfg& _other);
33 TableCfg(TableCfg&& _other) noexcept;
34 virtual ~TableCfg();
35
36 TableCfg& operator = (const TableCfg& _other);
37 TableCfg& operator = (TableCfg&& _other) noexcept;
38
42 virtual void addToJsonObject(ot::JsonValue& _object, ot::JsonAllocator& _allocator) const override;
43
47 virtual void setFromJsonObject(const ot::ConstJsonObject& _object) override;
48
49 GenericDataStructMatrix createMatrix(void) const;
50
53 void clear(void);
54
55 int getRowCount(void) const { return m_rows; };
56 int getColumnCount(void) const { return m_columns; };
57
58 const std::vector<std::vector<std::string>>& getRows(void) const { return m_data; };
59 const std::vector<std::string>& getRow(int _row) const;
60
61 void setCellText(int _row, int _column, const std::string& _text);
62 const std::string& getCellText(int _row, int _column) const;
63
64 void setRowHeader(int _row, const std::string& _headerText);
65 void setRowHeader(int _row, TableHeaderItemCfg* _item);
66 const TableHeaderItemCfg* getRowHeader(int _row) const;
67
68 void setColumnHeader(int _column, const std::string& _headerText);
69 void setColumnHeader(int _column, TableHeaderItemCfg* _item);
70 const TableHeaderItemCfg* getColumnHeader(int _column) const;
71
72 private:
73 void initialize(void);
74 void initialize(int _rows, int _columns);
75
76 int m_rows;
77 int m_columns;
78
79 std::vector<TableHeaderItemCfg*> m_rowHeader;
80 std::vector<TableHeaderItemCfg*> m_columnHeader;
81 std::vector<std::vector<std::string>> m_data;
82
83 };
84
85}
#define OT_GUI_API_EXPORT
Definition OTGuiAPIExport.h:9
Definition TableCfg.h:19
const std::vector< std::vector< std::string > > & getRows(void) const
Definition TableCfg.h:58
TableHeaderMode
Definition TableCfg.h:21
int getRowCount(void) const
Definition TableCfg.h:55
int getColumnCount(void) const
Definition TableCfg.h:56
Definition TableHeaderItemCfg.h:14
General widget view information class. The WidgetViewBase holds the general information of a WidgetVi...
Definition WidgetViewBase.h:25
Definition Connector.h:8
@ Vertical
Definition GuiTypes.h:37
@ Horizontal
Definition GuiTypes.h:36
rapidjson::Value JsonValue
Writable JSON value.
Definition JSON.h:27
rapidjson::GenericObject< true, rapidjson::GenericValue< rapidjson::UTF8<>, rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > > > ConstJsonObject
Read only JSON Object.
Definition JSON.h:35
OT_GUI_API_EXPORT std::string toString(ColorStyleName _colorStyleName)
Definition ColorStyleTypes.cpp:10
rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > JsonAllocator
Allocator used for writing to JSON values.
Definition JSON.h:30