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_PublicClipboardPopupEvent.cpp
19 * @brief This is the implementation for the _PublicClipboardPopupEvent class.
23 #include <FUiClipboardItem.h>
24 #include <FBaseErrors.h>
25 #include <FBaseSysLog.h>
26 #include "FUiCtrl_PublicClipboardPopupEvent.h"
28 using namespace Tizen::Base;
29 using namespace Tizen::Base::Runtime;
30 using namespace Tizen::Ui;
32 namespace Tizen { namespace Ui { namespace Controls
35 * @class _PublicClipboardPopupEventArg
36 * @brief This class is used as the argument to clipboard-popup event listener.
39 class _PublicClipboardPopupEventArg
40 : public Tizen::Base::Runtime::IEventArg
41 , public Tizen::Base::Object
44 _PublicClipboardPopupEventArg(const ClipboardItem* pClipboardItem);
46 virtual ~_PublicClipboardPopupEventArg(void);
48 const ClipboardItem* GetClipboardItem(void) const;
51 _PublicClipboardPopupEventArg(const _PublicClipboardPopupEventArg& rhs);
52 _PublicClipboardPopupEventArg& operator =(const _PublicClipboardPopupEventArg& rhs);
55 ClipboardItem* __pClipboardItem;
56 }; // _PublicClipboardPopupEventArg
58 _PublicClipboardPopupEventArg::_PublicClipboardPopupEventArg(const ClipboardItem* pClipboardItem)
59 : __pClipboardItem(const_cast <ClipboardItem*>(pClipboardItem))
63 _PublicClipboardPopupEventArg::~_PublicClipboardPopupEventArg(void)
68 _PublicClipboardPopupEventArg::GetClipboardItem(void) const
70 return __pClipboardItem;
73 _PublicClipboardPopupEvent*
74 _PublicClipboardPopupEvent::CreateInstanceN(void)
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.");
79 result r = GetLastResult();
80 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
82 SetLastResult(E_SUCCESS);
84 return pPublicClipboardPopupEvent;
87 delete pPublicClipboardPopupEvent;
92 _PublicClipboardPopupEvent::CreateClipboardPopupEventArgN(const ClipboardItem* pClipboardItem)
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.");
97 SetLastResult(E_SUCCESS);
102 _PublicClipboardPopupEvent::~_PublicClipboardPopupEvent(void)
107 _PublicClipboardPopupEvent::FireImpl(IEventListener& listener, const IEventArg& arg)
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.");
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.");
115 pEventListener->OnClipboardPopupClosed(pArg->GetClipboardItem());
117 SetLastResult(E_SUCCESS);
120 _PublicClipboardPopupEvent::_PublicClipboardPopupEvent(void)
122 result r = _Event::Initialize();
123 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
125 SetLastResult(E_SUCCESS);
128 }}} // Tizen::Ui::Controls