1bb823c2adaa8bf122300c4ae6f84d7a67068c53
[platform/core/uifw/rive-tizen.git] / submodule / include / generated / shapes / parametric_path_base.hpp
1 #ifndef _RIVE_PARAMETRIC_PATH_BASE_HPP_
2 #define _RIVE_PARAMETRIC_PATH_BASE_HPP_
3 #include "core/field_types/core_double_type.hpp"
4 #include "shapes/path.hpp"
5 namespace rive
6 {
7         class ParametricPathBase : public Path
8         {
9         protected:
10                 typedef Path Super;
11
12         public:
13                 static const int typeKey = 15;
14
15                 /// Helper to quickly determine if a core object extends another without
16                 /// RTTI at runtime.
17                 bool isTypeOf(int typeKey) const override
18                 {
19                         switch (typeKey)
20                         {
21                                 case ParametricPathBase::typeKey:
22                                 case PathBase::typeKey:
23                                 case NodeBase::typeKey:
24                                 case TransformComponentBase::typeKey:
25                                 case ContainerComponentBase::typeKey:
26                                 case ComponentBase::typeKey:
27                                         return true;
28                                 default:
29                                         return false;
30                         }
31                 }
32
33                 int coreType() const override { return typeKey; }
34
35                 static const int widthPropertyKey = 20;
36                 static const int heightPropertyKey = 21;
37                 static const int originXPropertyKey = 123;
38                 static const int originYPropertyKey = 124;
39
40         private:
41                 float m_Width = 0;
42                 float m_Height = 0;
43                 float m_OriginX = 0.5;
44                 float m_OriginY = 0.5;
45         public:
46                 inline float width() const { return m_Width; }
47                 void width(float value)
48                 {
49                         if (m_Width == value)
50                         {
51                                 return;
52                         }
53                         m_Width = value;
54                         widthChanged();
55                 }
56
57                 inline float height() const { return m_Height; }
58                 void height(float value)
59                 {
60                         if (m_Height == value)
61                         {
62                                 return;
63                         }
64                         m_Height = value;
65                         heightChanged();
66                 }
67
68                 inline float originX() const { return m_OriginX; }
69                 void originX(float value)
70                 {
71                         if (m_OriginX == value)
72                         {
73                                 return;
74                         }
75                         m_OriginX = value;
76                         originXChanged();
77                 }
78
79                 inline float originY() const { return m_OriginY; }
80                 void originY(float value)
81                 {
82                         if (m_OriginY == value)
83                         {
84                                 return;
85                         }
86                         m_OriginY = value;
87                         originYChanged();
88                 }
89
90                 bool deserialize(int propertyKey, BinaryReader& reader) override
91                 {
92                         switch (propertyKey)
93                         {
94                                 case widthPropertyKey:
95                                         m_Width = CoreDoubleType::deserialize(reader);
96                                         return true;
97                                 case heightPropertyKey:
98                                         m_Height = CoreDoubleType::deserialize(reader);
99                                         return true;
100                                 case originXPropertyKey:
101                                         m_OriginX = CoreDoubleType::deserialize(reader);
102                                         return true;
103                                 case originYPropertyKey:
104                                         m_OriginY = CoreDoubleType::deserialize(reader);
105                                         return true;
106                         }
107                         return Path::deserialize(propertyKey, reader);
108                 }
109
110         protected:
111                 virtual void widthChanged() {}
112                 virtual void heightChanged() {}
113                 virtual void originXChanged() {}
114                 virtual void originYChanged() {}
115         };
116 } // namespace rive
117
118 #endif