Changed indicator bg color.
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_PublicClipboardPopupEvent.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  * @file        FUiCtrl_PublicClipboardPopupEvent.cpp
19  * @brief       This is the implementation for the _PublicClipboardPopupEvent class.
20  * @version     1.0
21  */
22 #include <new>
23 #include <FUiClipboardItem.h>
24 #include <FBaseErrors.h>
25 #include <FBaseSysLog.h>
26 #include "FUiCtrl_PublicClipboardPopupEvent.h"
27
28 using namespace Tizen::Base;
29 using namespace Tizen::Base::Runtime;
30 using namespace Tizen::Ui;
31
32 namespace Tizen { namespace Ui { namespace Controls
33 {
34 /**
35  * @class       _PublicClipboardPopupEventArg
36  * @brief       This class is used as the argument to clipboard-popup event listener.
37  *
38  */
39 class _PublicClipboardPopupEventArg
40         : public Tizen::Base::Runtime::IEventArg
41         , public Tizen::Base::Object
42 {
43 public:
44         _PublicClipboardPopupEventArg(const ClipboardItem* pClipboardItem);
45
46         virtual ~_PublicClipboardPopupEventArg(void);
47
48         const ClipboardItem* GetClipboardItem(void) const;
49
50 private:
51         _PublicClipboardPopupEventArg(const _PublicClipboardPopupEventArg& rhs);
52         _PublicClipboardPopupEventArg& operator =(const _PublicClipboardPopupEventArg& rhs);
53
54 private:
55         ClipboardItem* __pClipboardItem;
56 }; // _PublicClipboardPopupEventArg
57
58 _PublicClipboardPopupEventArg::_PublicClipboardPopupEventArg(const ClipboardItem* pClipboardItem)
59         : __pClipboardItem(const_cast <ClipboardItem*>(pClipboardItem))
60 {
61 }
62
63 _PublicClipboardPopupEventArg::~_PublicClipboardPopupEventArg(void)
64 {
65 }
66
67 const ClipboardItem*
68 _PublicClipboardPopupEventArg::GetClipboardItem(void) const
69 {
70         return __pClipboardItem;
71 }
72
73 _PublicClipboardPopupEvent*
74 _PublicClipboardPopupEvent::CreateInstanceN(void)
75 {
76         _PublicClipboardPopupEvent* pPublicClipboardPopupEvent = new (std::nothrow) _PublicClipboardPopupEvent();
77         SysTryReturn(NID_UI_CTRL, pPublicClipboardPopupEvent, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
78
79         result r = GetLastResult();
80         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
81
82         SetLastResult(E_SUCCESS);
83
84         return pPublicClipboardPopupEvent;
85
86 CATCH:
87         delete pPublicClipboardPopupEvent;
88         return null;
89 }
90
91 IEventArg*
92 _PublicClipboardPopupEvent::CreateClipboardPopupEventArgN(const ClipboardItem* pClipboardItem)
93 {
94         _PublicClipboardPopupEventArg* pEventArg = new (std::nothrow) _PublicClipboardPopupEventArg(pClipboardItem);
95         SysTryReturn(NID_UI_CTRL, pEventArg, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
96
97         SetLastResult(E_SUCCESS);
98
99         return pEventArg;
100 }
101
102 _PublicClipboardPopupEvent::~_PublicClipboardPopupEvent(void)
103 {
104 }
105
106 void
107 _PublicClipboardPopupEvent::FireImpl(IEventListener& listener, const IEventArg& arg)
108 {
109         IClipboardPopupEventListener* pEventListener = dynamic_cast <IClipboardPopupEventListener*>(&listener);
110         SysTryReturnVoidResult(NID_UI_CTRL, pEventListener, E_INVALID_ARG, "[E_INVALID_ARG] A specified input parameter is invalid.");
111
112         const _PublicClipboardPopupEventArg* pArg = dynamic_cast <const _PublicClipboardPopupEventArg*>(&arg);
113         SysTryReturnVoidResult(NID_UI_CTRL, pArg, E_INVALID_ARG, "[E_INVALID_ARG] A specified input parameter is invalid.");
114
115         pEventListener->OnClipboardPopupClosed(pArg->GetClipboardItem());
116
117         SetLastResult(E_SUCCESS);
118 }
119
120 _PublicClipboardPopupEvent::_PublicClipboardPopupEvent(void)
121 {
122         result r = _Event::Initialize();
123         SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
124
125         SetLastResult(E_SUCCESS);
126 }
127
128 }}} // Tizen::Ui::Controls