Merge "Unchecked GetCharacter func when index is over string length" into tizen_2.2
[platform/framework/native/uifw.git] / inc / FUiAnimVisualElementValueAnimation.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
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        FUiAnimVisualElementValueAnimation.h
20  * @brief       This is the header file for the %VisualElementValueAnimation class.
21  *
22  * This header file contains the declarations of the %VisualElementValueAnimation class.
23  */
24
25 #ifndef _FUI_ANIM_VISUAL_ELEMENT_VALUE_ANIMATION_H_
26 #define _FUI_ANIM_VISUAL_ELEMENT_VALUE_ANIMATION_H_
27
28 #include <FUiVariant.h>
29 #include <FUiAnimVisualElementAnimation.h>
30
31 namespace Tizen { namespace Ui { namespace Animations
32 {
33
34
35 class IVisualElementAnimationTickEventListener;
36 class _VisualElementValueAnimationImpl;
37
38 /**
39  * @class       VisualElementValueAnimation
40  * @brief       This class is for value animation.
41  *
42  * @since       2.0
43  *
44  * The %VisualElementValueAnimation class defines the basic value animation.
45  */
46 class _OSP_EXPORT_ VisualElementValueAnimation
47         : public VisualElementAnimation
48 {
49 public:
50
51         /**
52          * This is the default constructor for this class.
53          *
54          * @since       2.0
55          *
56          * @exception   E_SUCCESS               The method is successful.
57          * @exception   E_OUT_OF_MEMORY The memory is insufficient.
58          * @remarks             The specific error code can be accessed using the GetLastResult() method.
59          */
60         VisualElementValueAnimation(void);
61
62
63         /**
64          * This is the destructor for this class.
65          *
66          * @since       2.0
67          */
68         virtual ~VisualElementValueAnimation(void);
69
70
71         /**
72          * This is the copy constructor for the %VisualElementValueAnimation class.
73          *
74          * @since       2.0
75          *
76          * @param[in]   animation       An instance of %VisualElementValueAnimation
77          * @exception   E_SUCCESS               The method is successful.
78          * @exception   E_OUT_OF_MEMORY The memory is insufficient.
79          * @remarks             The specific error code can be accessed using the GetLastResult() method.
80          */
81         VisualElementValueAnimation(const VisualElementValueAnimation& animation);
82
83
84         /**
85          * Assigns the value of the specified instance to the current instance of %VisualElementValueAnimation.
86          *
87          * @since       2.0
88          *
89          * @param[in]   rhs             An instance of %VisualElementValueAnimation
90          * @exception   E_SUCCESS               The method is successful.
91          * @exception   E_OUT_OF_MEMORY The memory is insufficient.
92          * @remarks             The specific error code can be accessed using the GetLastResult() method.
93          */
94         VisualElementValueAnimation& operator =(const VisualElementValueAnimation& rhs);
95
96
97         /**
98          * Checks whether the specified instance and current instance of %VisualElementValueAnimation have equal animation values.
99          *
100          * @since       2.0
101          *
102          * @return      @c true if the animation of the two instances of %VisualElementValueAnimation are equal, @n
103          *              else @c false
104          * @param[in]   rhs             An instance of %VisualElementValueAnimation
105          */
106         bool operator ==(const VisualElementValueAnimation& rhs) const;
107
108
109         /**
110          * Checks whether the specified instance and current instance of %VisualElementValueAnimation have different animation values.
111          *
112          * @since       2.0
113          *
114          * @return      @c true if the values of the animations of the two instances of %VisualElementValueAnimation are not equal, @n
115          *              else @c false
116          * @param[in]   rhs             An instance of %VisualElementValueAnimation
117          */
118         bool operator !=(const VisualElementValueAnimation& rhs) const;
119
120
121         /**
122          * Checks whether the value of the current instance of %VisualElementValueAnimation equals the value of the specified instance.
123          *
124          * @since       2.0
125          *
126          * @return      @c true if the value of the current instance equals the value of the specified instance, @n
127          *               else @c false
128          * @param[in]   obj             An instance of %VisualElementValueAnimation
129          * @remarks     The %VisualElementValueAnimation class has a semantic value which means that this method checks whether the two instances have the same animation.
130          */
131         virtual bool Equals(const Tizen::Base::Object& obj) const;
132
133
134         /**
135          * Gets the hash value of the current instance.
136          *
137          * @since       2.0
138          *
139          * @return      The hash value of the current instance
140          * @remarks     The two equal instances must return the same hash value.
141          *                              For better performance, the used hash function must generate a random distribution for all inputs.
142          */
143         virtual int GetHashCode(void) const;
144
145
146         /**
147          * Gets the copied instance of the class.
148          *
149          * @since   2.0
150          *
151          * @return      An instance of %VisualElementAnimation
152          * @exception   E_SUCCESS               The method is successful.
153          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
154          * @remarks             The specific error code can be accessed using the GetLastResult() method.
155          */
156         virtual VisualElementAnimation* CloneN(void) const;
157
158
159         /**
160          * Sets an IVisualElementAnimationTickEventListener listener instance to listen to the events of a particular animation. @n
161          * The set listener, %IVisualElementAnimationTickEventListener, can listen to events on the specified event dispatcher's context when they are fired.
162          *
163          * @since       2.0
164          *
165          * @param[in]   pListener               The listener to set
166          */
167         void SetVisualElementAnimationTickEventListener(IVisualElementAnimationTickEventListener* pListener);
168
169
170         /**
171          * Gets the IVisualElementAnimationTickEventListener listener.
172          *
173          * @since                2.0
174          *
175          * @return                                 A pointer to the IVisualElementAnimationTickEventListener instance @n
176          *                                                                               If listener has not been set, @c null is returned.
177          * @see SetVisualElementAnimationTickEventListener()
178          */
179         IVisualElementAnimationTickEventListener* GetVisualElementAnimationTickEventListener(void) const;
180
181
182         /**
183          * Sets the start value of the animation.
184          *
185          * @since       2.0
186          *
187          * @return      An error code
188          * @param[in]   startValue              The start value of the animation to set
189          * @exception   E_SUCCESS               The method is successful.
190          * @exception   E_INVALID_ARG           The type of Variant is empty.
191          * @see         GetStartValue()
192          */
193         result SetStartValue(const Tizen::Ui::Variant& startValue);
194
195
196         /**
197          * Gets the start value of the animation.
198          *
199          * @since       2.0
200          *
201          * @return      The start value of animation
202          * @see         SetStartValue()
203          */
204         Tizen::Ui::Variant GetStartValue(void) const;
205
206
207         /**
208          * Sets the end value of the animation.
209          *
210          * @since       2.0
211          *
212          * @return      An error code
213          * @param[in]   endValue                The end value of the animation to set
214          * @exception   E_SUCCESS               The method is successful.
215          * @exception   E_INVALID_ARG           The type of Variant is empty.
216          * @see         GetEndValue()
217          */
218         result SetEndValue(const Tizen::Ui::Variant& endValue);
219
220
221         /**
222          * Gets the end value of the animation.
223          *
224          * @since       2.0
225          *
226          * @return      The end value of animation
227          * @see         SetEndValue()
228          */
229         Tizen::Ui::Variant GetEndValue(void) const;
230
231
232         /**
233          * Sets the flag to apply the end value of the animation when the animation is finished.
234          *
235          * @since       2.0
236          *
237          * @param[in]   apply   Set to @c true to apply the end values of the animation, @n
238          *                                              else @c false
239          * @remarks             There is no difference in behavior with this method in value animation. @n
240          *                              So you must set the end value by seeing this value.
241          * @see         IsEndValueApplied()
242          */
243         void SetEndValueApplied(bool apply);
244
245
246         /**
247          * Checks whether the end value of the animation is applied when the animation is finished.
248          *
249          * @since       2.0
250          *
251          * @return      @c true if the end value is applied, @n
252          *                      else @c false @n
253          *                      The default value is @c true.
254          * @see         SetEndValueApplied()
255          */
256         bool IsEndValueApplied(void) const;
257
258
259         /**
260          * Adds the key frame information for the animation.
261          *
262          * @since       2.0
263          *
264          * @return      An error code
265          * @param[in]   timeProgress            The specified time progress value @n
266          *                                              This must be in the range @c 0.0 to @c 1.0 and cannot be @c 0.0 and @c 1.0.
267          * @param[in]   value                           The value at the specified time
268          * @param[in]   pTimingFunction         The timing function instance that is used in keyframe segment
269          * @exception   E_SUCCESS                       The method is successful.
270          * @exception   E_INVALID_ARG           The specified @c value parameter is invalid.
271          * @exception   E_OUT_OF_RANGE          The specified @c timeProgress is not within the range @c 0 to @c 1 (exclusive).
272          * @remarks             If a key-value pair with the current key already exists, the old value is overwritten with the new one.
273          *                      If timing function is @c null, the default timing function is applied.
274          *                      The timing function is applied to current pace from previous pace.
275          * @see         RemoveKeyFrame()
276          * @see         RemoveAllKeyFrames()
277          */
278         result AddKeyFrame(float timeProgress, const Tizen::Ui::Variant& value, const IVisualElementAnimationTimingFunction* pTimingFunction = null);
279
280
281         /**
282          * Removes the key frame information for the animation.
283          *
284          * @since       2.0
285          *
286          * @return      An error code
287          * @param[in]   timeProgress            The time progress for the key frame to remove
288          *                                      This must be in the range @c 0.0 to @c 1.0 and cannot be @c 0.0 and @c 1.0.
289          * @exception   E_SUCCESS                       The method is successful.
290          * @exception   E_OUT_OF_RANGE          The value of the specified parameter is not within the range @c 0 to @c 1 (exclusive).
291          * @exception   E_OBJ_NOT_FOUND         The key frame with @c timeProgress does not exist.
292          * @see         AddKeyFrame()
293          * @see         RemoveAllKeyFrames()
294          */
295         result RemoveKeyFrame(float timeProgress);
296
297
298         /**
299          * Removes all the key frame information for the animation.
300          *
301          * @since       2.0
302          *
303          * @see         AddKeyFrame()
304          * @see         RemoveKeyFrame()
305          */
306         void RemoveAllKeyFrames(void);
307
308
309 protected:
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 is the constructor for derived classes.
316         //
317         // @since  2.0
318         //
319         VisualElementValueAnimation(_VisualElementValueAnimationImpl* pImpl);
320
321
322         friend class _VisualElementValueAnimationImpl;
323 };              // VisualElementValueAnimation
324
325
326 }}}             // Tizen::Ui::Animations
327
328 #endif  // _FUI_ANIM_VISUAL_ELEMENT_VALUE_ANIMATION_H_
329