Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / controls / FUiCtrl_ProgressPopupEvent.cpp
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 * @file FUiCtrl_ProgressPopupEvent.cpp
19 * @brief        This is the implementation for the ActionEvent class.
20 */
21
22 #include <new>
23 #include <FBaseErrors.h>
24 #include <FBaseSysLog.h>
25 #include "FUiCtrl_IProgressPopupEventListener.h"
26 #include "FUiCtrl_ProgressPopupEvent.h"
27
28
29 using namespace Tizen::Base;
30 using namespace Tizen::Base::Runtime;
31
32
33 namespace Tizen { namespace Ui { namespace Controls
34 {
35
36
37 class _OSP_EXPORT_ _ProgressPopupEventArg
38         : public Object
39         , public IEventArg
40 {
41 public:
42         _ProgressPopupEventArg(void);
43
44         virtual ~_ProgressPopupEventArg(void);
45
46 }; // _ProgressPopupEventArg
47
48
49 _ProgressPopupEventArg::_ProgressPopupEventArg(void)
50 {
51         // empty statement
52 }
53
54 _ProgressPopupEventArg::~_ProgressPopupEventArg(void)
55 {
56         // empty statement
57 }
58
59
60 _ProgressPopupEvent::_ProgressPopupEvent(const _Control& source)
61         : __pSource(null)
62 {
63         result r = _Event::Initialize();
64
65         // set event source
66         if (r == E_SUCCESS)
67         {
68                 __pSource = &source;
69                 SetLastResult(E_SUCCESS);
70         }
71 }
72
73 _ProgressPopupEvent::~_ProgressPopupEvent(void)
74 {
75         // empty statement
76 }
77
78 _ProgressPopupEvent*
79 _ProgressPopupEvent::CreateInstanceN(const _Control& source)
80 {
81         _ProgressPopupEvent* pProgressPopupEvent = new (std::nothrow) _ProgressPopupEvent(source);
82         SysTryReturn(NID_UI_CTRL, pProgressPopupEvent, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
83
84         if (IsFailed(GetLastResult()))
85         {
86                 goto CATCH;
87         }
88
89         return pProgressPopupEvent;
90
91 CATCH:
92         delete pProgressPopupEvent;
93         return null;
94 }
95
96 const _Control*
97 _ProgressPopupEvent::GetSource(void) const
98 {
99         return __pSource;
100 }
101
102 void
103 _ProgressPopupEvent::FireImpl(IEventListener& pListener, const IEventArg& arg)
104 {
105         // cast to _IProgressPopupEventListener
106         _IProgressPopupEventListener* pProgressPopupListener = dynamic_cast <_IProgressPopupEventListener*>(&pListener);
107         SysTryReturnVoidResult(NID_UI_CTRL, pProgressPopupListener != null, E_INVALID_ARG,
108                                 "[E_INVALID_ARG] The invalid listener was given.\n");
109
110         // call progresspopup event listener method
111         pProgressPopupListener->OnProgressPopupCanceled();
112 }
113
114 IEventArg*
115 _ProgressPopupEvent::CreateProgressPopupEventArgN(void)
116 {
117         _ProgressPopupEventArg* pEventArg = new (std::nothrow) _ProgressPopupEventArg();
118         SysTryReturn(NID_UI_CTRL, pEventArg != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
119
120         return pEventArg;
121 }
122
123 }}} // Tizen::Ui::Controls