2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://floralicense.org/license/
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 FUiAnimVisualElementValueAnimation.cpp
20 * @brief This file contains implementation of VisualElementVAlueAnimation class
22 * This file contains implementation VisualElementPropertyAnimation class.
25 #include <FBaseSysLog.h>
27 #include <FUiAnimVisualElementValueAnimation.h>
29 #include "FUiAnim_VisualElementValueAnimationImpl.h"
31 namespace Tizen { namespace Ui { namespace Animations
34 VisualElementValueAnimation::VisualElementValueAnimation(void)
35 : VisualElementAnimation(new (std::nothrow) _VisualElementValueAnimationImpl())
37 if (_pAnimationImpl == null)
39 SetLastResult(E_OUT_OF_MEMORY);
43 VisualElementValueAnimation::~VisualElementValueAnimation(void)
48 VisualElementValueAnimation::VisualElementValueAnimation(_VisualElementValueAnimationImpl* pImpl)
49 : VisualElementAnimation(pImpl)
53 VisualElementValueAnimation::VisualElementValueAnimation(const VisualElementValueAnimation& animation)
54 : VisualElementAnimation(null)
58 const _VisualElementValueAnimationImpl* pAnimationImpl = _VisualElementValueAnimationImpl::GetInstance(animation);
60 _pAnimationImpl = new (std::nothrow) _VisualElementValueAnimationImpl(*pAnimationImpl);
61 SysTryReturnVoidResult(NID_UI_ANIM, (_pAnimationImpl), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
64 VisualElementValueAnimation&
65 VisualElementValueAnimation::operator =(const VisualElementValueAnimation& rhs)
71 _VisualElementValueAnimationImpl* pAnimationImpl = _VisualElementValueAnimationImpl::GetInstance(*this);
72 const _VisualElementValueAnimationImpl* pRhsAnimationImpl = _VisualElementValueAnimationImpl::GetInstance(rhs);
74 result r = pAnimationImpl->CopyAnimationValue(*pRhsAnimationImpl);
75 SysTryReturn(NID_UI_ANIM, (r == E_SUCCESS), *this, r, "[%s] Failed to copy the animation value.", GetErrorMessage(r));
82 VisualElementValueAnimation::operator ==(const VisualElementValueAnimation& rhs) const
84 return VisualElementAnimation::operator ==(rhs);
88 VisualElementValueAnimation::operator !=(const VisualElementValueAnimation& rhs) const
90 return (!operator ==(rhs));
94 VisualElementValueAnimation::Equals(const Tizen::Base::Object& obj) const
96 const VisualElementValueAnimation* pAnimation = dynamic_cast< const VisualElementValueAnimation* >(&obj);
98 if (pAnimation == null)
103 return (*this == *pAnimation);
107 VisualElementValueAnimation::GetHashCode(void) const
109 return VisualElementAnimation::GetHashCode();
112 VisualElementAnimation*
113 VisualElementValueAnimation::CloneN(void) const
115 VisualElementAnimation* pCloned = new (std::nothrow) VisualElementValueAnimation(*this);
116 SysTryReturn(NID_UI_ANIM, (pCloned != null), null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
122 VisualElementValueAnimation::SetVisualElementAnimationTickEventListener(IVisualElementAnimationTickEventListener* pListener)
124 _VisualElementValueAnimationImpl* pAnimationImpl = _VisualElementValueAnimationImpl::GetInstance(*this);
126 pAnimationImpl->SetTickEventListener(pListener);
129 IVisualElementAnimationTickEventListener*
130 VisualElementValueAnimation::GetVisualElementAnimationTickEventListener(void) const
132 const _VisualElementValueAnimationImpl* pAnimationImpl = _VisualElementValueAnimationImpl::GetInstance(*this);
134 return pAnimationImpl->GetTickEventListener();
138 VisualElementValueAnimation::SetStartValue(const Tizen::Ui::Variant& startValue)
140 SysTryReturnResult(NID_UI_ANIM, (startValue.IsEmpty() == false), E_INVALID_ARG, "Invalid argument(s) is used. startValue is empty.");
142 _VisualElementValueAnimationImpl* pAnimationImpl = _VisualElementValueAnimationImpl::GetInstance(*this);
144 pAnimationImpl->SetStartValue(startValue);
150 VisualElementValueAnimation::GetStartValue(void) const
152 const _VisualElementValueAnimationImpl* pAnimationImpl = _VisualElementValueAnimationImpl::GetInstance(*this);
154 return pAnimationImpl->GetStartValue();
158 VisualElementValueAnimation::SetEndValue(const Tizen::Ui::Variant& endValue)
160 SysTryReturnResult(NID_UI_ANIM, (endValue.IsEmpty() == false), E_INVALID_ARG, "Invalid argument(s) is used. endValue is empty.");
162 _VisualElementValueAnimationImpl* pAnimationImpl = _VisualElementValueAnimationImpl::GetInstance(*this);
164 pAnimationImpl->SetEndValue(endValue);
170 VisualElementValueAnimation::GetEndValue(void) const
172 const _VisualElementValueAnimationImpl* pAnimationImpl = _VisualElementValueAnimationImpl::GetInstance(*this);
174 return pAnimationImpl->GetEndValue();
178 VisualElementValueAnimation::SetEndValueApplied(bool apply)
180 _VisualElementValueAnimationImpl* pAnimationImpl = _VisualElementValueAnimationImpl::GetInstance(*this);
182 pAnimationImpl->SetEndValueApplied(apply);
186 VisualElementValueAnimation::IsEndValueApplied(void) const
188 const _VisualElementValueAnimationImpl* pAnimationImpl = _VisualElementValueAnimationImpl::GetInstance(*this);
190 return pAnimationImpl->IsEndValueApplied();
194 VisualElementValueAnimation::AddKeyFrame(float timeProgress, const Tizen::Ui::Variant& value, const IVisualElementAnimationTimingFunction* pTimingFunction)
196 SysTryReturnResult(NID_UI_ANIM, (timeProgress > 0.0f && timeProgress < 1.0f), E_OUT_OF_RANGE, "The time (%f) is out of range.", timeProgress);
197 SysTryReturnResult(NID_UI_ANIM, (value.IsEmpty() == false), E_INVALID_ARG, "Invalid argument(s) is used. value is empty.");
199 _VisualElementValueAnimationImpl* pAnimationImpl = _VisualElementValueAnimationImpl::GetInstance(*this);
201 return pAnimationImpl->AddKeyFrame(timeProgress, value, pTimingFunction);
205 VisualElementValueAnimation::RemoveKeyFrame(float timeProgress)
207 SysTryReturnResult(NID_UI_ANIM, (timeProgress > 0.0f && timeProgress < 1.0f), E_OUT_OF_RANGE, "The time (%f) is out of range.", timeProgress);
209 _VisualElementValueAnimationImpl* pAnimationImpl = _VisualElementValueAnimationImpl::GetInstance(*this);
211 return pAnimationImpl->RemoveKeyFrame(timeProgress);
215 VisualElementValueAnimation::RemoveAllKeyFrames(void)
217 _VisualElementValueAnimationImpl* pAnimationImpl = _VisualElementValueAnimationImpl::GetInstance(*this);
219 pAnimationImpl->RemoveAllKeyFrames();
222 }}} // Tizen::Ui::Animations