Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / animations / FUiAnim_ControlAnimatorImpl.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
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        FUiAnim_ControlAnimatorImpl.h
20  * @brief       Header file of  _ControlAnimatorImpl class
21  *
22  * This file contains declarations _ControlAnimatorImpl class.
23  */
24
25 #ifndef _FUI_ANIM_INTERNAL_CONTROL_ANIMATOR_IMPL_H_
26 #define _FUI_ANIM_INTERNAL_CONTROL_ANIMATOR_IMPL_H_
27
28 #include <FUiAnimControlAnimator.h>
29 #include <FUiAnimVisualElementAnimation.h>
30 #include <FUiAnimVisualElementAnimationGroup.h>
31 #include <FUiAnimIVisualElementAnimationStatusEventListener.h>
32 #include <FUiAnimIVisualElementAnimationTickEventListener.h>
33
34 #include "FUi_ControlImpl.h"
35
36
37 namespace Tizen { namespace Ui { namespace Animations
38 {
39 class VisualElement;
40 class BezierTimingFunction;
41
42 /**
43  * @enum        AnimationFormPosition
44  * Defines  the Form's position, either current or Next Form
45  * @since       2.0
46  */
47 enum AnimationFormPosition
48 {
49         ANIMATION_FORM_POSITION_CURRENT_FORM = 0, /**< Current Form*/
50         ANIMATION_FORM_POSITION_NEXT_FORM /**< Next Form */
51 };
52
53 enum StoredPropertyAnimationGroupType
54 {
55         PROPERTY_ANIMATION_GROUP_TYPE_NONE,
56         PROPERTY_ANIMATION_GROUP_TYPE_PARALLEL,
57         PROPERTY_ANIMATION_GROUP_TYPE_SEQUENTIAL
58 };
59
60 #define INTERPOLATOR_LINEAR     L"Linear"
61 #define INTERPOLATOR_EASEIN     L"EaseIn"
62 #define INTERPOLATOR_EASEOUT    L"EaseOut"
63 #define INTERPOLATOR_EASEINOUT  L"EaseInOut"
64 #define INTERPOLATOR_DISCRETE   L"Discrete"
65 #define INTERPOLATOR_BEZIER     L"Bezier"
66
67
68 /**
69  * @class       _ControlAnimatorImpl
70  * @brief       This class defines the animation API for Control
71  * @since       2.0
72  *
73  * The %_ControlAnimatorImpl class is used to control the animations operated on Tizen::UiControls
74  *
75  */
76 class _ControlAnimatorImpl
77         : public Tizen::Base::Object
78         , public Tizen::Ui::Animations::IVisualElementAnimationStatusEventListener
79         , virtual public Tizen::Base::Runtime::IEventListener
80         , public Tizen::Ui::Animations::IVisualElementAnimationTickEventListener
81 {
82 public:
83         /**
84          * Destructor for %_ControlAnimatorImpl class.
85          *
86          * @since 2.0
87          */
88         ~_ControlAnimatorImpl(void);
89
90         /**
91          * Default constructor for %_ControlAnimatorImpl class.
92          *
93          * @since 2.0
94          */
95         _ControlAnimatorImpl(ControlAnimator* pAnimator);
96
97         /**
98          * Initializes this %_ControlAnimatorImpl class.
99          *
100          * @since       2.0
101          * @return              An error code
102          * @exception   E_SUCCESS                       The method was successful.
103          * @exception   E_INVALID_STATE     This instance has already been constructed.
104          * @exception   E_OUT_OF_MEMORY     Insufficient memory.
105          * @exception   E_SYSTEM                        System error occurred.
106          */
107         result Construct(const Control& control);
108
109         /**
110          * Adds the %Animation to the ActiveAnimation List.
111          *
112          * @since       2.0
113          * @return              An error code
114          * @param[in]   animTarget                      %AnimationTarget
115          * @param[in]   animBase                        An object of %AnimationBase
116          * @param[in]   animNative                      An object of _Animation
117          * @param[in]   triggerType                     Trigger type
118          * @param[in]   animName                        Animation name (unique Id)
119          * @param[in]   pBezierTiming           Bezier timing function.
120          * @exception   E_SUCCESS                       The method was successful.
121          * @exception   E_SYSTEM                        A system error occurred.
122          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
123          */
124         result AddActiveAnimation(AnimationTargetType animTarget, AnimationBase& animBase, Tizen::Ui::Animations::VisualElementAnimation& animNative, ControlAnimatorTriggerType triggerType, const Tizen::Base::String& animName, BezierTimingFunction* pBezierTiming);
125
126         /**
127          * This is the copy constructor for this class.
128          *
129          * @since 2.0
130          * @param[in]   animator            Object to be copied
131          */
132         _ControlAnimatorImpl(const _ControlAnimatorImpl& rhs);
133
134         /**
135          * Gets the %Animation Name from the ActiveAnimation List attached against specified %AnimationTarget.
136          *
137          * @since               2.0
138          * @return              Animation name
139          * @param[in]   index                           Value at the index to be retrieved
140          */
141         Tizen::Base::String GetActiveAnimationAt(int index) const;
142
143         /**
144          * Gets the %Animation from the ActiveAnimation List attached against specified %AnimationTarget.
145          *
146          * @since               2.0
147          * @return              Animation Name
148          * @param[in]   index                           Value at the index to be retrieved
149          * @param[in]   animTrigger                     %ControlAnimatorTriggerType
150          */
151         Tizen::Base::String GetActiveAnimationAt(int index, ControlAnimatorTriggerType animTrigger) const;
152
153         /**
154          * Destroys the %Animation Name from the ActiveAnimation List after the specified %index
155          *
156          * @since               2.0
157          * @return              An error code
158          * @param[in]   preActiveAnimationCount         ActiveAnimationCount
159          * @exception   E_SUCCESS                                       The method was successful.
160          * @exception   E_SYSTEM                                        A system error occurred.
161          * @exception   E_INVALID_ARG                           A specified input parameter is invalid.
162          */
163         result DestroyAnimation(int preActiveAnimationCount);
164
165         /**
166          * Destroys the %Animation from the ActiveAnimation List after the specified %index
167          *
168          * @since               2.0
169          * @return              An error code
170          * @param[in]   animTarget                                      AnimationTargetType
171          * @param[in]   pAnimBase                                       An object of %AnimationBase
172          * @exception   E_SUCCESS                                       The method was successful.
173          * @exception   E_SYSTEM                                        A system error occurred.
174          * @exception   E_INVALID_ARG                           A specified input parameter is invalid.
175          */
176         result DestroyAnimation(AnimationBase& animBase, AnimationTargetType animTarget);
177
178         /**
179          * Gets the ActiveAnimation Count of type the ANimationTarget
180          *
181          * @since               2.0
182          * @return      Total number of ActiveAnimations added to the list
183          */
184         int GetActiveAnimationListCount(AnimationTargetType animTarget) const;
185
186         /**
187          * Gets the ActiveAnimation Count value
188          *
189          * @since               2.0
190          * @return      Total number of ActiveAnimations added to the list
191          */
192         int GetActiveAnimationListCount(void) const;
193
194         /**
195          * Removes the %Animation from the ActiveAnimation List at specified index.
196          *
197          * @since               2.0
198          * @return              An error code
199          * @param[in]   index                           Values at the index to be retrieved
200          * @exception   E_SUCCESS                       The method was successful.
201          * @exception   E_SYSTEM                        A system error occurred.
202          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
203          */
204         result RemoveAnimationAt(int index);
205
206         /**
207          * Removes all the %Animation from the ActiveAnimation List.
208          *
209          * @since               2.0
210          * @return              An error code
211          * @exception   E_SUCCESS                       The method was successful.
212          * @exception   E_SYSTEM                        A system error occurred.
213          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
214          */
215         result RemoveAllAnimations(void);
216
217         /**
218          * Sets an %Animation to a internal Layer.
219          *
220          * @since               2.0
221          * @return              An error code
222          * @param[in]   animTarget                      Property to be animated.
223          * @param[in]   animationBase           An object of type %AnimationBase.
224          * @param[in]   animType                        ControlAnimatorTriggerType
225          * @param[in]   pAnimGroup                      Animation Group object for sequence and parallel group animation
226          * @exception   E_SUCCESS                       The method was successful.
227          * @exception   E_INVALID_ARG           The specified parameter is invalid.
228          * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified operation.
229          * @exception   E_SYSTEM                        A system error occurred.
230          *
231          */
232         result SetAnimation(AnimationTargetType animTarget, AnimationBase& animationBase, ControlAnimatorTriggerType animType = ANIMATION_TRIGGER_USER, VisualElementAnimationGroup* pAnimGroup = null);
233
234         /**
235          * Returns a copy of %AnimationBase object.
236          *
237          * @since               2.0
238          * @return              An error code
239          * @param[in]   animTarget                      Property to be animated.
240          * @param[in]   animationBase           An object of type %AnimationBase whose copy is to be created
241          * @exception   null                            If the passed argument is invalid.
242          */
243         AnimationBase* CloneAnimation(AnimationTargetType animTarget, AnimationBase& animationBase);
244
245         /**
246          * Sets the property of the object with specified input
247          *
248          * @since               2.0
249          * @return              An error code
250          * @param[in]   animTarget                      Enumeration of animation target type
251          * @param[in]   animationBase           An instance of %AnimationBase object
252          */
253         result SetControlProperty(AnimationTargetType animTarget, AnimationBase& animationBase);
254
255         /**
256          * Checks for the property change is valid on a control
257          *
258          * @since               2.0
259          * @return              An error code
260          * @param[in]   animTarget                      Enumeration of animation target type
261          * @param[in]   rect                            Bounds of a %Control
262          * @param[in]   pAnimationBase          Animation base object
263          * @param[in]   animTrigger                     Animation trigger type
264          * @remarks             %This function returns whether property is changeable or not. @n
265          *              If @c true, property can be changed. @n
266          *              If @c false, property cannot be changed.
267          */
268         bool IsAnimatable(AnimationTargetType animTarget, Tizen::Graphics::Rectangle& rect, AnimationBase* pAnimationBase = null
269                                          , ControlAnimatorTriggerType animTrigger = ANIMATION_TRIGGER_USER) const;
270
271         /**
272          * Starts the custom implicit %animation
273          *
274          * @since               2.0
275          * @return              An error code
276          * @param[in]   animTrigger                     %AnimationTriggerType
277          * @param[in]   x                                       x position of control
278          * @param[in]   y                                       y position of control
279          * @param[in]   width                           width of control
280          * @param[in]   height                          height of control
281          * @param[in]   showState                       showState of Control
282          *
283          * @exception   E_SUCCESS                       The method was successful.
284          * @exception   E_INVALID_ARG           The specified parameter is invalid.
285          * @exception   E_SYSTEM                        A system error occurred.
286          */
287         result StartCustomImplicitAnimation(ControlAnimatorTriggerType triggerType, int x, int y, int width, int height, bool showState);
288
289         /**
290          * Sets the Custom Implicit Animation parameters
291          *
292          * @since               2.0
293          * @return              An error code
294          * @param[in]   triggerType                     %AnimationTriggerType
295          * @param[in]   animationBase           %AnimationBase object
296          * @param[in]   bounds                          %Bounds of the %Control overwritten with corresponding new custom animation values
297          * @param[in]   showState                       %showState of the %Control overwritten with corresponding new custom animation values
298          * @param[in]   lastTargetOccurence     variable to find whether the Animation attached against the equivalent AnimationTarget is the last one in the list or not
299          *
300          * @exception   E_SUCCESS                       The method was successful.
301          * @exception   E_INVALID_ARG           The specified parameter is invalid.
302          * @exception   E_SYSTEM                        A system error occurred.
303          */
304         result SetCustomImplicitAnimationParams(ControlAnimatorTriggerType triggerType, AnimationBase& animationBase, Tizen::Graphics::Rectangle& bounds, bool showState, bool lastTargetOccurence = false);
305         /**
306          * returns whether animation supported by underlying platform or not
307          *
308          * @since               2.0
309          * @return              An error code
310          * @remarks             %This function returns whether animation is supported or not. @n
311          *              If @c true, animation supported. @n
312          *              If @c false, animation not supported.
313          */
314         bool IsAnimationSupported(void) const;
315
316         /**
317          * Sets the property of the Control with specified input
318          *
319          * @since               2.0
320          * @return              An error code
321          * @param[in]   animTarget                      Enumeration of animation target type
322          * @param[in]   animationBase           An instance of %AnimationBase object
323          */
324         result SetControlLogicalBounds(AnimationTargetType animTarget, AnimationBase& animationBase);
325
326         /**
327          * Sets the property of the Control with specified input
328          *
329          * @since               2.0
330          * @return              An error code
331          * @param[in]   animTarget                      Enumeration of animation target type
332          * @param[in]   animationBase           An instance of %AnimationBase object
333          */
334         result SetControlShowState(AnimationTargetType animTarget, AnimationBase& animationBase);
335
336         /**
337          * This function will be called to Stop All Animations
338          *
339          * @since 2.0
340          * @exception   E_SUCCESS                       The method was successful.
341          * @exception   E_INVALID_ARG           The specified parameter is invalid.
342          * @exception   E_SYSTEM                        A system error occurred.
343          */
344         result StopAllAnimations(void);
345
346         /**
347          * This function will be called to Stop an animation based on trigger type
348          *
349          * @since 2.0
350          * @exception   E_SUCCESS                       The method was successful.
351          * @exception   E_INVALID_ARG           The specified parameter is invalid.
352          * @exception   E_SYSTEM                        A system error occurred.
353          */
354         result StopAnimation(ControlAnimatorTriggerType animTrigger);
355
356         /**
357          * Delete & frees the memory used by the object
358          *
359          * @since               2.0
360          * @return              An error code
361          * @exception   E_SUCCESS                       The method was successful.
362          * @exception   E_SYSTEM                        Failed to free the resource possessed by this instance.
363          */
364         result Dispose(void);
365
366         /**
367          * Adds the Control animator event listener to the listeners list.
368          *
369          * @since 2.0
370          * @return              An error code
371          * @param[in]   listener                        Control animator event listener
372          * @exception   E_SUCCESS                       The method was successful.
373          * @exception   E_SYSTEM                        A system error occurred.
374          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
375          */
376         result AddControlAnimatorEventListener(const IControlAnimatorEventListener& listener);
377
378
379         /**
380          * Removes the Control animator event listener from the listeners list.
381          *
382          * @since 2.0
383          * @return              An error code
384          * @param[in]   listener                        Control animator event listener
385          * @exception   E_SUCCESS                       The method was successful.
386          * @exception   E_SYSTEM                        A system error occurred.
387          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
388          */
389         result RemoveControlAnimatorEventListener(const IControlAnimatorEventListener& listener);
390
391         /**
392          * Adds the Control detailed animator event listener to the listeners list.
393          *
394          * @since 2.0
395          * @return              An error code
396          * @param[in]   listener                        Control animator event listener
397          * @exception   E_SUCCESS                       The method was successful.
398          * @exception   E_SYSTEM                        A system error occurred.
399          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
400          */
401         result AddControlAnimatorDetailedEventListener(const IControlAnimatorDetailedEventListener& listener);
402
403         /**
404          * Removes the Detailed Control animator event listener from the listeners list.
405          *
406          * @since 2.0
407          * @return              An error code
408          * @param[in]   listener                        Control animator event listener
409          * @exception   E_SUCCESS                       The method was successful.
410          * @exception   E_SYSTEM                        A system error occurred.
411          * @exception   E_INVALID_ARG           A specified input parameter is invalid.
412          */
413         result RemoveControlAnimatorDetailedEventListener(const IControlAnimatorDetailedEventListener& listener);
414         /**
415          * Returns animation Index based on animation name.
416          *
417          * @since 2.0
418          * @return              Animation index in the active animation list
419          * @param[in]   animName        unique name of animation
420          */
421         int GetActiveAnimationIndex(const Tizen::Base::String& animName) const;
422
423         /**
424          * Sets the Bounds property of the object with specified input
425          *
426          * @return              An error code
427          * @param[in]   animTarget                      Enumeration of animation target type
428          * @param[in]   animationBase           An instance of %AnimationBase object
429          */
430         result SetPrevAnimationBoundsProperty(AnimationTargetType animTarget, AnimationBase& animationBase);
431         /**
432          * Sets animation target status
433          *
434          * @since                       2.0
435          * @return                      An error code
436          * @param[in]           triggerType                     Control animator trigger type
437          * @exception           E_SUCCESS                       The method was successful.
438          * @exception           E_SYSTEM                        A system error occurred.
439          * @exception       E_INVALID_ARG               A specified input parameter is invalid.
440          */
441         result SetAnimationTargetStatus(ControlAnimatorTriggerType triggerType);
442
443         /**
444          * Sets animation target status
445          *
446          * @since                       2.0
447          * @return                      An error code
448          * @param[in]           animTarget                      Control animator Target type
449          * @param[in]           pAnimationBase          Animation Base object
450          * @param[in]           pTimingFunction         Timing function ex: Linear
451          * @exception           E_SUCCESS                       The method was successful.
452          * @exception           E_SYSTEM                        A system error occurred.
453          * @exception       E_INVALID_ARG               A specified input parameter is invalid.
454          */
455         result SetKeyFrameAnimation(AnimationTargetType animTarget, AnimationBase* pAnimationBase, const IVisualElementAnimationTimingFunction* pTimingFunction, VisualElementAnimation* pAnimation);
456
457         /**
458          * Sets animation target status
459          *
460          * @since 2.0
461          * @return                      An error code
462          * @param[in]           animGroup                       Animation Group object.
463          * @exception           E_SUCCESS                       The method was successful.
464          * @exception           E_SYSTEM                        A system error occurred.
465          * @exception       E_INVALID_ARG               A specified input parameter is invalid.
466          */
467         result SetGroupAnimation(AnimationGroup* pAnimGrp);
468
469         /**
470          * Disables / Enables Propagation of properties from model layer to presentation layer
471          *
472          * @since 2.0
473          * @return                      An error code
474          * @param[in]           state                           true or false
475          * @exception           E_SUCCESS                       The method was successful.
476          * @exception           E_SYSTEM                        A system error occurred.
477          * @exception       E_INVALID_ARG               A specified input parameter is invalid.
478          */
479         result DisableImplicitAnimation(bool& state);
480
481         /**
482          * Disables / Enables Implicit animation at Visual element
483          *
484          * @since 2.0
485          * @return                      An error code
486          * @param[in]           state                           true or false
487          * @exception           E_SUCCESS                       The method was successful.
488          * @exception           E_SYSTEM                        A system error occurred.
489          * @exception       E_INVALID_ARG               A specified input parameter is invalid.
490          */
491         result DisableVisualElementPropagation(bool& state);
492
493         /**
494          * Returns the stored logical bounds.
495          *
496          * @since 2.0
497          * @return              Logical bounds
498          */
499         Tizen::Graphics::Rectangle
500         GetLogicalBounds(void) const
501         {
502                 return __logicalBoundsHolder;
503         }
504
505         /**
506          * Sets logical bounds.
507          *
508          * @since 2.0
509          * @return              void
510          * @param[in]   rectangle Logical bounds
511          */
512         void
513         SetLogicalBounds(Tizen::Graphics::Rectangle rect)
514         {
515                 __logicalBoundsHolder = rect;
516         }
517
518         /**
519          * Returns the Animation type for a given trigger type
520          *
521          * @since 2.0
522          * @param[in]   triggerType trigger for animation
523          * Allowed values ANIMATION_TRIGGER_POSITION_CHANGE-1 to ANIMATION_TRIGGER_SHOW_STATE_CHANGE-1
524          * ANIMATION_TRIGGER_POSITION_CHANGE = 1,               //Stored at index 0 [NONE (or) PARALLEL (or) SEQUENTIAL]
525          * ANIMATION_TRIGGER_SIZE_CHANGE = 2,                   //Stored at index 1     [NONE (or) PARALLEL (or) SEQUENTIAL]
526          * ANIMATION_TRIGGER_SHOW_STATE_CHANGE = 3,             //Stored at index 2 [NONE (or) PARALLEL (or) SEQUENTIAL]
527          *
528          * @return              Animation type [NONE (or) PARALLEL (or) SEQUENTIAL]
529          */
530         StoredPropertyAnimationGroupType
531         GetStoredPropertyAnimationGroupType(int triggerType) const
532         {
533                 return __propertyAnimationGroupType[triggerType];
534         }
535
536         /**
537          * Sets logical bounds.
538          *
539          * @since 2.0
540          * @return              void
541          * @param[in]   triggerType
542          * Allowed values ANIMATION_TRIGGER_POSITION_CHANGE-1 to ANIMATION_TRIGGER_SHOW_STATE_CHANGE-1
543          * ANIMATION_TRIGGER_POSITION_CHANGE = 1,               //Stored at index 0
544          * ANIMATION_TRIGGER_SIZE_CHANGE = 2,                   //Stored at index 1
545          * ANIMATION_TRIGGER_SHOW_STATE_CHANGE = 3,             //Stored at index 2
546          * @param[in] animationType Type of animation [NONE (or) PARALLEL (or) SEQUENTIAL]
547          */
548         void
549         SetStoredPropertyAnimationGroupType(int triggerType, StoredPropertyAnimationGroupType groupType)
550         {
551                 __propertyAnimationGroupType[triggerType] = groupType;
552         }
553
554         /**
555          * Returns group of animations for a particular trigger type
556          *
557          * @since 2.0
558          * @param[in]   triggerType
559          * Allowed values ANIMATION_TRIGGER_POSITION_CHANGE-1 to ANIMATION_TRIGGER_SHOW_STATE_CHANGE-1
560          * ANIMATION_TRIGGER_POSITION_CHANGE = 1,               //Stored at index 0
561          * ANIMATION_TRIGGER_SIZE_CHANGE = 2,                   //Stored at index 1
562          * ANIMATION_TRIGGER_SHOW_STATE_CHANGE = 3,             //Stored at index 2
563          * @return              Returns group of animations for a particular trigger type
564          */
565         AnimationGroup*
566         GetPropertyGroupList(int triggerType) const
567         {
568                 return __pPropertyAnimationGroupList[triggerType];
569         }
570
571         /**
572          * Sets animation group to a trigger type
573          *
574          * @since 2.0
575          * @param[in]   triggerType
576          *
577          * Allowed values ANIMATION_TRIGGER_POSITION_CHANGE-1 to ANIMATION_TRIGGER_SHOW_STATE_CHANGE-1
578          * ANIMATION_TRIGGER_POSITION_CHANGE = 1,               //Stored at index 0
579          * ANIMATION_TRIGGER_SIZE_CHANGE = 2,                   //Stored at index 1
580          * ANIMATION_TRIGGER_SHOW_STATE_CHANGE = 3,             //Stored at index 2
581          * @return              void
582          */
583         void
584         SetPropertyGroupList(int triggerType, AnimationGroup* animGroup)
585         {
586                 __pPropertyAnimationGroupList[triggerType] = animGroup;
587         }
588
589         /**
590          * Returns the show state of control
591          *
592          * @since 2.0
593          * @return              Returns the show state of control
594          */
595         bool GetShowState(void) const
596         {
597                 return __showStateHolder;
598         }
599
600         /**
601          * Stores show state
602          *
603          * @since 2.0
604          * @return              void
605          * @param[in]   showState Show state
606          */
607         void
608         SetShowState(bool showState)
609         {
610                 __showStateHolder = showState;
611         }
612
613         /**
614          * Returns the state of control animator (playing/stopped)
615          *
616          * @since 2.0
617          * @return              State of control animator (playing/stopped)
618          */
619         AnimatorStatus
620         GetAnimatorStatus(void) const
621         {
622                 return __animatorStatus;
623         }
624
625         /**
626          * Stores whether a target is animating or not
627          *
628          * @since 2.0
629          * @return              void
630          * @param[in]   animatorStatus State of control animator (playing/stopped)
631          */
632         void
633         SetAnimatorStatus(AnimatorStatus animatorStatus)
634         {
635                 __animatorStatus = animatorStatus;
636         }
637
638         /**
639          * Stores whether a target is animating or not
640          *
641          * @since 2.0
642          * @return              void
643          * @param[in]   target Target type
644          * @param[in]   animating or not animating
645          */
646         void
647         SetAnimationTargetAnimating(int target, bool animating)
648         {
649                 __isAnimationTargetAnimating[target] = animating;
650         }
651
652         /**
653          * Returns the whether the animation target is animating
654          *
655          * @since 2.0
656          * @return              Animation target is currently animating or not
657          */
658         bool
659         IsAnimationTargetAnimating(int target) const
660         {
661                 return __isAnimationTargetAnimating[target];
662         }
663
664         /**
665          * Returns reference to control
666          *
667          * @since 2.0
668          * @return              Reference to control
669          */
670         Control&
671         GetControl(void) const
672         {
673                 return *__pControl;
674         }
675
676         /**
677          * Stores control pointer
678          *
679          * @since 2.0
680          * @return              void
681          * @param[in]   control Reference to the control
682          */
683         void
684         SetControl(Control& control)
685         {
686                 __pControl = &control;
687         }
688
689         /**
690          * This function will be called when the animation is started.
691          *
692          * @since 2.0
693          * @param[in]           target          UIObject that animation is applied to.
694          * @param[in]           animation       Animation that is started.
695          */
696         void OnVisualElementAnimationStarted(const VisualElementAnimation& animation, const Tizen::Base::String& keyName, VisualElement& target);
697
698         /**
699          * This function will be called when the animation is repeated.
700          *
701          * @since 2.0
702          * @param[in]           target          UIObject that animation is applied to.
703          * @param[in]           animation       Animation that is repeated.
704          * @param[in]           currentRepeatCount      repeat count
705          */
706         void OnVisualElementAnimationRepeated(const VisualElementAnimation& animation, const Tizen::Base::String& keyName, VisualElement& target, long currentRepeatCount);
707
708         /**
709          * This function will be called when the animation is stopped.
710          *
711          * @since 2.0
712          * @param[in]           target          UIObject that animation is applied to.
713          * @param[in]           animation       Animation that is stopped.
714          * @param[in]           completed       Whether animation is completed normally or canceled in the middle of running.
715          */
716         void OnVisualElementAnimationFinished(const VisualElementAnimation& animation, const Tizen::Base::String& keyName, VisualElement& target, bool completedNormally);
717
718         /**
719          * This function will be called when the animation is stopped.
720          *
721          * @since 2.0
722          * @param[in]           animation               Visual Element animation.
723          * @param[in]           keyName                 Animation name.
724          * @param[in]           currentValue    Current value of animation.
725          */
726         void OnTickOccurred(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, const Tizen::Ui::Variant& currentValue);
727
728         /**
729          * This is the assignment operator implementation for this class. @n
730          *
731          * @since       2.0
732          */
733         _ControlAnimatorImpl& operator =(const _ControlAnimatorImpl& rhs);
734
735 private:
736         /**
737          * Structure used for storing Active Animations
738          *
739          * @since 2.0
740          * @enum struct
741          *
742          */
743         struct ActiveAnimation
744         {
745                 ControlAnimatorTriggerType animType;
746                 AnimationTargetType animTarget;
747                 AnimationBase* pAnimationBase;
748                 VisualElementAnimation* pAnimation;
749                 Tizen::Base::String animName;
750                 Tizen::Ui::Animations::BezierTimingFunction* pBezierTimingFunction;
751
752                 ActiveAnimation(void)
753                 {
754                         animTarget = ANIMATION_TARGET_NONE;
755                         animType = ANIMATION_TRIGGER_USER;
756                         pAnimationBase = null;
757                         pAnimation = null;
758                         animName = Tizen::Base::String("");
759                         pBezierTimingFunction = null;
760                 }
761                 ~ActiveAnimation(void)
762                 {
763
764                 }
765                 bool operator ==(const ActiveAnimation& rhs) const;
766                 bool operator !=(const ActiveAnimation& rhs) const;
767         };
768         /**
769          *  The List maintaining the Active Animations
770          *
771          *  @since      2.0
772          */
773         Tizen::Base::Collection::ArrayListT< ActiveAnimation >* __pActiveAnimationList;
774
775         /**
776          * This is the object of control.
777          *
778          * @since 2.0
779          */
780         //TODO: @remark: This object need not be deleted in ControlAnimator scope
781         Tizen::Ui::Control* __pControl;
782
783         /**
784          * This is the object _ControlImpl.
785          *
786          * @since 2.0
787          */
788         //TODO: @remark: This object need not be deleted in ControlAnimator scope
789         Tizen::Ui::_ControlImpl* __pControlImpl;
790         /**
791          * The animation status (play / stopped)
792          *
793          * @since 2.0
794          */
795         AnimatorStatus __animatorStatus;
796
797         /**
798          * PROPERTY_GROUP_TYPE_NONE if the __pPropertyAnimationGroupList is not populated with user defined custom defined implicit animations
799          *
800          * @since 2.0
801          * ANIMATION_TRIGGER_POSITION_CHANGE = 1,               //Stored at index 0 [NONE (or) PARALLEL (or) SEQUENTIAL]
802          * ANIMATION_TRIGGER_SIZE_CHANGE = 2,                   //Stored at index 1     [NONE (or) PARALLEL (or) SEQUENTIAL]
803          * ANIMATION_TRIGGER_SHOW_STATE_CHANGE = 3,             //Stored at index 2 [NONE (or) PARALLEL (or) SEQUENTIAL]
804          */
805         StoredPropertyAnimationGroupType __propertyAnimationGroupType[ANIMATION_TRIGGER_SHOW_STATE_CHANGE];
806
807         /**
808          * This is the object of AnimationGroup.
809          *
810          * @since 2.0
811          * ANIMATION_TRIGGER_POSITION_CHANGE = 1,               //Stored at index 0 [NONE (or) PARALLEL (or) SEQUENTIAL]
812          * ANIMATION_TRIGGER_SIZE_CHANGE = 2,                   //Stored at index 1     [NONE (or) PARALLEL (or) SEQUENTIAL]
813          * ANIMATION_TRIGGER_SHOW_STATE_CHANGE = 3,             //Stored at index 2 [NONE (or) PARALLEL (or) SEQUENTIAL]
814          *
815          * @remarks             The array size should be changed if anything is added to ControlAnimationTriggerType.
816          */
817         Tizen::Ui::Animations::AnimationGroup* __pPropertyAnimationGroupList[ANIMATION_TRIGGER_SHOW_STATE_CHANGE];
818         /**
819          * Array of bool to keep track whether an %AnimationTarget is being animated or not.
820          *
821          * @since 2.0
822          * ANIMATION_TARGET_SIZE        at index - 0
823          * ANIMATION_TARGET_POSITION    at index - 1
824          * ANIMATION_TARGET_ALPHA               at index - 2
825          * ANIMATION_TARGET_ORIENTATION at index - 3
826          */
827         bool __isAnimationTargetAnimating[ANIMATION_TARGET_MAX];
828
829         /**
830          * LogicalBounds Holder
831          *
832          * @since 2.0
833          */
834         Tizen::Graphics::Rectangle __logicalBoundsHolder;
835
836         /**
837          * showState Holder
838          *
839          * @since 2.0
840          */
841         bool __showStateHolder;
842
843         /**
844          * Holder for number of animations of same TargetType in AnimationGroupSequential
845          *
846          * @since 2.0
847          */
848         int __targetCount;
849
850         /**
851          * LogicalBounds Holder
852          *
853          * @since 2.0
854          */
855         Tizen::Graphics::Rectangle __prevAnimationBoundsHolder;
856
857         /**
858          * sequentialGroupAnimation or parallel Animation group
859          *
860          * @since 2.0
861          */
862         bool __sequentialGroupAnimation;
863
864         /**
865          * sequentialGroupAnimation delay
866          *
867          * @since 2.0
868          */
869         float __sequelDelay;
870
871
872         /**
873          * This is object of ControlAnimator class
874          *
875          * @since 2.0
876          */
877         Tizen::Ui::Animations::ControlAnimator* __pControlAnimator;
878
879         /**
880          * This is object of ControlAnimator class
881          *
882          * @since 2.0
883          */
884         Tizen::Ui::Animations::VisualElement* __pVisualElement;
885
886         /**
887          * This is the list controlanimator event listeners
888          *
889          * @since 2.0
890          */
891         Tizen::Base::Collection::LinkedListT< IControlAnimatorEventListener* >* __pAnimStatusEventListener;
892
893         /**
894          * This is the list controlanimator event listeners
895          *
896          * @since 2.0
897          */
898         Tizen::Base::Collection::LinkedListT< IControlAnimatorDetailedEventListener* >* __pAnimDetailedEventListener;
899
900         /**
901          * This is Id or each animation
902          *
903          * @since 2.0
904          */
905         int __animId;
906         /**
907          * This is name for group animation
908          *
909          * @since 2.0
910          */
911         Tizen::Base::String __groupName;
912         /**
913          * This is to hold presentation bounds
914          *
915          * @since 2.0
916          */
917         Tizen::Graphics::FloatRectangle __presentationBounds;
918
919         friend class Tizen::Ui::Control;
920 };      // _ControlAnimatorImpl
921
922 }}}     // Tizen::Ui::Animations
923
924 #endif //_FUI_ANIM_INTERNAL_CONTROL_ANIMATOR_IMPL_H_