OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
GraphicsRectangularItemCfg.h
Go to the documentation of this file.
1
5// ###########################################################################################################################################################################################################################################################################################################################
6
7#pragma once
8
9// OpenTwin header
10#include "OTGui/Outline.h"
12
13#define OT_FactoryKey_GraphicsRectangularItem "OT_GIRect"
14
15namespace ot {
16
17 class Painter2D;
18
20 public:
21 GraphicsRectangularItemCfg(ot::Painter2D* _backgroundPainter = (ot::Painter2D*)nullptr, int _cornerRadius = 0);
23
25 virtual GraphicsItemCfg* createCopy(void) const override;
26
30 virtual void addToJsonObject(JsonValue& _object, JsonAllocator& _allocator) const override;
31
35 virtual void setFromJsonObject(const ConstJsonObject& _object) override;
36
38 virtual std::string getFactoryKey(void) const override { return std::string(OT_FactoryKey_GraphicsRectangularItem); };
39
40 void setCornerRadius(int _px) { m_cornerRadius = _px; };
41 int getCornerRadius(void) const { return m_cornerRadius; };
42
43 void setOutline(const ot::OutlineF& _outline) { m_outline = _outline; };
44 const ot::OutlineF& getOutline(void) const { return m_outline; };
45
46 void setBackgroundPainer(ot::Painter2D* _painter);
47 const ot::Painter2D* getBackgroundPainter(void) const { return m_backgroundPainter; };
48
49 void setSize(const ot::Size2DD& _size) { m_size = _size; };
50 const ot::Size2DD& getSize(void) const { return m_size; };
51
52 private:
53 int m_cornerRadius;
54 ot::OutlineF m_outline;
55 ot::Size2DD m_size;
56 ot::Painter2D* m_backgroundPainter;
57
60 };
61
62}
#define OT_FactoryKey_GraphicsRectangularItem
Definition GraphicsRectangularItemCfg.h:13
#define OT_GUI_API_EXPORT
Definition OTGuiAPIExport.h:9
The GraphicsItemCfg is the base class for all graphics item configurations.
Definition GraphicsItemCfg.h:33
Definition GraphicsRectangularItemCfg.h:19
const ot::OutlineF & getOutline(void) const
Definition GraphicsRectangularItemCfg.h:44
void setCornerRadius(int _px)
Definition GraphicsRectangularItemCfg.h:40
void setSize(const ot::Size2DD &_size)
Definition GraphicsRectangularItemCfg.h:49
const ot::Size2DD & getSize(void) const
Definition GraphicsRectangularItemCfg.h:50
void setOutline(const ot::OutlineF &_outline)
Definition GraphicsRectangularItemCfg.h:43
int getCornerRadius(void) const
Definition GraphicsRectangularItemCfg.h:41
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 GraphicsRectangularItemCfg.h:38
const ot::Painter2D * getBackgroundPainter(void) const
Definition GraphicsRectangularItemCfg.h:47
The OutlineF class is used to describe how a outline should look like.
Definition Outline.h:161
Definition Painter2D.h:17
2D Size with double values
Definition Size2D.h:115
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