2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://floralicense.org/license/
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.
19 * @file FUiAnimPointAnimation.h
20 * @brief This is the header file for the %PointAnimation class.
22 * This header file contains the declarations of the %PointAnimation class.
25 #ifndef _FUI_ANIM_POINT_ANIMATION_H_
26 #define _FUI_ANIM_POINT_ANIMATION_H_
28 #include <FGrpPoint.h>
29 #include <FUiAnimAnimationBase.h>
31 namespace Tizen { namespace Ui { namespace Animations
35 * @class PointAnimation
36 * @brief This class animates the Tizen::Graphics::Point object.
40 * @final This class is not intended for extension.
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.
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>.
47 class _OSP_EXPORT_ PointAnimation
48 : public AnimationBase
53 * Initializes this instance of %PointAnimation with the specified parameters.
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.
65 PointAnimation(const Tizen::Graphics::Point& startValue, const Tizen::Graphics::Point& endValue, long duration, AnimationInterpolatorType interpolator);
69 * This is the destructor for this class.
73 virtual ~PointAnimation(void);
77 * This is the copy constructor for the %PointAnimation class.
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.
86 PointAnimation(const PointAnimation& pointAnimation);
90 * Assigns the value of the specified instance to the current instance of %PointAnimation.
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.
99 PointAnimation& operator =(const PointAnimation& pointAnimation);
103 * Checks whether the specified instance and the current instance of %PointAnimation have equal animation values.
107 * @return @c true if the animation of the two instances of %PointAnimation are equal, @n
109 * @param[in] rhs An instance of %PointAnimation
111 bool operator ==(const PointAnimation& rhs) const;
115 * Checks whether the specified instance and the current instance of %PointAnimation have different animation values.
119 * @return @c true if the values of the animations of the two instances of %PointAnimation are not equal, @n
121 * @param[in] rhs An instance of %PointAnimation
123 bool operator !=(const PointAnimation& rhs) const;
127 * Checks whether the value of the current instance of %PointAnimation equals the value of the specified instance.
131 * @return @c true if the value of the current instance equals the value of the specified instance, @n
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.
137 virtual bool Equals(const Tizen::Base::Object& obj) const;
141 * Gets the hash value of the current instance.
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.
149 virtual int GetHashCode(void) const;
153 * Gets the animated value for the current time.
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.
166 result GetAnimatedValue(long currentTime, Tizen::Graphics::Point& animatedValue) const;
170 * Adds a key frame to the animation.
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.
185 result AddKeyFrame(long time, const Tizen::Graphics::Point& value);
189 * Gets the keyframe at a particular index in this animation.
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).
205 result GetKeyFrameAt(int index, long& time, Tizen::Graphics::Point& value) const;
209 * Removes the passed keyframe object from the keyframe list.
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.
220 result RemoveKeyFrame(long time);
224 * Removes the keyframe present at the specified @c index from the keyframe list.
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.
235 result RemoveKeyFrameAt(int index);
239 * Removes all the keyframes from the animation.
243 * @return An error code
244 * @exception E_SUCCESS The method is successful.
245 * @exception E_SYSTEM A system error has occurred.
247 result RemoveAllKeyFrames(void);
251 * Sets the start value of the animation.
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.
260 result SetStartValue(const Tizen::Graphics::Point& startValue);
264 * Sets the end value of the animation.
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.
273 result SetEndValue(const Tizen::Graphics::Point& endValue);
277 * Gets the start value of the animation.
281 * @return The start value
283 Tizen::Graphics::Point GetStartValue(void) const;
287 * Gets the end value of the animation.
291 * @return The end value
293 Tizen::Graphics::Point GetEndValue(void) const;
297 * Gets the type information of this instance.
301 * @return The type information of this instance
303 virtual AnimationType GetType(void) const;
308 friend class _PointAnimationImpl;
312 // This variable is for internal use only. Using this variable can cause behavioral, security-related,
313 // and consistency-related issues in the application.
315 // This variable is for internal usage.
319 class _PointAnimationImpl* _pPointAnimationImpl;
324 // This method is for internal use only. Using this method can cause behavioral, security-related,
325 // and consistency-related issues in the application.
327 // This is the default constructor for this class.
331 PointAnimation(void);
335 }}} // Tizen::Ui::Animations
337 #endif // _FUI_ANIM_POINT_ANIMATION_H_