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_UiEvent.cpp
19 * @brief This is the implementation file for the _UiEvent class.
22 #include <FBaseResult.h>
23 #include <FBaseSysLog.h>
24 #include <FApp_AppInfo.h>
25 #include "FUi_UiEvent.h"
26 #include "FUi_Control.h"
27 #include "FUi_ControlManager.h"
29 using namespace Tizen::Base;
30 using namespace Tizen::App;
32 namespace Tizen { namespace Ui
34 _UiEvent::_UiEvent(const _UiObjectHandle& destination, const _UiObjectHandle& source, _UiEventRouteType routeType)
35 : __destination(destination)
37 , __originalDestination(destination)
38 , __routeType(routeType)
39 , __accessibilityEvent(false)
43 _UiEvent::~_UiEvent(void)
47 _UiEvent::_UiEvent(const _UiEvent& rhs)
48 : __destination(rhs.__destination)
49 , __source(rhs.__source)
50 , __originalDestination(rhs.__originalDestination)
51 , __routeType(rhs.__routeType)
52 , __accessibilityEvent(rhs.__accessibilityEvent)
57 _UiEvent::operator =(const _UiEvent& rhs)
61 __destination = rhs.__destination;
62 __source = rhs.__source;
63 __originalDestination = rhs.__originalDestination;
64 __routeType = rhs.__routeType;
71 _UiEvent::GetDestination(void) const
77 _UiEvent::GetSource(void) const
83 _UiEvent::SetOriginalDestination(const _Control& control)
85 __originalDestination = control.GetHandle();
89 _UiEvent::GetOriginalDestination(void) const
91 return __originalDestination;
95 _UiEvent::SetRouteType(_UiEventRouteType routeType)
97 __routeType = routeType;
101 _UiEvent::GetRouteType(void) const
107 _UiEvent::ProcessPreviewEvent(const _Control& control, bool& isFiltered)
109 if (!IsEventEnabled(control))
114 return OnPreviewEventProcessing(control, isFiltered);
118 _UiEvent::ProcessEvent(const _Control& control, bool& isFiltered)
120 if (!IsEventEnabled(control))
125 bool isInputFiltered = isFiltered;
126 result r = OnEventProcessing(control, isFiltered);
127 SysTryReturn(NID_UI, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] System error occurred.");
129 if (!isInputFiltered && isFiltered)
131 const _Control* pTarget = GetControl(GetDestination());
132 SysTryReturn(NID_UI, pTarget, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] System error occurred.");
134 if (IsEventEnabled(*pTarget) && (pTarget != &control))
136 r = OnEventHandled(control);
144 _UiEvent::ProcessListener(const _IUiEventListener& listener, bool& isFiltered)
146 return OnListenerProcessing(listener, isFiltered);
150 _UiEvent::GetControl(const _UiObjectHandle& handle) const
152 _ControlManager* pControlManager = _ControlManager::GetInstance();
153 SysTryReturn(NID_UI, pControlManager, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
155 return pControlManager->GetObject(handle);
159 _UiEvent::IsEventEnabled(const _Control& control) const
161 if (_AppInfo::GetApiVersion() == _API_VERSION_2_0 && _AppInfo::IsOspCompat())
166 if (!control.IsEnabled())
175 _UiEvent::OnEventHandled(const _Control& control)
181 _UiEvent::SetAccessibilityEvent(bool set)
183 __accessibilityEvent = set;
187 _UiEvent::GetAccessibilityEvent(void) const
189 return __accessibilityEvent;