Merge "Unchecked GetCharacter func when index is over string length" into tizen_2.2
[platform/framework/native/uifw.git] / inc / FUiAnimFrameAnimator.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        FUiAnimFrameAnimator.h
20  * @brief       This is the header file for the %FrameAnimator class.
21  *
22  * This header file contains the declarations of the %FrameAnimator class.
23  */
24
25 #ifndef _FUI_ANIM_FRAME_ANIMATOR_H_
26 #define _FUI_ANIM_FRAME_ANIMATOR_H_
27
28 #include <FUiAnimIFrameAnimatorEventListener.h>
29
30
31 namespace Tizen { namespace Ui {  namespace Controls
32 {
33 class Form;
34 class _FrameImpl;
35 } } }
36
37 namespace Tizen { namespace Ui { namespace Animations
38 {
39
40
41 /**
42  * @class       FrameAnimator
43  * @brief       This class defines the animation methods for Frame.
44  *
45  * @since       2.0
46  *
47  * @final   This class is not intended for extension.
48  *
49  * The %FrameAnimator class is used to control the animations operated on a Frame.
50  *
51  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/animating_formstransition.htm">Animating a Form Transition</a>.
52  *
53  */
54 class _OSP_EXPORT_ FrameAnimator
55         : public Tizen::Base::Object
56 {
57 public:
58
59         /**
60          * This is the destructor for this class.
61          *
62          * @since       2.0
63          */
64         virtual ~FrameAnimator(void);
65
66
67         /**
68          * Adds an IFrameAnimatorEventListener instance to the current instance of the frame. @n
69          * The added listener can listen to events on the given event dispatcher's context when they are fired.
70          *
71          * @since       2.0
72          *
73          * @return              An error code
74          * @param[in]   listener                                The listener to add
75          * @exception   E_SUCCESS                               The method is successful.
76          * @exception   E_UNSUPPORTED_OPERATION The animation support is unavailable.
77          * @exception   E_OBJ_ALREADY_EXIST             The specified @c listener is already added.
78          * @exception   E_SYSTEM                                A system error has occurred.
79          */
80         result AddFrameAnimatorEventListener(IFrameAnimatorEventListener& listener);
81
82
83         /**
84          * Removes an IFrameAnimatorEventListener instance from the current instance of the frame. @n
85          * The removed listener cannot listen to events when they are fired.
86          *
87          * @since       2.0
88          *
89          * @return              An error code
90          * @param[in]   listener                                The listener to remove
91          * @exception   E_SUCCESS                               The method is successful.
92          * @exception   E_UNSUPPORTED_OPERATION The animation support is unavailable.
93          * @exception   E_OBJ_NOT_FOUND                 The specified @c listener is not found.
94          * @exception   E_SYSTEM                                A system error has occurred.
95          */
96         result RemoveFrameAnimatorEventListener(IFrameAnimatorEventListener& listener);
97
98
99         /**
100          * Gets the animation status of the frame animator.
101          *
102          * @since       2.0
103          *
104          * @return      The animation state of the frame animator
105          */
106         AnimatorStatus GetStatus(void) const;
107
108
109         /**
110          * Sets the specified form as the current form of the frame with an animation.
111          *
112          * @brief       <i> [Deprecated] </i>
113          * @deprecated  This method is deprecated.
114          * @since       2.0
115          *
116          * @return              An error code
117          * @param[in]   form                            The form object to set
118          * @exception   E_SUCCESS                               The method is successful.
119          * @exception   E_INVALID_OPERATION             The current state of the instance prohibits the execution of the specified operation.
120          * @exception   E_SYSTEM                                A system error has occurred.
121          * @remarks             Control::Invalidate() need not be called to display the form. @n
122          *                              To select the animation to be used during this method, use SetFormTransitionAnimation() before calling this method.
123          */
124         result SetCurrentForm(const Tizen::Ui::Controls::Form& form);
125
126         /**
127          * Sets a specified form as the current form of the frame with an animation.
128          *
129          * @since       2.1
130          *
131          * @return              An error code
132          * @param[in]           pForm                           A pointer to Form object to set
133          * @exception     E_SUCCESS                             The method is successful.
134          * @exception   E_INVALID_ARG                             The specified @c pForm is @c null.
135          * @exception   E_INVALID_OPERATION             The current state of the instance prohibits the execution of the specified operation.
136          * @exception     E_SYSTEM                              A system error has occurred.
137          * @remarks             Control::Invalidate() need not be called to display the form. @n
138          *                              To select the animation that is used during this method, use SetFormTransitionAnimation() before calling this method.
139          */
140         result SetCurrentForm(Tizen::Ui::Controls::Form* pForm);
141
142
143         /**
144          * Sets the type of the form transition animation.
145          *
146          * @since       2.0
147          *
148          * @param[in]   animation                       The type of form transition animation to set
149          * @param[in]   duration                        The duration of animation in milliseconds @n
150          *                                                                      The maximum duration is one second.
151          * @param[in]   interpolator            The type of interpolator used for the intermediate value calculation of the animation
152          */
153         void SetFormTransitionAnimation(FrameAnimatorFormTransitionAnimation animation, long duration, AnimationInterpolatorType interpolator);
154
155
156         /**
157          * Gets the type of the form transition animation.
158          *
159          * @since       2.0
160          *
161          * @param[out]  animation                       The type of form transition animation used
162          * @param[out]  duration                        The duration of animation in milliseconds
163          * @param[out]  interpolator            The type of interpolator used for the intermediate value calculation of the animation
164          */
165         void GetFormTransitionAnimation(FrameAnimatorFormTransitionAnimation& animation, long& duration, AnimationInterpolatorType& interpolator) const;
166
167
168         /**
169          * Sets the control points for the Bezier interpolator. @n
170          * The %SetFormTransitionBezierControlPoints() method is supported only if the interpolator is @c ANIMATION_INTERPOLATOR_BEZIER.
171          *
172          * @since       2.0
173          *
174          * @return              An error code
175          * @param[in]   time1                           The control point 1 - Time @n
176          *                                                                      The time must be within the range @c 0.0 to @c 1.0.
177          * @param[in]   value1                          The control point 1 - Value @n
178          *                                                                      The value must be within the range @c 0.0 to @c 1.0.
179          * @param[in]   time2                           The control point 2 - Time @n
180          *                                                                      The time must be within the range @c 0.0 to @c 1.0.
181          * @param[in]   value2                          The control point 2 - Value @n
182          *                                                                      The value must be within the range @c 0.0 to @c 1.0.
183          * @exception   E_SUCCESS                       The method is successful.
184          * @exception   E_INVALID_OPERATION The interpolator of this instance is not ANIMATION_INTERPOLATOR_BEZIER.
185          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
186          */
187         result SetFormTransitionBezierControlPoints(float time1, float value1, float time2, float value2);
188
189
190         /**
191          * Gets the control points of the Bezier interpolator. @n
192          * The %GetFormTransitionBezierControlPoints() method is supported only if the interpolator is @c ANIMATION_INTERPOLATOR_BEZIER. @n
193          * Therefore, @c 0 will be returned for other interpolators.
194          *
195          * @since       2.0
196          *
197          * @return              An error code
198          * @param[out]  time1                           The control point 1 - Time
199          * @param[out]  value1                          The control point 1 - Value
200          * @param[out]  time2                           The control point 2 - Time
201          * @param[out]  value2                          The control point 2 - Value
202          * @exception   E_SUCCESS                       The method is successful.
203          * @exception   E_INVALID_OPERATION The interpolator of this instance is not ANIMATION_INTERPOLATOR_BEZIER.
204          */
205         result GetFormTransitionBezierControlPoints(float& time1, float& value1, float& time2, float& value2) const;
206
207
208         /**
209          * Stops all the animations that are being played and jumps to the final frame of the animation.
210          *
211          * @since       2.0
212          *
213          * @return              An error code
214          * @exception   E_SUCCESS                       The method is successful.
215          * @exception   E_SYSTEM                        A system error has occurred.
216          */
217         result StopAllAnimations(void);
218
219
220 protected:
221
222         friend class _FrameAnimatorImpl;
223
224
225         //
226         // This variable is for internal use only. Using this variable can cause behavioral, security-related,
227         // and consistency-related issues in the application.
228         //
229         // The variable for internal usage.
230         //
231         // @since        2.0
232         //
233         class _FrameAnimatorImpl* _pFrameAnimatorImpl;
234
235
236 private:
237
238         //
239         // This method is for internal use only. Using this method can cause behavioral, security-related,
240         // and consistency-related issues in the application.
241         //
242         // This is the constructor for this class.
243         //
244         // @since       2.0
245         //
246         FrameAnimator(void);
247
248
249         //
250         // This method is for internal use only. Using this method can cause behavioral, security-related,
251         // and consistency-related issues in the application.
252         //
253         // Initializes this class.
254         //
255         // @since       2.0
256         // @return              An error code
257         // @param[in]   source                          An instance of the Frame class
258         // @exception   E_SUCCESS                       The method is successful.
259         // @exception   E_SYSTEM                        A system error has occurred.
260         //
261         result Construct(const Tizen::Ui::Controls::Frame& source);
262
263
264         //
265         // This method is for internal use only. Using this method can cause behavioral, security-related,
266         // and consistency-related issues in the application.
267         //
268         // This is the copy constructor for the %FrameAnimator class.
269         //
270         // @since       2.0
271         //
272         FrameAnimator(const FrameAnimator& rhs);
273
274
275         //
276         // This method is for internal use only. Using this method can cause behavioral, security-related,
277         // and consistency-related issues in the application.
278         //
279         // Assigns the value of the specified instance to the current instance of %FrameAnimator.
280         //
281         // @since       2.0
282         //
283         FrameAnimator& operator =(const FrameAnimator& rhs);
284
285
286         friend class Tizen::Ui::Controls::_FrameImpl;
287 };              // FrameAnimator
288
289
290 }}}             // Tizen::Ui::Animations
291
292 #endif //_FUI_ANIM_FRAME_ANIMATOR_H_