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