Merge "remove the exports for enumerated property types" into tizen
[platform/core/uifw/dali-core.git] / dali / public-api / animation / constraint.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/public-api/animation/constraint.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/animation/time-period.h>
23 #include <dali/internal/event/animation/constraint-impl.h>
24 #include <dali/internal/event/animation/constraint-source-impl.h>
25
26 namespace Dali
27 {
28
29 const AlphaFunction            Constraint::DEFAULT_ALPHA_FUNCTION = AlphaFunctions::Linear;
30 const Constraint::RemoveAction Constraint::DEFAULT_REMOVE_ACTION  = Constraint::Bake;
31
32 Constraint::Constraint()
33 {
34 }
35
36 Constraint::Constraint(Internal::Constraint* constraint)
37 : BaseHandle(constraint)
38 {
39 }
40
41 Constraint::~Constraint()
42 {
43 }
44
45 Constraint::Constraint(const Constraint& handle)
46 : BaseHandle(handle)
47 {
48 }
49
50 Constraint& Constraint::operator=(const Constraint& rhs)
51 {
52   BaseHandle::operator=(rhs);
53   return *this;
54 }
55
56 void Constraint::SetApplyTime( TimePeriod timePeriod )
57 {
58   GetImplementation(*this).SetApplyTime( timePeriod );
59 }
60
61 TimePeriod Constraint::GetApplyTime() const
62 {
63   return GetImplementation(*this).GetApplyTime();
64 }
65
66 void Constraint::SetAlphaFunction( AlphaFunction func )
67 {
68   GetImplementation(*this).SetAlphaFunction( func );
69 }
70
71 AlphaFunction Constraint::GetAlphaFunction()
72 {
73   return GetImplementation(*this).GetAlphaFunction();
74 }
75
76 void Constraint::SetRemoveAction(Constraint::RemoveAction action)
77 {
78   GetImplementation(*this).SetRemoveAction(action);
79 }
80
81 Constraint::RemoveAction Constraint::GetRemoveAction() const
82 {
83   return GetImplementation(*this).GetRemoveAction();
84 }
85
86 void Constraint::SetTag( const unsigned int tag )
87 {
88   GetImplementation(*this).SetTag( tag );
89 }
90
91 unsigned int Constraint::GetTag() const
92 {
93   return GetImplementation(*this).GetTag();
94 }
95
96
97
98
99
100 Constraint Constraint::New( Property::Index target,
101                             Property::Type targetType,
102                             AnyFunction func,
103                             AnyFunction interpolator )
104 {
105   Internal::SourceContainer sources; // empty
106
107   return Constraint( new Internal::Constraint( target,
108                                                targetType,
109                                                sources,
110                                                func,
111                                                interpolator ) );
112 }
113
114 Constraint Constraint::New( Property::Index target,
115                             Property::Type targetType,
116                             ConstraintSource source1,
117                             AnyFunction func,
118                             AnyFunction interpolator )
119 {
120   Internal::SourceContainer sources;
121   sources.push_back( Internal::Source( source1 ) );
122
123   return Constraint( new Internal::Constraint( target,
124                                                targetType,
125                                                sources,
126                                                func,
127                                                interpolator ) );
128 }
129
130 Constraint Constraint::New( Property::Index target,
131                             Property::Type targetType,
132                             ConstraintSource source1,
133                             ConstraintSource source2,
134                             AnyFunction func,
135                             AnyFunction interpolator )
136 {
137   Internal::SourceContainer sources;
138   sources.push_back( Internal::Source( source1 ) );
139   sources.push_back( Internal::Source( source2 ) );
140
141   return Constraint( new Internal::Constraint( target,
142                                                targetType,
143                                                sources,
144                                                func,
145                                                interpolator ) );
146 }
147
148 Constraint Constraint::New( Property::Index target,
149                             Property::Type targetType,
150                             ConstraintSource source1,
151                             ConstraintSource source2,
152                             ConstraintSource source3,
153                             AnyFunction func,
154                             AnyFunction interpolator )
155 {
156   Internal::SourceContainer sources;
157   sources.push_back( Internal::Source( source1 ) );
158   sources.push_back( Internal::Source( source2 ) );
159   sources.push_back( Internal::Source( source3 ) );
160
161   return Constraint( new Internal::Constraint( target,
162                                                targetType,
163                                                sources,
164                                                func,
165                                                interpolator ) );
166 }
167
168 Constraint Constraint::New( Property::Index target,
169                             Property::Type targetType,
170                             ConstraintSource source1,
171                             ConstraintSource source2,
172                             ConstraintSource source3,
173                             ConstraintSource source4,
174                             AnyFunction func,
175                             AnyFunction interpolator )
176 {
177   Internal::SourceContainer sources;
178   sources.push_back( Internal::Source( source1 ) );
179   sources.push_back( Internal::Source( source2 ) );
180   sources.push_back( Internal::Source( source3 ) );
181   sources.push_back( Internal::Source( source4 ) );
182
183   return Constraint( new Internal::Constraint( target,
184                                                targetType,
185                                                sources,
186                                                func,
187                                                interpolator ) );
188 }
189
190 Constraint Constraint::New( Property::Index target,
191                             Property::Type targetType,
192                             ConstraintSource source1,
193                             ConstraintSource source2,
194                             ConstraintSource source3,
195                             ConstraintSource source4,
196                             ConstraintSource source5,
197                             AnyFunction func,
198                             AnyFunction interpolator )
199 {
200   Internal::SourceContainer sources;
201   sources.push_back( Internal::Source( source1 ) );
202   sources.push_back( Internal::Source( source2 ) );
203   sources.push_back( Internal::Source( source3 ) );
204   sources.push_back( Internal::Source( source4 ) );
205   sources.push_back( Internal::Source( source5 ) );
206
207   return Constraint( new Internal::Constraint( target,
208                                                targetType,
209                                                sources,
210                                                func,
211                                                interpolator ) );
212 }
213
214 Constraint Constraint::New( Property::Index target,
215                             Property::Type targetType,
216                             ConstraintSource source1,
217                             ConstraintSource source2,
218                             ConstraintSource source3,
219                             ConstraintSource source4,
220                             ConstraintSource source5,
221                             ConstraintSource source6,
222                             AnyFunction func,
223                             AnyFunction interpolator )
224 {
225   Internal::SourceContainer sources;
226   sources.push_back( Internal::Source( source1 ) );
227   sources.push_back( Internal::Source( source2 ) );
228   sources.push_back( Internal::Source( source3 ) );
229   sources.push_back( Internal::Source( source4 ) );
230   sources.push_back( Internal::Source( source5 ) );
231   sources.push_back( Internal::Source( source6 ) );
232
233   return Constraint( new Internal::Constraint( target,
234                                                targetType,
235                                                sources,
236                                                func,
237                                                interpolator ) );
238 }
239
240 Constraint Constraint::DownCast( BaseHandle handle )
241 {
242   return Constraint( dynamic_cast<Dali::Internal::Constraint*>(handle.GetObjectPtr()) );
243 }
244
245 } // namespace Dali