OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
CheckerboardPainter2D.h
Go to the documentation of this file.
1
4// ###########################################################################################################################################################################################################################################################################################################################
5
6#pragma once
7
8// OpenTwin header
9#include "OTCore/Color.h"
10#include "OTCore/Size2D.h"
11#include "OTGui/Painter2D.h"
12
13#define OT_FactoryKey_CheckerboardPainter2D "OT_P2DCheck"
14
15namespace ot {
16
18 public:
20 CheckerboardPainter2D(ot::DefaultColor _primaryColor, ot::DefaultColor _secondaryColor, const Size2D& _cellSize = Size2D(10, 10));
21 CheckerboardPainter2D(const ot::Color& _primaryColor, const ot::Color& _secondaryColor, const Size2D& _cellSize = Size2D(10, 10));
22
25 CheckerboardPainter2D(Painter2D* _primaryPainter, Painter2D* _secondaryPainter, const Size2D& _cellSize = Size2D(10, 10));
26 virtual ~CheckerboardPainter2D();
27
31 virtual void addToJsonObject(JsonValue& _object, JsonAllocator& _allocator) const override;
32
36 virtual void setFromJsonObject(const ConstJsonObject& _object) override;
37
39 virtual std::string getFactoryKey(void) const override { return std::string(OT_FactoryKey_CheckerboardPainter2D); };
40
41 virtual std::string generateQss(void) const override;
42
43 virtual ot::Color getDefaultColor(void) const override;
44
45 virtual bool isEqualTo(const Painter2D* _other) const override;
46
51 void setPrimaryPainter(Painter2D* _painter);
52 const Painter2D* getPrimaryPainter(void) const { return m_primary; };
53
58 void setSecondaryPainter(Painter2D* _painter);
59 const Painter2D* getSecondaryPainter(void) const { return m_secondary; };
60
61 void setCellSize(int _size);
62 void setCellSize(int _width, int _height);
63 void setCellSize(const Size2D& _size) { m_cellSize = _size; };
64 const Size2D& getCellSize(void) const { return m_cellSize; };
65
66 private:
67 Size2D m_cellSize;
68 Painter2D* m_primary;
69 Painter2D* m_secondary;
70
72 CheckerboardPainter2D& operator = (const CheckerboardPainter2D&) = delete;
73 };
74
75}
#define OT_FactoryKey_CheckerboardPainter2D
Definition CheckerboardPainter2D.h:13
#define OT_GUI_API_EXPORT
Definition OTGuiAPIExport.h:9
Definition CheckerboardPainter2D.h:17
const Size2D & getCellSize(void) const
Definition CheckerboardPainter2D.h:64
const Painter2D * getSecondaryPainter(void) const
Definition CheckerboardPainter2D.h:59
const Painter2D * getPrimaryPainter(void) const
Definition CheckerboardPainter2D.h:52
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 CheckerboardPainter2D.h:39
void setCellSize(const Size2D &_size)
Definition CheckerboardPainter2D.h:63
The Color class is used to represent RGBA colors with integer values.
Definition Color.h:72
Definition Painter2D.h:17
2D Size with integer values
Definition Size2D.h:15
Definition Connector.h:8
DefaultColor
Default colors.
Definition Color.h:18
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