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.
19 * @file FUiCtrl_EditCopyPasteEvent.cpp
20 * @brief This is the implementation file for the _EditCopyPasteEvent class.
25 #include <FBaseErrors.h>
26 #include <FBaseSysLog.h>
28 #include "FUiCtrl_EditCopyPasteEvent.h"
31 using namespace Tizen::Base;
32 using namespace Tizen::Base::Runtime;
34 namespace Tizen {namespace Ui {namespace Controls
38 * @brief This class is used as the argument to change event listener.
40 * This class is used as the argument to change event listener. When an change event is generated
41 * (such as when a button is pressed) the TextSelectionEvent calls TextSelectionEventListener's OnTextd
42 * with an instance of this class as an argument.
44 * From this class, one can find out, the (event) source object and the change ID.
46 class _OSP_EXPORT_ _EditCopyPasteEventArg
53 * This is the default class constructor.
55 * @param[in] source A pointer to the Object instance which contains this instance.
57 _EditCopyPasteEventArg(CoreCopyPasteStatus status, CoreCopyPasteAction action);
60 * This is the class destructor.
63 virtual ~_EditCopyPasteEventArg(void);
66 CoreCopyPasteStatus GetStatus(void) const;
67 CoreCopyPasteAction GetAction(void) const;
72 CoreCopyPasteStatus __status;
73 CoreCopyPasteAction __action;
74 }; // _EditCopyPasteEventArg
76 _EditCopyPasteEventArg::_EditCopyPasteEventArg(CoreCopyPasteStatus status, CoreCopyPasteAction action)
83 _EditCopyPasteEventArg::~_EditCopyPasteEventArg(void)
89 _EditCopyPasteEventArg::GetStatus(void) const
95 _EditCopyPasteEventArg::GetAction(void) const
100 ////////////////////////////////////////////////////////////////////////////////
101 /// _EditCopyPasteEvent class Lifecycle
102 _EditCopyPasteEvent::_EditCopyPasteEvent(const _EditCopyPasteManager& source)
105 result r = _Event::Initialize();
114 _EditCopyPasteEvent::~_EditCopyPasteEvent(void)
120 _EditCopyPasteEvent::CreateInstanceN(const _EditCopyPasteManager& source)
122 _EditCopyPasteEvent* pCoreCopyPasteEvent = new (std::nothrow) _EditCopyPasteEvent(source);
123 SysTryReturn(NID_UI_CTRL, pCoreCopyPasteEvent, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
125 if (IsFailed(GetLastResult()))
130 return pCoreCopyPasteEvent;
133 delete pCoreCopyPasteEvent;
137 const _EditCopyPasteManager*
138 _EditCopyPasteEvent::GetSource(void) const
144 _EditCopyPasteEvent::FireImpl(IEventListener& listener, const IEventArg& arg)
146 _IEditCopyPasteEventListener* pCopyPasteEventListener = dynamic_cast <_IEditCopyPasteEventListener*>(&listener);
147 SysTryReturnVoidResult(NID_UI_CTRL, pCopyPasteEventListener != null, E_INVALID_ARG, "The Invalid listener is given.\n");
149 _EditCopyPasteEventArg* pCopyPasteEventArg = dynamic_cast <_EditCopyPasteEventArg*>(const_cast<IEventArg*>(&arg));
150 SysTryReturnVoidResult(NID_UI_CTRL, pCopyPasteEventArg != null, E_INVALID_ARG, "The Invalid Event Argument is given.\n");
152 CoreCopyPasteStatus status = pCopyPasteEventArg->GetStatus();
153 CoreCopyPasteAction action = pCopyPasteEventArg->GetAction();
155 pCopyPasteEventListener->OnEditCopyPasteStatusChanged(status, action);
157 SetLastResult(E_SUCCESS);
163 _EditCopyPasteEvent::CreateCopyPasteEventArgN(CoreCopyPasteStatus status, CoreCopyPasteAction action)
165 _EditCopyPasteEventArg* pEventArg = new (std::nothrow) _EditCopyPasteEventArg(status, action);
166 SysTryReturn(NID_UI_CTRL, pEventArg, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
171 }}} // Tizen::Ui::Controls