OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
StyleRefPainter2D.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
9#include "OTGui/Painter2D.h"
11
12// std header
13#include <string>
14
15#define OT_FactoryKey_StyleRefPainter2D "OT_P2DStyR"
16
17#pragma warning(disable:4251)
18
19namespace ot {
20
27 public:
28 StyleRefPainter2D(ColorStyleValueEntry _referenceKey = ColorStyleValueEntry::WidgetBackground);
29 virtual ~StyleRefPainter2D();
30
34 virtual void addToJsonObject(JsonValue& _object, JsonAllocator& _allocator) const override;
35
39 virtual void setFromJsonObject(const ConstJsonObject& _object) override;
40
42 virtual std::string getFactoryKey(void) const override { return std::string(OT_FactoryKey_StyleRefPainter2D); };
43
44 virtual std::string generateQss(void) const override;
45
46 virtual ot::Color getDefaultColor(void) const override;
47
48 virtual bool isEqualTo(const Painter2D* _other) const override;
49
52 void setReferenceKey(ColorStyleValueEntry _referenceKey) { m_reference = _referenceKey; };
53
55 ColorStyleValueEntry getReferenceKey(void) const { return m_reference; };
56
57 private:
58 ColorStyleValueEntry m_reference;
59 };
60
61}
#define OT_DECL_NOCOPY(___class)
Removes the default copy constructor and assignment operator.
Definition OTClassHelper.h:14
#define OT_GUI_API_EXPORT
Definition OTGuiAPIExport.h:9
#define OT_FactoryKey_StyleRefPainter2D
Definition StyleRefPainter2D.h:15
The Color class is used to represent RGBA colors with integer values.
Definition Color.h:72
Definition Painter2D.h:17
The StyleRefPainter2D can be used to reference a ColorStyleValue in the active ColorStyle.
Definition StyleRefPainter2D.h:25
ColorStyleValueEntry getReferenceKey(void) const
Key of the ColorStyleValue that is referenced.
Definition StyleRefPainter2D.h:55
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 StyleRefPainter2D.h:42
void setReferenceKey(ColorStyleValueEntry _referenceKey)
Sets the key of the ColorStyleValue that should be referenced.
Definition StyleRefPainter2D.h:52
Definition Connector.h:8
ColorStyleValueEntry
Contains default painters set in a color style.
Definition ColorStyleTypes.h:138
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