OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
GraphicsGridLayoutItemCfg.h
Go to the documentation of this file.
1
5// ###########################################################################################################################################################################################################################################################################################################################
6
7#pragma once
8
9// OpenTwin header
11
12#define OT_FactoryKey_GraphicsGridLayoutItem "OT_GILayG"
13
14namespace ot {
15
17 public:
18 GraphicsGridLayoutItemCfg(int _rows = 0, int _columns = 0);
20
22 virtual GraphicsItemCfg* createCopy(void) const override;
23
27 virtual void addToJsonObject(JsonValue& _object, JsonAllocator& _allocator) const override;
28
32 virtual void setFromJsonObject(const ConstJsonObject& _object) override;
33
35 virtual std::string getFactoryKey(void) const override { return std::string(OT_FactoryKey_GraphicsGridLayoutItem); };
36
37 int rowCount(void) const { return m_rows; };
38 int columnCount(void) const { return m_columns; };
39
40 virtual void addChildItem(ot::GraphicsItemCfg* _item) override;
41 void addChildItem(int _row, int _column, ot::GraphicsItemCfg* _item);
42 const std::vector<std::vector<GraphicsItemCfg*>>& items(void) const { return m_items; };
43
44 void setRowStretch(int _row, int _stretch);
45 const std::vector<int>& rowStretch(void) const { return m_rowStretch; };
46
47 void setColumnStretch(int _column, int _stretch);
48 const std::vector<int>& columnStretch(void) const { return m_columnStretch; };
49
50 private:
51 void clearAndResize(void);
52
53 int m_rows;
54 int m_columns;
55 std::vector<int> m_rowStretch;
56 std::vector<int> m_columnStretch;
57 std::vector<std::vector<GraphicsItemCfg*>> m_items;
58
60 GraphicsGridLayoutItemCfg& operator = (const GraphicsGridLayoutItemCfg&) = delete;
61 };
62
63}
#define OT_FactoryKey_GraphicsGridLayoutItem
Definition GraphicsGridLayoutItemCfg.h:12
#define OT_GUI_API_EXPORT
Definition OTGuiAPIExport.h:9
Definition GraphicsGridLayoutItemCfg.h:16
const std::vector< std::vector< GraphicsItemCfg * > > & items(void) const
Definition GraphicsGridLayoutItemCfg.h:42
int columnCount(void) const
Definition GraphicsGridLayoutItemCfg.h:38
const std::vector< int > & rowStretch(void) const
Definition GraphicsGridLayoutItemCfg.h:45
virtual std::string getFactoryKey(void) const override
Returns the key that is used to create an instance of this class in the simple factory.
Definition GraphicsGridLayoutItemCfg.h:35
const std::vector< int > & columnStretch(void) const
Definition GraphicsGridLayoutItemCfg.h:48
int rowCount(void) const
Definition GraphicsGridLayoutItemCfg.h:37
The GraphicsItemCfg is the base class for all graphics item configurations.
Definition GraphicsItemCfg.h:33
Definition GraphicsLayoutItemCfg.h:19
Definition Connector.h:8
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
rapidjson::MemoryPoolAllocator< rapidjson::CrtAllocator > JsonAllocator
Allocator used for writing to JSON values.
Definition JSON.h:30