2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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 FUi_UiNotificationEvent.cpp
19 * @brief This is the implementation file for the _UiNotificationEvent class.
22 #include <FBaseResult.h>
23 #include <FBaseSysLog.h>
24 #include "FUi_UiNotificationEvent.h"
25 #include "FUi_INotificationEventListener.h"
26 #include "FUi_INotificationEventPreviewer.h"
27 #include "FUi_Control.h"
29 namespace Tizen { namespace Ui
32 _UiNotificationEvent::_UiNotificationEvent(const _UiObjectHandle& destination, Tizen::Base::Collection::IList* pArgs, _UiEventRouteType routeType, const _UiObjectHandle& source)
33 : _UiEvent(destination, source, routeType)
38 _UiNotificationEvent::~_UiNotificationEvent(void)
42 _UiNotificationEvent::_UiNotificationEvent(const _UiNotificationEvent& rhs)
44 , __pArgs(rhs.__pArgs)
49 _UiNotificationEvent::operator =(const _UiNotificationEvent& rhs)
51 _UiEvent::operator =(rhs);
55 __pArgs = rhs.__pArgs;
61 Tizen::Base::Collection::IList*
62 _UiNotificationEvent::GetArgs(void) const
68 _UiNotificationEvent::CloneN(void) const
70 return new (std::nothrow) _UiNotificationEvent(*this);
74 _UiNotificationEvent::GetEventType(void) const
76 return _UI_EVENT_NOTIFICAITON;
80 _UiNotificationEvent::IsEventEnabled(const _Control& control) const
86 _UiNotificationEvent::OnPreviewEventProcessing(const _Control& control, bool& isFiltered)
90 _INotificationEventPreviewer* pNotificationPreviewer = control.GetEventPreviewer<_UI_EVENT_NOTIFICAITON, _INotificationEventPreviewer*>();
91 SysTryReturn(NID_UI, pNotificationPreviewer, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] System error occurred.");
93 const _Control* pTarget = GetControl(GetDestination());
94 SysTryReturn(NID_UI, pTarget, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] System error occurred.");
96 isFiltered = pNotificationPreviewer->OnPreviewNotifiedN(*pTarget, GetArgs());
102 _UiNotificationEvent::OnEventProcessing(const _Control& control, bool& isFiltered)
109 _INotificationEventListener* pNotificationListener = control.GetEventListener<_UI_EVENT_NOTIFICAITON, _INotificationEventListener*>();
110 SysTryReturn(NID_UI, pNotificationListener, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] System error occurred.");
112 return FireListener(pNotificationListener, isFiltered);
116 _UiNotificationEvent::OnListenerProcessing(const _IUiEventListener& listener, bool& isFiltered)
118 _INotificationEventListener* pNotificationListener = dynamic_cast <_INotificationEventListener*>(const_cast <_IUiEventListener*>(&listener));
119 SysTryReturn(NID_UI, pNotificationListener, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] System error occurred.");
121 return FireListener(pNotificationListener, isFiltered);
125 _UiNotificationEvent::FireListener(const _INotificationEventListener* pListener, bool& isFiltered)
127 result r = E_SUCCESS;
129 _INotificationEventListener* pNotificationListener = const_cast <_INotificationEventListener*>(pListener);
130 SysTryReturn(NID_UI, pNotificationListener, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] System error occurred.");
132 const _Control* pTarget = GetControl(GetDestination());
133 SysTryReturn(NID_UI, pTarget, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] System error occurred.");
135 isFiltered = pNotificationListener->OnNotifiedN(*pTarget, GetArgs());