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 FUiAnimDimensionAnimation.h
20 * @brief This is the header file for the %DimensionAnimation class.
22 * This header file contains the declarations of the %DimensionAnimation class.
25 #ifndef _FUI_ANIM_DIMENSION_ANIMATION_H_
26 #define _FUI_ANIM_DIMENSION_ANIMATION_H_
28 #include <FGrpDimension.h>
29 #include <FGrpPoint.h>
31 #include <FUiAnimAnimationBase.h>
33 namespace Tizen { namespace Ui { namespace Animations
37 * @class DimensionAnimation
38 * @brief This class animates the Tizen::Graphics::Dimension object.
42 * @final This class is not intended for extension.
44 * The %DimensionAnimation class animates an object from a Tizen::Graphics::Dimension value to another %Tizen::Graphics::Dimension value
45 * based on the specified interpolator type.
47 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/animating_uicontrols.htm">Animating UI Controls</a>.
49 class _OSP_EXPORT_ DimensionAnimation
50 : public AnimationBase
54 * Initializes this instance of %DimensionAnimation with the specified parameters.
58 * @param[in] startValue The start value for the dimension animation
59 * @param[in] endValue The end value for the dimension animation
60 * @param[in] duration The duration of animation in milliseconds
61 * @param[in] interpolator The type of interpolator used for the animation's intermediate value calculation
62 * @exception E_SUCCESS The method is successful.
63 * @exception E_INVALID_ARG The value of the specified parameter is negative or the interpolator is of an invalid type.
64 * @remarks The specific error code can be accessed using the GetLastResult() method.
66 DimensionAnimation(const Tizen::Graphics::Dimension& startValue, const Tizen::Graphics::Dimension& endValue, long duration, AnimationInterpolatorType interpolator);
70 * This is the destructor for this class.
74 virtual ~DimensionAnimation(void);
77 * This is the copy constructor for the %DimensionAnimation class.
81 * @param[in] dimensionAnimation An instance of %DimensionAnimation
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 DimensionAnimation(const DimensionAnimation& dimensionAnimation);
90 * Assigns the value of the specified instance to the current instance of %DimensionAnimation.
94 * @param[in] rhs An instance of %DimensionAnimation
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 DimensionAnimation& operator =(const DimensionAnimation& rhs);
103 * Checks whether the specified instance and current instance of %DimensionAnimation have equal animation values.
107 * @return @c true if the animation of the two instances of %DimensionAnimation are equal, @n
109 * @param[in] rhs An instance of %DimensionAnimation
111 bool operator ==(const DimensionAnimation& rhs) const;
115 * Checks whether the specified instance and current instance of %DimensionAnimation have different animation values.
119 * @return @c true if the values of the animations of the two instances of %DimensionAnimation are not equal, @n
121 * @param[in] rhs An instance of %DimensionAnimation
123 bool operator !=(const DimensionAnimation& rhs) const;
127 * Checks whether the value of the current instance of %DimensionAnimation 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 %DimensionAnimation
134 * @remarks The %DimensionAnimation class has a semantic value that means 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
146 * distribution for all inputs.
148 virtual int GetHashCode(void) const;
152 * Sets the anchor points for the animation.
156 * @return An error code
157 * @param[in] anchorX The X value of the anchor at which the control's animation is performed
158 * @param[in] anchorY The Y value of the anchor at which the control's animation is performed
159 * @exception E_SUCCESS The method is successful.
160 * @exception E_INVALID_ARG A specified input parameter is invalid.
161 * @remarks A default anchor point value is (0.0, 0.0). The range of an anchor point is @c 0.0 to @c 1.0. @n
162 * When the anchor point value is (0.0, 0.0), the object is scaled and the top-left corner of the object remains fixed. @n
163 * For all the other anchor point values, the position property is changed.
164 * If the anchor point value is (0.5, 0.5), the object is scaled with respect to the center.
165 * If the anchor point value is (1.0, 1.0), the object is scaled and the bottom-right corner of the object remains fixed.
167 result SetAnchor(float anchorX, float anchorY);
171 * Gets the anchor point associated with the animation. @n
172 * The default anchor point is (0.0, 0.0).
176 * @param[out] anchorX The X value of the anchor at which the control's animation is performed
177 * @param[out] anchorY The Y value of the anchor at which the control's animation is performed
179 void GetAnchor(float& anchorX, float& anchorY) const;
183 * Gets the animated value for the current time.
187 * @return An error code
188 * @param[in] currentTime The current time value of the animation play @n
189 * The value must be between @c 0 and the duration of the animation.
190 * @param[out] animatedValue The animated value for the current time passed as the input parameter
191 * @exception E_SUCCESS The method is successful.
192 * @exception E_INVALID_ARG A specified input parameter is invalid.
193 * @exception E_SYSTEM A system error has occurred.
196 result GetAnimatedValue(long currentTime, Tizen::Graphics::Dimension& animatedValue) const;
200 * Adds a keyframe to the animation.
204 * @return An error code
205 * @param[in] time The time stamp
206 * @param[in] value The value at the specified @c time
207 * @exception E_SUCCESS The method is successful.
208 * @exception E_INVALID_ARG A specified input parameter is invalid.
209 * @exception E_SYSTEM A system error has occurred.
210 * @remarks If @c time is greater than the duration, it will become the new duration and @c value becomes the new @c endValue. @n
211 * Also, the old duration and @c endValue will be added as a new key frame entry in the list. @n
212 * If a key-value pair with the current key already exists, the old value will be overwritten with the new one. @n
213 * An exception will be returned if @c time is equal to @c 0 or the duration of the animation.
215 result AddKeyFrame(long time, const Tizen::Graphics::Dimension& value);
219 * Gets the keyframe at a particular index in this animation.
223 * @return An error code
224 * @param[in] index The index value in the keyframe list that is sorted in an increasing order of time
225 * @param[out] time The time stamp at the specified @c index
226 * @param[out] value The value at the specified @c index
227 * @exception E_SUCCESS The method is successful.
228 * @exception E_OUT_OF_RANGE The specified @c index is out of range.
229 * @exception E_SYSTEM A system error has occurred.
230 * @remarks The @c time and @c value returned is the one present at the index of the sorted map list(sorted with respect to key). @n
231 * For example, if the user adds key-frame in the order (10,value1), (20,value2), (5,value3) and then GetKeyFrameAt(0,time,value) is called, the
232 * pair returned is (5,value3).
234 result GetKeyFrameAt(int index, long& time, Tizen::Graphics::Dimension& value) const;
238 * Removes the passed keyframe object from the keyframe list.
242 * @return An error code
243 * @param[in] time The key frame time
244 * @exception E_SUCCESS The method is successful.
245 * @exception E_INVALID_ARG The keyframe @c time value is invalid.
246 * @exception E_OBJ_NOT_FOUND The keyframe @c time value is not found in the keyframe List.
247 * @exception E_SYSTEM A system error has occurred.
249 result RemoveKeyFrame(long time);
253 * Removes the keyframe present at the specified @c index from the keyframe list.
257 * @return An error code
258 * @param[in] index The index value in the Keyframe list @n
259 * The value is sorted in an increasing order of time.
260 * @exception E_SUCCESS The method is successful.
261 * @exception E_OUT_OF_RANGE The specified @c index parameter is out of range.
262 * @exception E_SYSTEM A system error has occurred.
264 result RemoveKeyFrameAt(int index);
268 * Removes all the keyframes from the animation.
272 * @return An error code
273 * @exception E_SUCCESS The method is successful.
274 * @exception E_SYSTEM A system error has occurred.
276 result RemoveAllKeyFrames(void);
280 * Sets the start value of the animation.
284 * @return An error code
285 * @param[in] startValue The start value of the animation to set
286 * @exception E_SUCCESS The method is successful.
287 * @exception E_INVALID_ARG The specified input parameter is invalid.
288 * @exception E_SYSTEM A system error has occurred.
290 result SetStartValue(const Tizen::Graphics::Dimension& startValue);
294 * Sets the end value of the animation.
298 * @return An error code
299 * @param[in] endValue The end value of the animation to set
300 * @exception E_SUCCESS The method is successful.
301 * @exception E_INVALID_ARG The specified input parameter is invalid.
302 * @exception E_SYSTEM A system error has occurred.
304 result SetEndValue(const Tizen::Graphics::Dimension& endValue);
308 * Gets the start value of the animation.
312 * @return The start value
314 Tizen::Graphics::Dimension GetStartValue(void) const;
318 * Gets the end value of the animation.
322 * @return The end value
324 Tizen::Graphics::Dimension GetEndValue(void) const;
328 * Gets the animation type information of this instance.
332 * @return The animation type information of this instance
334 virtual AnimationType GetType(void) const;
338 friend class _DimensionAnimationImpl;
342 // This variable is for internal use only. Using this variable can cause behavioral, security-related,
343 // and consistency-related issues in the application.
345 // The variable for internal usage.
349 class _DimensionAnimationImpl* _pDimensionAnimationImpl;
354 // This method is for internal use only. Using this method can cause behavioral, security-related,
355 // and consistency-related issues in the application.
357 // This is the default constructor for this class.
361 DimensionAnimation(void);
362 }; // DimensionAnimation
365 }}} // Tizen::Ui::Animations
367 #endif // _FUI_ANIM_DIMENSION_ANIMATION_H_