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.
18 * @file FUiCtrl_AnimationEvent.cpp
19 * @brief This is the implementation for the AnimationEvent class.
23 #include <FBaseErrors.h>
24 #include <FBaseSysLog.h>
25 #include "FUiCtrl_IAnimationEventListener.h"
26 #include "FUiCtrl_AnimationEvent.h"
28 using namespace Tizen::Base;
29 using namespace Tizen::Base::Runtime;
31 namespace Tizen { namespace Ui { namespace Controls
34 class _OSP_EXPORT_ _AnimationEventArg
39 _AnimationEventArg(void);
40 virtual ~_AnimationEventArg(void);
42 }; // _AnimationEventArg
44 _AnimationEventArg::_AnimationEventArg(void)
48 _AnimationEventArg::~_AnimationEventArg(void)
53 _AnimationEvent::_AnimationEvent(const _Control& source)
56 result r = _Event::Initialize();
64 _AnimationEvent::~_AnimationEvent(void)
69 _AnimationEvent::CreateInstanceN(const _Control& source)
71 _AnimationEvent* pAnimationEvent = new (std::nothrow) _AnimationEvent(source);
72 SysTryReturn(NID_UI_CTRL, pAnimationEvent, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
74 if (IsFailed(GetLastResult()))
76 delete pAnimationEvent;
77 pAnimationEvent = null;
82 return pAnimationEvent;
86 _AnimationEvent::GetSource(void) const
92 _AnimationEvent::FireImpl(IEventListener& listener, const IEventArg& arg)
94 _IAnimationEventListener* pAnimationListener = dynamic_cast <_IAnimationEventListener*>(&listener);
95 SysTryReturnVoidResult(NID_UI_CTRL, pAnimationListener != null, E_INVALID_ARG,
96 "[E_INVALID_ARG] Invalid argument(s) is used. The _IAnimationEventListener instance is null.");
98 pAnimationListener->OnAnimationStopped(*__pSource);
100 SetLastResult(E_SUCCESS);
105 _AnimationEvent::CreateAnimationEventArgN(void)
107 _AnimationEventArg* pEventArg = new (std::nothrow) _AnimationEventArg();
108 SysTryReturn(NID_UI_CTRL, pEventArg, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
110 SetLastResult(E_SUCCESS);
114 }}} // Tizen::Ui::Controls