Adjust the position of the partial Frame
[platform/framework/native/uifw.git] / inc / FUiAnimPointAnimation.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        FUiAnimPointAnimation.h
20  * @brief       This is the header file for the %PointAnimation class.
21  *
22  * This header file contains the declarations of the %PointAnimation class.
23  */
24
25 #ifndef _FUI_ANIM_POINT_ANIMATION_H_
26 #define _FUI_ANIM_POINT_ANIMATION_H_
27
28 #include <FGrpPoint.h>
29 #include <FUiAnimAnimationBase.h>
30
31 namespace Tizen { namespace Ui { namespace Animations
32 {
33
34 /**
35  * @class       PointAnimation
36  * @brief       This class animates the Tizen::Graphics::Point object.
37  *
38  * @since       2.0
39  *
40  * @final   This class is not intended for extension.
41  *
42  * The %PointAnimation class animates an object from a Tizen::Graphics::Point value to another %Tizen::Graphics::Point value
43  * based on the specified interpolator type.
44  *
45  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/animating_uicontrols.htm">Animating UI Controls</a>.
46  */
47 class _OSP_EXPORT_ PointAnimation
48         : public AnimationBase
49 {
50 public:
51
52         /**
53          * Initializes this instance of %PointAnimation with the specified parameters.
54          *
55          * @since       2.0
56          *
57          * @param[in]   startValue                      The start value for %PointAnimation
58          * @param[in]   endValue                        The end value for %PointAnimation
59          * @param[in]   duration                        The duration of animation in milliseconds
60          * @param[in]   interpolator            The type of interpolator used for the intermediate value calculation of the animation
61          * @exception   E_SUCCESS                       The method is successful.
62          * @exception   E_INVALID_ARG           The value of the specified parameter is negative or the interpolator is of an invalid type.
63          * @remarks             The specific error code can be accessed using the GetLastResult() method.
64          */
65         PointAnimation(const Tizen::Graphics::Point& startValue, const Tizen::Graphics::Point& endValue, long duration, AnimationInterpolatorType interpolator);
66
67
68         /**
69          * This is the destructor for this class.
70          *
71          * @since       2.0
72          */
73         virtual ~PointAnimation(void);
74
75
76         /**
77          * This is the copy constructor for the %PointAnimation class.
78          *
79          * @since       2.0
80          *
81          * @param[in]   pointAnimation  An instance of %PointAnimation
82          * @exception   E_SUCCESS               The method is successful.
83          * @exception   E_OUT_OF_MEMORY The memory is insufficient.
84          * @remarks             The specific error code can be accessed using the GetLastResult() method.
85          */
86         PointAnimation(const PointAnimation& pointAnimation);
87
88
89         /**
90          * Assigns the value of the specified instance to the current instance of %PointAnimation.
91          *
92          * @since       2.0
93          *
94          * @param[in]   pointAnimation          An instance of %PointAnimation
95          * @exception   E_SUCCESS               The method is successful.
96          * @exception   E_OUT_OF_MEMORY The memory is insufficient.
97          * @remarks             The specific error code can be accessed using the GetLastResult() method.
98          */
99         PointAnimation& operator =(const PointAnimation& pointAnimation);
100
101
102         /**
103          * Checks whether the specified instance and the current instance of %PointAnimation have equal animation values.
104          *
105          * @since       2.0
106          *
107          * @return              @c true if the animation of the two instances of %PointAnimation are equal, @n
108          *                              else @c false
109          * @param[in]   rhs             An instance of %PointAnimation
110          */
111         bool operator ==(const PointAnimation& rhs) const;
112
113
114         /**
115          * Checks whether the specified instance and the current instance of %PointAnimation have different animation values.
116          *
117          * @since       2.0
118          *
119          * @return              @c true if the values of the animations of the two instances of %PointAnimation are not equal, @n
120          *                              else @c false
121          * @param[in]   rhs             An instance of %PointAnimation
122          */
123         bool operator !=(const PointAnimation& rhs) const;
124
125
126         /**
127          * Checks whether the value of the current instance of %PointAnimation equals the value of the specified instance.
128          *
129          * @since       2.0
130          *
131          * @return              @c true if the value of the current instance equals the value of the specified instance, @n
132          *                              else @c false
133          * @param[in]   obj             An instance of %PointAnimation
134          * @remarks     The %PointAnimation class has a semantic value. @n
135          *                              This means that this method checks whether the two instances have the same animation.
136          */
137         virtual bool Equals(const Tizen::Base::Object& obj) const;
138
139
140         /**
141          * Gets the hash value of the current instance.
142          *
143          * @since       2.0
144          *
145          * @return      The hash value of the current instance
146          * @remarks     The two equal instances must return the same hash value. For better performance, the used hash function must generate a random
147          *                      distribution for all inputs.
148          */
149         virtual int GetHashCode(void) const;
150
151
152         /**
153          * Gets the animated value for the current time.
154          *
155          * @since       2.0
156          *
157          * @return      An error code
158          * @param[in]   currentTime             The current time value of the animation @n
159          *                                                              The value must be between @c 0 and the duration of the animation.
160          * @param[out]  animatedValue   The animated value for the current time passed as the input parameter
161          * @exception   E_SUCCESS               The method is successful.
162          * @exception   E_INVALID_ARG   A specified input parameter is invalid.
163          * @exception   E_SYSTEM                A system error has occurred.
164          *
165          */
166         result GetAnimatedValue(long currentTime, Tizen::Graphics::Point& animatedValue) const;
167
168
169         /**
170          * Adds a key frame to the animation.
171          *
172          * @since       2.0
173          *
174          * @return              An error code
175          * @param[in]   time                            The time stamp
176          * @param[in]   value                           The value at the specified @c time
177          * @exception   E_SUCCESS                       The method is successful.
178          * @exception   E_INVALID_ARG       A specified input parameter is invalid.
179          * @exception   E_SYSTEM                        A system error has occurred.
180          * @remarks             If @c time is greater than the duration, it becomes the new duration and @c value becomes the new @c endValue. @n
181          *              The old duration and @c endValue are added as a new key frame entry in the list. @n
182          *              If a key-value pair with the current key already exists, then the old value will be overwritten with the new one. @n
183          *              An exception will be returned if time is equal to @c 0 or duration of the animation.
184          */
185         result AddKeyFrame(long time, const Tizen::Graphics::Point& value);
186
187
188         /**
189          * Gets the keyframe at a particular index in this animation.
190          *
191          * @since       2.0
192          *
193          * @return      An error code
194          * @param[in]   index                           The index value in the Keyframe list @n
195          *                                  The value is sorted in an increasing order of time.
196          * @param[out]  time                            The time stamp at the specified @c index
197          * @param[out]  value                           The value at the specified @c index
198          * @exception   E_SUCCESS                       The method is successful.
199          * @exception   E_OUT_OF_RANGE          The specified @c index is out of range.
200          * @exception   E_SYSTEM                        A system error has occurred.
201          * @remarks             The @c time and @c value returned are present at the index of the sorted map list that is sorted with respect to the key.
202          *              For example, if the user adds key-frame in the order (10,value1), (20,value2), (5,value3) and then
203          *              GetKeyFrameAt(0,time,value) is called, the pair returned is (5,value3).
204          */
205         result GetKeyFrameAt(int index, long& time, Tizen::Graphics::Point& value) const;
206
207
208         /**
209          * Removes the passed keyframe object from the keyframe list.
210          *
211          * @since       2.0
212          *
213          * @return              An error code
214          * @param[in]   time                            The key frame time
215          * @exception   E_SUCCESS                       The method is successful.
216          * @exception   E_INVALID_ARG           The specified @c time value is invalid.
217          * @exception   E_OBJ_NOT_FOUND         The specified @c time is not found in the KeyFrame List.
218          * @exception   E_SYSTEM                        A system error has occurred.
219          */
220         result RemoveKeyFrame(long time);
221
222
223         /**
224          * Removes the keyframe present at the specified @c index from the keyframe list.
225          *
226          * @since       2.0
227          *
228          * @return              An error code
229          * @param[in]   index                           The index value in the Keyframe list @n
230          *                                  The value is sorted in an increasing order of time.
231          * @exception   E_SUCCESS                       The method is successful.
232          * @exception   E_OUT_OF_RANGE          The specified @c index is out of range.
233          * @exception   E_SYSTEM                        A system error has occurred.
234          */
235         result RemoveKeyFrameAt(int index);
236
237
238         /**
239          * Removes all the keyframes from the animation.
240          *
241          * @since       2.0
242          *
243          * @return              An error code
244          * @exception   E_SUCCESS                       The method is successful.
245          * @exception   E_SYSTEM                        A system error has occurred.
246          */
247         result RemoveAllKeyFrames(void);
248
249
250         /**
251          * Sets the start value of the animation.
252          *
253          * @since       2.0
254          *
255          * @return              An error code
256          * @param[in]   startValue                      The start value of the animation to set
257          * @exception   E_SUCCESS                       The method is successful.
258          * @exception   E_SYSTEM                        A system error has occurred.
259          */
260         result SetStartValue(const Tizen::Graphics::Point& startValue);
261
262
263         /**
264          * Sets the end value of the animation.
265          *
266          * @since       2.0
267          *
268          * @return      An error code
269          * @param[in]   endValue                        The end value of the animation to set
270          * @exception   E_SUCCESS                       The method is successful.
271          * @exception   E_SYSTEM                        A system error has occurred.
272          */
273         result SetEndValue(const Tizen::Graphics::Point& endValue);
274
275
276         /**
277          * Gets the start value of the animation.
278          *
279          * @since       2.0
280          *
281          * @return      The start value
282          */
283         Tizen::Graphics::Point GetStartValue(void) const;
284
285
286         /**
287          * Gets the end value of the animation.
288          *
289          * @since       2.0
290          *
291          * @return      The end value
292          */
293         Tizen::Graphics::Point GetEndValue(void) const;
294
295
296         /**
297          * Gets the type information of this instance.
298          *
299          * @since       2.0
300          *
301          * @return  The type information of this instance
302          */
303         virtual AnimationType GetType(void) const;
304
305
306 protected:
307
308         friend class _PointAnimationImpl;
309
310
311         //
312         // This variable is for internal use only. Using this variable can cause behavioral, security-related,
313         // and consistency-related issues in the application.
314         //
315         // This variable is for internal usage.
316         //
317         // @since        2.0
318         //
319         class _PointAnimationImpl* _pPointAnimationImpl;
320
321 private:
322
323         //
324         // This method is for internal use only. Using this method can cause behavioral, security-related,
325         // and consistency-related issues in the application.
326         //
327         // This is the default constructor for this class.
328         //
329         // @since        2.0
330         //
331         PointAnimation(void);
332 };              // PointAnimation
333
334
335 }}}             // Tizen::Ui::Animations
336
337 #endif  // _FUI_ANIM_POINT_ANIMATION_H_