50e76f053fb9d9cbf34dae6e9224b70ef493fba2
[platform/core/uifw/rive-tizen.git] / submodule / include / generated / animation / linear_animation_base.hpp
1 #ifndef _RIVE_LINEAR_ANIMATION_BASE_HPP_
2 #define _RIVE_LINEAR_ANIMATION_BASE_HPP_
3 #include "animation/animation.hpp"
4 #include "core/field_types/core_bool_type.hpp"
5 #include "core/field_types/core_double_type.hpp"
6 #include "core/field_types/core_uint_type.hpp"
7 namespace rive
8 {
9         class LinearAnimationBase : public Animation
10         {
11         protected:
12                 typedef Animation Super;
13
14         public:
15                 static const uint16_t typeKey = 31;
16
17                 /// Helper to quickly determine if a core object extends another without
18                 /// RTTI at runtime.
19                 bool isTypeOf(uint16_t typeKey) const override
20                 {
21                         switch (typeKey)
22                         {
23                                 case LinearAnimationBase::typeKey:
24                                 case AnimationBase::typeKey:
25                                         return true;
26                                 default:
27                                         return false;
28                         }
29                 }
30
31                 uint16_t coreType() const override { return typeKey; }
32
33                 static const uint16_t fpsPropertyKey = 56;
34                 static const uint16_t durationPropertyKey = 57;
35                 static const uint16_t speedPropertyKey = 58;
36                 static const uint16_t loopValuePropertyKey = 59;
37                 static const uint16_t workStartPropertyKey = 60;
38                 static const uint16_t workEndPropertyKey = 61;
39                 static const uint16_t enableWorkAreaPropertyKey = 62;
40
41         private:
42                 int m_Fps = 60;
43                 int m_Duration = 60;
44                 float m_Speed = 1.0f;
45                 int m_LoopValue = 0;
46                 int m_WorkStart = -1;
47                 int m_WorkEnd = -1;
48                 bool m_EnableWorkArea = false;
49         public:
50                 inline int fps() const { return m_Fps; }
51                 void fps(int value)
52                 {
53                         if (m_Fps == value)
54                         {
55                                 return;
56                         }
57                         m_Fps = value;
58                         fpsChanged();
59                 }
60
61                 inline int duration() const { return m_Duration; }
62                 void duration(int value)
63                 {
64                         if (m_Duration == value)
65                         {
66                                 return;
67                         }
68                         m_Duration = value;
69                         durationChanged();
70                 }
71
72                 inline float speed() const { return m_Speed; }
73                 void speed(float value)
74                 {
75                         if (m_Speed == value)
76                         {
77                                 return;
78                         }
79                         m_Speed = value;
80                         speedChanged();
81                 }
82
83                 inline int loopValue() const { return m_LoopValue; }
84                 void loopValue(int value)
85                 {
86                         if (m_LoopValue == value)
87                         {
88                                 return;
89                         }
90                         m_LoopValue = value;
91                         loopValueChanged();
92                 }
93
94                 inline int workStart() const { return m_WorkStart; }
95                 void workStart(int value)
96                 {
97                         if (m_WorkStart == value)
98                         {
99                                 return;
100                         }
101                         m_WorkStart = value;
102                         workStartChanged();
103                 }
104
105                 inline int workEnd() const { return m_WorkEnd; }
106                 void workEnd(int value)
107                 {
108                         if (m_WorkEnd == value)
109                         {
110                                 return;
111                         }
112                         m_WorkEnd = value;
113                         workEndChanged();
114                 }
115
116                 inline bool enableWorkArea() const { return m_EnableWorkArea; }
117                 void enableWorkArea(bool value)
118                 {
119                         if (m_EnableWorkArea == value)
120                         {
121                                 return;
122                         }
123                         m_EnableWorkArea = value;
124                         enableWorkAreaChanged();
125                 }
126
127                 bool deserialize(uint16_t propertyKey, BinaryReader& reader) override
128                 {
129                         switch (propertyKey)
130                         {
131                                 case fpsPropertyKey:
132                                         m_Fps = CoreUintType::deserialize(reader);
133                                         return true;
134                                 case durationPropertyKey:
135                                         m_Duration = CoreUintType::deserialize(reader);
136                                         return true;
137                                 case speedPropertyKey:
138                                         m_Speed = CoreDoubleType::deserialize(reader);
139                                         return true;
140                                 case loopValuePropertyKey:
141                                         m_LoopValue = CoreUintType::deserialize(reader);
142                                         return true;
143                                 case workStartPropertyKey:
144                                         m_WorkStart = CoreUintType::deserialize(reader);
145                                         return true;
146                                 case workEndPropertyKey:
147                                         m_WorkEnd = CoreUintType::deserialize(reader);
148                                         return true;
149                                 case enableWorkAreaPropertyKey:
150                                         m_EnableWorkArea = CoreBoolType::deserialize(reader);
151                                         return true;
152                         }
153                         return Animation::deserialize(propertyKey, reader);
154                 }
155
156         protected:
157                 virtual void fpsChanged() {}
158                 virtual void durationChanged() {}
159                 virtual void speedChanged() {}
160                 virtual void loopValueChanged() {}
161                 virtual void workStartChanged() {}
162                 virtual void workEndChanged() {}
163                 virtual void enableWorkAreaChanged() {}
164         };
165 } // namespace rive
166
167 #endif