Changed indicator bg color.
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_PublicAnimationEvent.cpp
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         FUiCtrl_PublicAnimationEvent.cpp
20 * @brief        This is the implementation for the AnimationEvent class.
21 */
22
23 #include <new>
24 #include <FBaseErrors.h>
25 #include <FUiIAnimationEventListener.h>
26 #include <FBaseSysLog.h>
27 #include "FUiCtrl_PublicAnimationEvent.h"
28
29 using namespace Tizen::Ui;
30 using namespace Tizen::Base;
31 using namespace Tizen::Base::Runtime;
32
33 namespace Tizen { namespace Ui { namespace Controls
34 {
35
36 class _PublicAnimationEventArg
37         : public IEventArg
38         , public Object
39 {
40 public:
41         _PublicAnimationEventArg(void);
42         virtual ~_PublicAnimationEventArg(void);
43 }; // _PublicAnimationEventArg
44
45 _PublicAnimationEventArg::_PublicAnimationEventArg(void)
46 {
47 }
48
49 _PublicAnimationEventArg::~_PublicAnimationEventArg(void)
50 {
51 }
52
53
54 _PublicAnimationEvent::_PublicAnimationEvent(const Control& source)
55         : __pSource(null)
56 {
57         result r = _Event::Initialize();
58
59         if (r == E_SUCCESS)
60         {
61                 __pSource = &source;
62         }
63 }
64
65 _PublicAnimationEvent::~_PublicAnimationEvent(void)
66 {
67 }
68
69 _PublicAnimationEvent*
70 _PublicAnimationEvent::CreateInstanceN(const Control& source)
71 {
72         _PublicAnimationEvent* pPublicAnimationEvent = new (std::nothrow) _PublicAnimationEvent(source);
73         SysTryReturn(NID_UI_CTRL, pPublicAnimationEvent, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
74
75         if (IsFailed(GetLastResult()))
76         {
77                 goto CATCH;
78         }
79
80         return pPublicAnimationEvent;
81
82 CATCH:
83         delete pPublicAnimationEvent;
84         pPublicAnimationEvent = null;
85
86         return null;
87 }
88
89 const Control*
90 _PublicAnimationEvent::GetSource(void) const
91 {
92         return __pSource;
93 }
94
95 void
96 _PublicAnimationEvent::FireImpl(IEventListener& listener, const IEventArg& arg)
97 {
98         IAnimationEventListener* pAnimationListener = dynamic_cast <IAnimationEventListener*>(&listener);
99         SysTryReturnVoidResult(NID_UI_CTRL, pAnimationListener != null, E_INVALID_ARG,
100                                 "[E_INVALID_ARG] Invalid listener was given.");
101
102         pAnimationListener->OnAnimationStopped(*__pSource);
103
104         SetLastResult(E_SUCCESS);
105         return;
106 }
107
108 IEventArg*
109 _PublicAnimationEvent::CreateAnimationEventArgN(void)
110 {
111         _PublicAnimationEventArg* pEventArg = new (std::nothrow) _PublicAnimationEventArg();
112         SysTryReturn(NID_UI_CTRL, pEventArg, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
113
114         return pEventArg;
115 }
116
117 }}} // Tizen::Ui::Controls