OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
GraphicsTextItemCfg.h
Go to the documentation of this file.
1
5// ###########################################################################################################################################################################################################################################################################################################################
6
7#pragma once
8
9// OpenTwin header
10#include "OTCore/Color.h"
11#include "OTGui/Outline.h"
13
14#define OT_FactoryKey_GraphicsTextItem "OT_GIText"
15
16namespace ot {
17
19 public:
20 GraphicsTextItemCfg(const std::string& _text = std::string(), const ot::Color& _textColor = ot::Color());
21 virtual ~GraphicsTextItemCfg();
22
24 virtual GraphicsItemCfg* createCopy(void) const override;
25
29 virtual void addToJsonObject(JsonValue& _object, JsonAllocator& _allocator) const override;
30
34 virtual void setFromJsonObject(const ConstJsonObject& _object) override;
35
37 virtual std::string getFactoryKey(void) const override { return std::string(OT_FactoryKey_GraphicsTextItem); };
38
39 void setText(const std::string& _text) { m_text = _text; };
40 const std::string& getText(void) const { return m_text; };
41
42 void setTextFont(const Font& _font) { m_textFont = _font; };
43 const Font& getTextFont(void) const { return m_textFont; };
44
45 void setTextColor(const Color& _color) { m_textStyle.setColor(_color); };
46
49 void setTextPainter(Painter2D* _painter) { m_textStyle.setPainter(_painter); };
50 const Painter2D* getTextPainter(void) const { return m_textStyle.painter(); };
51
52 void setTextLineWidth(double _width) { m_textStyle.setWidth(_width); };
53
54 void setTextStyle(const OutlineF& _style) { m_textStyle = _style; };
55 const OutlineF& getTextStyle(void) const { return m_textStyle; };
56
59 void setTextIsReference(bool _isReference) { m_textIsReference = _isReference; };
60
63 bool getTextIsReference(void) const { return m_textIsReference; };
64
65 private:
66 std::string m_text;
67 ot::Font m_textFont;
68 OutlineF m_textStyle;
69 bool m_textIsReference;
70
72 GraphicsTextItemCfg& operator = (GraphicsTextItemCfg&) = delete;
73 };
74
75}
#define OT_FactoryKey_GraphicsTextItem
Definition GraphicsTextItemCfg.h:14
#define OT_GUI_API_EXPORT
Definition OTGuiAPIExport.h:9
The Color class is used to represent RGBA colors with integer values.
Definition Color.h:72
Definition Font.h:20
The GraphicsItemCfg is the base class for all graphics item configurations.
Definition GraphicsItemCfg.h:33
Definition GraphicsTextItemCfg.h:18
void setText(const std::string &_text)
Definition GraphicsTextItemCfg.h:39
void setTextFont(const Font &_font)
Definition GraphicsTextItemCfg.h:42
bool getTextIsReference(void) const
If enabled the set text will be used as a key for the string map.
Definition GraphicsTextItemCfg.h:63
void setTextIsReference(bool _isReference)
Sets the text is reference mode.
Definition GraphicsTextItemCfg.h:59
const Painter2D * getTextPainter(void) const
Definition GraphicsTextItemCfg.h:50
void setTextPainter(Painter2D *_painter)
Sets the text painter. The item takes ownership of the painter.
Definition GraphicsTextItemCfg.h:49
void setTextLineWidth(double _width)
Definition GraphicsTextItemCfg.h:52
void setTextColor(const Color &_color)
Definition GraphicsTextItemCfg.h:45
void setTextStyle(const OutlineF &_style)
Definition GraphicsTextItemCfg.h:54
const Font & getTextFont(void) const
Definition GraphicsTextItemCfg.h:43
const OutlineF & getTextStyle(void) const
Definition GraphicsTextItemCfg.h:55
const std::string & getText(void) const
Definition GraphicsTextItemCfg.h:40
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 GraphicsTextItemCfg.h:37
The OutlineF class is used to describe how a outline should look like.
Definition Outline.h:161
Definition Painter2D.h:17
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