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 FUiAnim_FrameAnimatorImpl.h
20 * @brief This is the header file for the _FrameAnimatorImpl class.
22 * This header file contains the declarations of the _FrameAnimatorImpl class. @n
25 #ifndef _FUI_ANIM_INTERNAL_FRAME_ANIMATOR_IMPL_H_
26 #define _FUI_ANIM_INTERNAL_FRAME_ANIMATOR_IMPL_H_
28 #include <FUiAnimFrameAnimator.h>
29 #include <FUiAnimVisualElementPropertyAnimation.h>
30 #include <FUiAnimIVisualElementAnimationTimingFunction.h>
32 #include "FUiAnim_ControlVisualElement.h"
35 namespace Tizen { namespace Ui { namespace Animations
38 class _FrameAnimatorImpl
39 : public Tizen::Base::Object
40 , public IAnimationTransactionEventListener
41 , virtual public Tizen::Base::Runtime::IEventListener
44 _FrameAnimatorImpl(FrameAnimator* pFrameAnimator);
45 ~_FrameAnimatorImpl(void);
47 result Construct(const Tizen::Ui::Controls::Frame& source);
49 result AddFrameAnimatorEventListener(IFrameAnimatorEventListener& listener);
50 result RemoveFrameAnimatorEventListener(IFrameAnimatorEventListener& listener);
52 result StopAllAnimations(void);
54 result AddControl(const Tizen::Ui::Control& control);
55 result SetCurrentForm(const Tizen::Ui::Controls::Form& form);
57 bool IsAnimationSupported(void) const;
59 virtual void OnAnimationTransactionStarted(int transactionId);
60 virtual void OnAnimationTransactionStopped(int transactionId);
61 virtual void OnAnimationTransactionFinished(int transactionId);
63 void OnFrameAnimationStarted(void);
64 void OnFrameAnimationStopped(bool completed);
67 GetFrameAnimatorStatus(void) const
69 return __frameAnimatorStatus;
72 FrameAnimatorFormTransitionAnimation
73 GetAnimationEffectType(void) const
75 return __animationEffectType;
79 SetAnimationEffectType(FrameAnimatorFormTransitionAnimation animationEffectType)
81 __animationEffectType = animationEffectType;
85 GetDuration(void) const
91 SetDuration(long duration)
93 __duration = duration;
96 AnimationInterpolatorType
97 GetAnimInterpolatorType(void) const
99 return __animInterpolatorType;
103 SetAnimInterpolatorType(AnimationInterpolatorType animInterpolatorType)
105 __animInterpolatorType = animInterpolatorType;
109 GetFormTransitionBezierControlPoints(float& firstTime, float& firstValue, float& secondTime, float& secondValue) const
111 firstTime = __firstBezierControlPointsTime;
112 firstValue = __firstBezierControlPointsValue;
113 secondTime = __secondBezierControlPointsTime;
114 secondValue = __secondBezierControlPointsValue;
118 SetFormTransitionBezierControlPoints(float firstTime, float firstValue, float secondTime, float secondValue)
120 __firstBezierControlPointsTime = firstTime;
121 __firstBezierControlPointsValue = firstValue;
122 __secondBezierControlPointsTime = secondTime;
123 __secondBezierControlPointsValue = secondValue;
126 static _FrameAnimatorImpl* GetInstance(FrameAnimator& frameAnimator);
127 static const _FrameAnimatorImpl* GetInstance(const FrameAnimator& frameAnimator);
130 _FrameAnimatorImpl(const _FrameAnimatorImpl& rhs);
131 _FrameAnimatorImpl& operator =(const _FrameAnimatorImpl& rhs);
133 result Dispose(void);
135 result StartLayerAnimation(VisualElement* pLayer, AnimationTargetType animTarget, Variant startValue, Variant endValue, Tizen::Base::String animName);
136 result AddFrameActiveAnimation(VisualElement* _pVisualElement, FrameAnimatorFormTransitionAnimation _formAnimation,
137 VisualElementPropertyAnimation* _pPropertyAnimation, IVisualElementAnimationTimingFunction* _pTimingFunction, Tizen::Base::String _animName);
139 VisualElementPropertyAnimation* GetFrameActiveAnimationAt(int index);
140 result RemoveAnimationAt(int index);
141 result RemoveAllAnimations(bool deleteAnimation);
143 bool IsFormPresent(Tizen::Ui::Controls::Form& pPrevForm) const;
145 result ChangeCurrentForm(Tizen::Ui::Controls::Form* pCurrentForm, Tizen::Ui::Controls::Form& nextForm);
147 result SetAnimations(void);
149 result PrepareCapture(void);
153 * Structure used for storing Frame Active Animations
157 struct FrameActiveAnimation
159 VisualElement* pVisualElement;
160 FrameAnimatorFormTransitionAnimation formTransitionAnimationType;
161 VisualElementPropertyAnimation* pPropertyAnimation;
162 IVisualElementAnimationTimingFunction* pTimingFunction;
163 Tizen::Base::String animName;
164 FrameActiveAnimation(void)
166 pVisualElement = null;
167 formTransitionAnimationType = FRAME_ANIMATOR_FORM_TRANSITION_ANIMATION_MAX;
168 pPropertyAnimation = null;
169 pTimingFunction = null;
172 ~FrameActiveAnimation(void)
175 bool operator ==(const FrameActiveAnimation& frameActiveAnim) const;
176 bool operator !=(const FrameActiveAnimation& frameActiveAnim) const;
177 }; // FrameActiveAnimation
181 * This is the object of Frame.
184 * @remark: This object need not be deleted in FrameAnimator scope
186 Tizen::Ui::Controls::Frame* __pFrame;
189 * This is object of FrameAnimator class.
193 FrameAnimator* __pFrameAnimator;
196 * The List maintaining the Frame Active Animations.
200 Tizen::Base::Collection::ArrayListT< FrameActiveAnimation > __frameActiveAnimationList;
203 * This Callback is called when an animation is repeated.
207 Tizen::Base::Collection::LinkedListT< IFrameAnimatorEventListener* > __frameAnimStatusEventListener;
210 * This is transactionID for the Form Transition animation
217 * The animation status (play / stopped)
221 AnimatorStatus __frameAnimatorStatus;
224 * CurrentForm object pointer.
228 Tizen::Ui::Controls::Form* __pCurrentForm;
231 * NextForm object pointer.
235 Tizen::Ui::Controls::Form* __pNextForm;
238 * The VisualElement of CurrentForm.
242 VisualElement* __pCurrentFormVisualElement;
245 * The VisualElement of NextForm.
249 VisualElement* __pNextFormVisualElement;
252 * This is the AnimationFormTransitionEffect used in animation.
256 FrameAnimatorFormTransitionAnimation __animationEffectType;
259 * This is the AnimationInterpolatorType used in animation.
263 AnimationInterpolatorType __animInterpolatorType;
266 * This is the duration of animation.
273 * This is input time1 of Bezier Control point.
277 float __firstBezierControlPointsTime;
280 * This is input value1 of Bezier Control point.
284 float __firstBezierControlPointsValue;
287 * This is input time2 of Bezier Control point.
291 float __secondBezierControlPointsTime;
294 * This is input value2 of Bezier Control point.
298 float __secondBezierControlPointsValue;
301 * This Tizen::Graphics::FloatMatrix4 object to set default transform matrix to current form after animation.
305 Tizen::Graphics::FloatMatrix4 __veDefaultMatrix;
308 * This Tizen::Graphics::FloatRectangle object to set default bounds to forms after animation.
312 Tizen::Graphics::FloatRectangle __veDefaultBounds;
315 * This float value to set default opacity to forms after animation.
319 float __veDefaultOpacity;
322 * Background ControlVisualElement to give a backgroud to Animating forms, so that background forms aren't visible
323 * in case of alpha animation.
327 _ControlVisualElement* __pBgElement;
328 VisualElement* __pCurrentCaptureVisualElement;
329 VisualElement* __pNextCaptureVisualElement;
330 VisualElementSurface* __pDummySurface;
332 }; // _FrameAnimatorImpl
334 }}} // Tizen::Ui::Animations
336 #endif //_FUI_ANIM_INTERNAL_FRAME_ANIMATOR_IMPL_H_