2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0/
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 FUiAnimRectangleAnimation.h
20 * @brief This is the header file for the %RectangleAnimation class.
22 * This header file contains the declarations of the %RectangleAnimation class.
25 #ifndef _FUI_ANIM_RECTANGLE_ANIMATION_H_
26 #define _FUI_ANIM_RECTANGLE_ANIMATION_H_
28 #include <FGrpRectangle.h>
29 #include <FGrpPoint.h>
30 #include <FUiAnimAnimationBase.h>
32 namespace Tizen { namespace Ui { namespace Animations
36 * @class RectangleAnimation
37 * @brief This class animates the %Tizen::Graphics::Rectangle object.
41 * @final This class is not intended for extension.
43 * The %RectangleAnimation class animates an object from a Tizen::Graphics::Rectangle value to another %Rectangle value 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_ RectangleAnimation
48 : public AnimationBase
53 * Initializes this instance of %RectangleAnimation with the specified parameters.
57 * @param[in] startValue The start value for rectangle animation
58 * @param[in] endValue The end value for rectangle animation
59 * @param[in] duration The duration of animation in milliseconds
60 * @param[in] interpolator The type of interpolator @n
61 * This is used for the intermediate value calculation of the animation.
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 RectangleAnimation(const Tizen::Graphics::Rectangle& startValue, const Tizen::Graphics::Rectangle& endValue, long duration, AnimationInterpolatorType interpolator);
70 * This is the destructor for this class.
74 virtual ~RectangleAnimation(void);
78 * This is the copy constructor for the %RectangleAnimation class.
82 * @param[in] rectangleAnimation An instance of %RectangleAnimation
83 * @exception E_SUCCESS The method is successful.
84 * @exception E_OUT_OF_MEMORY The memory is insufficient.
85 * @remarks The specific error code can be accessed using the GetLastResult() method.
87 RectangleAnimation(const RectangleAnimation& rectangleAnimation);
91 * Assigns the value of the specified instance to the current instance of %RectangleAnimation.
95 * @param[in] rhs An instance of %RectangleAnimation
96 * @exception E_SUCCESS The method is successful.
97 * @exception E_OUT_OF_MEMORY The memory is insufficient.
98 * @remarks The specific error code can be accessed using the GetLastResult() method.
100 RectangleAnimation& operator =(const RectangleAnimation& rhs);
104 * Checks whether the specified instance and the current instance of %RectangleAnimation have equal animation values.
108 * @return @c true if the animation of the two instances of %RectangleAnimation have equal values, @n
110 * @param[in] rhs An instance of %RectangleAnimation
112 bool operator ==(const RectangleAnimation& rhs) const;
116 * Checks whether the specified instance and the current instance of %RectangleAnimation have different animation values.
120 * @return @c true if the values of the animations of the two instances of %RectangleAnimation are not equal, @n
122 * @param[in] rhs An instance of %RectangleAnimation
124 bool operator !=(const RectangleAnimation& rhs) const;
128 * Checks whether the value of the current instance of %RectangleAnimation is equal to the value of the specified instance.
132 * @return @c true if the value of the current instance is equal to the value of the specified instance, @n
134 * @param[in] obj An instance of %RectangleAnimation
135 * @remarks The %RectangleAnimation class has a semantic value. This means that this method checks whether the two instances have the same
138 virtual bool Equals(const Tizen::Base::Object& obj) const;
142 * Gets the hash value of the current instance.
146 * @return The hash value of the current instance
147 * @remarks The two equal instances must return the same hash value. For better performance, the used hash function must generate a random
148 * distribution for all inputs.
150 virtual int GetHashCode(void) const;
154 * Sets the anchor points for the animation.
158 * @param[in] anchorX The X value of the anchor @n
159 * The control's animation is performed at this point. The range of the anchor point is @c 0.0 to @c 1.0.
160 * @param[in] anchorY The Y value of the anchor @n
161 * The control's animation is performed at this point. The range of the anchor point is @c 0.0 to @c 1.0.
162 * @exception E_SUCCESS The method is successful.
163 * @exception E_INVALID_ARG A specified input parameter is invalid.
164 * @remarks The default anchor point value is (0.0, 0.0). The range of an anchor point is @c 0.0 to @c 1.0. @n
165 * 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
166 * For all the other anchor point values, the position property is changed. @n
167 * If the anchor point value is (0.5, 0.5), the object is scaled with respect to the center. @n
168 * If the anchor point value is (1.0, 1.0), the object is scaled and the bottom-right corner of the object remains fixed.
170 result SetAnchor(float anchorX, float anchorY);
174 * Gets the anchor point associated with the animation. @n
175 * The default anchor point is (0.0, 0.0).
179 * @param[out] anchorX The X value of the anchor @n
180 * The control's animation is performed at this point.
181 * @param[out] anchorY The Y value of the anchor @n
182 * The control's animation is performed at this point.
184 void GetAnchor(float& anchorX, float& anchorY) const;
188 * Gets the animated value for the current time.
192 * @return An error code
193 * @param[in] currentTime The current time value of the animation play @n
194 * The value must be between @c 0 and the duration of the animation.
195 * @param[out] animatedValue The animated value for the current time passed as the input parameter
196 * @exception E_SUCCESS The method is successful.
197 * @exception E_INVALID_ARG A specified input parameter is invalid.
198 * @exception E_SYSTEM A system error has occurred.
201 result GetAnimatedValue(long currentTime, Tizen::Graphics::Rectangle& animatedValue) const;
205 * Adds a key frame to the animation.
209 * @return An error code
210 * @param[in] time The time stamp
211 * @param[in] value The value at the specified @c time
212 * @exception E_SUCCESS The method is successful.
213 * @exception E_INVALID_ARG A specified input parameter is invalid.
214 * @exception E_SYSTEM A system error has occurred.
215 * @remarks If @c time is greater than the duration, it becomes the new duration and @c value becomes the new end value. @n
216 * Also, the old duration and end value are added as a new keyframe entry in the list.
217 * @remarks If a key-value pair with the current key already exists, the old value is overwritten with the new one.
218 * @remarks An exception is returned if @c time is equal to @c 0 or the duration of the animation.
220 result AddKeyFrame(long time, const Tizen::Graphics::Rectangle& value);
224 * Gets the keyframe at a specified @c index in this animation.
228 * @return An error code
229 * @param[in] index The index value in the Keyframe list @n
230 * This is sorted in an increasing order of time.
231 * @param[out] time The time stamp at the specified @c index
232 * @param[out] value The value at the specified @c index
233 * @exception E_SUCCESS The method is successful.
234 * @exception E_OUT_OF_RANGE The specified @c index is out of range.
235 * @exception E_SYSTEM A system error has occurred.
236 * @remarks The @c time and @c value returned is the one present at the index of the sorted map list (sorted with respect to the key).
237 * For example, if the user adds keyframe in the order (10,value1), (20,value2), (5,value3), and then GetKeyFrameAt(0,time,value) is called,
238 * the pair returned is (5, value3).
240 result GetKeyFrameAt(int index, long& time, Tizen::Graphics::Rectangle& value) const;
244 * Removes the passed keyframe object from the keyframe list.
248 * @return An error code
249 * @param[in] time The key frame time
250 * @exception E_SUCCESS The method is successful.
251 * @exception E_INVALID_ARG The specified @c time value is invalid.
252 * @exception E_OBJ_NOT_FOUND The time passed is not found in the KeyFrame list.
253 * @exception E_SYSTEM A system error has occurred.
255 result RemoveKeyFrame(long time);
259 * Removes the keyframe present at the specified @c index from the keyframe list.
263 * @return An error code
264 * @param[in] index The index value in the Keyframe list @n
265 * This is sorted in an increasing order of time.
266 * @exception E_SUCCESS The method is successful.
267 * @exception E_OUT_OF_RANGE The specified @c index is out of range.
268 * @exception E_SYSTEM A system error has occurred.
270 result RemoveKeyFrameAt(int index);
274 * Removes all the keyframes from an animation.
278 * @return An error code
279 * @exception E_SUCCESS The method is successful.
280 * @exception E_SYSTEM A system error has occurred.
282 result RemoveAllKeyFrames(void);
286 * Sets the start value of the animation.
290 * @return An error code
291 * @param[in] startValue The start value of the animation to set
292 * @exception E_SUCCESS The method is successful.
293 * @exception E_INVALID_ARG The specified input parameter is invalid.
294 * @exception E_SYSTEM A system error has occurred.
296 result SetStartValue(const Tizen::Graphics::Rectangle& startValue);
300 * Sets the end value of the animation.
304 * @return An error code
305 * @param[in] endValue The end value of the animation to set
306 * @exception E_SUCCESS The method is successful.
307 * @exception E_INVALID_ARG The specified input parameter is invalid.
308 * @exception E_SYSTEM A system error has occurred.
310 result SetEndValue(const Tizen::Graphics::Rectangle& endValue);
314 * Gets the start value of the animation.
318 * @return The start value
320 Tizen::Graphics::Rectangle GetStartValue(void) const;
324 * Gets the end value of the animation.
328 * @return The end value
330 Tizen::Graphics::Rectangle GetEndValue(void) const;
334 * Gets the type information of this instance.
338 * @return The type information of this instance
340 virtual AnimationType GetType(void) const;
344 friend class _RectangleAnimationImpl;
348 // This variable is for internal use only. Using this variable can cause behavioral, security-related,
349 // and consistency-related issues in the application.
351 // This variable is for internal usage.
355 class _RectangleAnimationImpl* _pRectangleAnimationImpl;
360 // This method is for internal use only. Using this method can cause behavioral, security-related,
361 // and consistency-related issues in the application.
363 // This is the default constructor for this class.
367 RectangleAnimation(void);
368 }; // RectangleAnimation
371 }}} // Tizen::Ui::Animations
373 #endif // _FANIM_RECTANGLEANIMATION_H_