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 FUiAnimIntegerAnimation.h
20 * @brief This is the header file for the %IntegerAnimation class.
22 * This header file contains the declarations of the %IntegerAnimation class.
25 #ifndef _FUI_ANIM_INTEGER_ANIMATION_H_
26 #define _FUI_ANIM_INTEGER_ANIMATION_H_
28 #include <FBaseInteger.h>
29 #include <FUiAnimAnimationBase.h>
31 namespace Tizen { namespace Ui { namespace Animations
35 * @class IntegerAnimation
36 * @brief This class animates an object from an integer value to another integer value.
40 * @final This class is not intended for extension.
42 * The %IntegerAnimation class animates an object from an integer value to another integer value based on the specified interpolator type.
44 * 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 class _OSP_EXPORT_ IntegerAnimation
47 : public AnimationBase
51 * Initializes this instance of %IntegerAnimation with the specified parameters.
55 * @param[in] startValue The start value for Integer animation
56 * @param[in] endValue The end value for Integer animation
57 * @param[in] duration The duration of animation in milliseconds
58 * @param[in] interpolator The type of Interpolation @n
59 * This is used for the intermediate value calculation of the animation.
60 * @exception E_SUCCESS The method is successful.
61 * @exception E_INVALID_ARG The value of the specified parameter is negative or the interpolator is of an invalid type.
62 * @remarks The specific error code can be accessed using the GetLastResult() method.
64 IntegerAnimation(int startValue, int endValue, long duration, AnimationInterpolatorType interpolator);
68 * This is the destructor for this class.
72 virtual ~IntegerAnimation(void);
76 * This is the copy constructor for the %IntegerAnimation class.
80 * @param[in] integerAnimation An instance of %IntegerAnimation
81 * @exception E_SUCCESS The method is successful.
82 * @exception E_OUT_OF_MEMORY The memory is insufficient.
83 * @remarks The specific error code can be accessed using the GetLastResult() method.
85 IntegerAnimation(const IntegerAnimation& integerAnimation);
89 * Assigns the value of the specified instance to the current instance of %IntegerAnimation.
93 * @param[in] rhs An instance of %IntegerAnimation
94 * @exception E_SUCCESS The method is successful.
95 * @exception E_OUT_OF_MEMORY The memory is insufficient.
96 * @remarks The specific error code can be accessed using the GetLastResult() method.
98 IntegerAnimation& operator =(const IntegerAnimation& rhs);
102 * Checks whether the specified and current instance of %IntegerAnimation have equal animation values.
106 * @return @c true if the animation of the two instances of %IntegerAnimation are equal, @n
108 * @param[in] rhs An instance of %IntegerAnimation
110 bool operator ==(const IntegerAnimation& rhs) const;
114 * Checks whether the specified instance and the current instance of %IntegerAnimation have different animation values.
118 * @return @c true if the values of the animations of the two instances of %IntegerAnimation are not equal, @n
120 * @param[in] rhs An instance of %IntegerAnimation
122 bool operator !=(const IntegerAnimation& rhs) const;
126 * Checks whether the value of the current instance of %IntegerAnimation equals the value of the specified instance.
130 * @return @c true if the value of the current instance equals the value of the specified instance, @n
132 * @param[in] obj An instance of %IntegerAnimation
133 * @remarks The %IntegerAnimation class has a semantic value. @n
134 * This means that this method checks whether the two instances have the same animation.
136 virtual bool Equals(const Tizen::Base::Object& obj) const;
140 * Gets the hash value of the current instance.
144 * @return The hash value of the current instance
145 * @remarks The two equal instances must return the same hash value. For better performance, the used hash function must generate a random distribution for all inputs.
147 virtual int GetHashCode(void) const;
151 * Gets the animated value for the current time.
155 * @return An error code
156 * @param[in] currentTime The current time value of the animation play @n
157 * The value must be between @c 0 and the duration of the animation.
158 * @param[out] animatedValue The animated value for the current time @n
159 * The value is passed as the input parameter.
160 * @exception E_SUCCESS The method is successful.
161 * @exception E_INVALID_ARG A specified input parameter is invalid.
162 * @exception E_SYSTEM A system error has occurred.
165 result GetAnimatedValue(long currentTime, int& animatedValue) const;
169 * Adds a key frame to the animation.
173 * @return An error code
174 * @param[in] time The time stamp
175 * @param[in] value The value at the specified @c time
176 * @exception E_SUCCESS The method is successful.
177 * @exception E_INVALID_ARG A specified input parameter is invalid.
178 * @exception E_SYSTEM A system error has occurred.
179 * @remarks If @c time is greater than the duration, it becomes the new duration and @c value becomes the new @c endValue.
180 * Also the old duration and @c endValue are added as a new keyframe entry in the list.
181 * @remarks If a key-value pair with the current key already exists, the old value is overwritten with the new one.
182 * @remarks An exception is returned if @c time is equal to @c 0 or the duration of the animation.
184 result AddKeyFrame(long time, int value);
188 * Gets the keyframe at a particular index in this animation.
192 * @return An error code
193 * @param[in] index The index value in the Keyframe list @n
194 * The value is sorted in an increasing order of time.
195 * @param[out] time The time stamp at the specified @c index
196 * @param[out] value The value at the specified @c index
197 * @exception E_SUCCESS The method is successful.
198 * @exception E_OUT_OF_RANGE The specified @c index is out of range.
199 * @exception E_SYSTEM A system error has occurred.
200 * @remarks The @c time and @c value returned are present at the index of the sorted map list (sorted with respect to key).
201 * For example, if the user adds keyframe in the order (10,value1), (20,value2), (5,value3), and then
202 * GetKeyFrameAt(0,time,value) is called, the pair returned is (5,value3).
204 result GetKeyFrameAt(int index, long& time, int& value) const;
208 * Removes the specified keyframe object from the keyframe list.
212 * @return An error code
213 * @param[in] time The key frame time
214 * @exception E_SUCCESS The method is successful.
215 * @exception E_INVALID_ARG The specified @c time value is invalid.
216 * @exception E_OBJ_NOT_FOUND The specified @c time is not found in the KeyFrame List.
217 * @exception E_SYSTEM A system error has occurred.
219 result RemoveKeyFrame(long time);
223 * Removes the keyframe present at the specified @c index from the keyframe list.
227 * @return An error code
228 * @param[in] index The index value in the Keyframe list @n
229 * The value is sorted in an increasing order of time.
230 * @exception E_SUCCESS The method is successful.
231 * @exception E_OUT_OF_RANGE The specified @c index is out of range.
232 * @exception E_SYSTEM A system error has occurred.
234 result RemoveKeyFrameAt(int index);
238 * Removes all the keyframes from an animation.
242 * @return An error code
243 * @exception E_SUCCESS The method is successful.
244 * @exception E_SYSTEM A system error has occurred.
246 result RemoveAllKeyFrames(void);
250 * Sets the start value of the animation.
254 * @return An error code
255 * @param[in] startValue The start value of the animation to set
256 * @exception E_SUCCESS The method is successful.
257 * @exception E_SYSTEM A system error has occurred.
259 result SetStartValue(int startValue);
263 * Sets the end value of the animation.
267 * @return An error code
268 * @param[in] endValue The end value of the animation to set
269 * @exception E_SUCCESS The method is successful.
270 * @exception E_SYSTEM A system error has occurred.
272 result SetEndValue(int endValue);
276 * Gets the start value of the animation.
280 * @return The start value
282 int GetStartValue(void) const;
286 * Gets the end value of the animation.
290 * @return The end value
292 int GetEndValue(void) const;
296 * Gets the type information of this instance.
300 * @return The type information of this instance
302 virtual AnimationType GetType(void) const;
306 friend class _IntegerAnimationImpl;
310 // This method is for internal use only. Using this method can cause behavioral, security-related,
311 // and consistency-related issues in the application.
313 // This variable is for internal usage.
317 class _IntegerAnimationImpl* _pIntegerAnimationImpl;
321 // This method is for internal use only. Using this method can cause behavioral, security-related,
322 // and consistency-related issues in the application.
324 // This is the default constructor for this class.
328 IntegerAnimation(void);
329 }; // IntegerAnimation
332 }}} // Tizen::Ui::Animations
334 #endif // _FUI_ANIM_INTEGER_ANIMATION_H_