}
}
+ virtual bool TranslateKeyEventInfo(const _Control& source, _KeyInfo& keyInfo)
+ {
+ SysTryReturn(NID_UI, __impl.__pCoreKeyEvent, false, E_SYSTEM, "[E_SYSTEM] System error occurred.");
+
+ bool isFiltered = false;
+
+ if (__impl.__pPublicPropagatedKeyEventListener != null)
+ {
+ _ControlImpl* pControlImpl = static_cast<_ControlImpl*>(source.GetUserData());
+ SysTryReturn(NID_UI, pControlImpl, false, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] pControlImpl == null.");
+
+ Control& control = static_cast<Control&>(pControlImpl->GetPublic());
+
+ KeyEventInfo* pKeyEventInfo = new (std::nothrow) KeyEventInfo(static_cast<KeyCode>(keyInfo.GetKeyCode()),
+ static_cast<KeyModifier>(keyInfo.GetKeyModifier()));
+
+ isFiltered = __impl.__pPublicPropagatedKeyEventListener->TranslateKeyEventInfo(control, *pKeyEventInfo);
+ if (isFiltered)
+ {
+ keyInfo.SetKeyCode(static_cast<_KeyCode>(pKeyEventInfo->GetKeyCode()));
+ keyInfo.SetKeyModifier(static_cast<_KeyModifier>(pKeyEventInfo->GetKeyModifier()));
+ return true;
+ }
+ }
+
+ // 3. Impl
+ isFiltered = __impl.TranslateKeyEventInfo(__impl, keyInfo);
+ if (isFiltered)
+ {
+ return true;
+ }
+
+ // 4. Core
+ isFiltered = __core.TranslateKeyEventInfo(source, keyInfo);
+
+ return isFiltered;
+ }
+
virtual bool OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
{
SysTryReturn(NID_UI, __impl.__pCoreKeyEvent, false, E_SYSTEM, "[E_SYSTEM] System error occurred.");
}
bool
+_ControlImpl::TranslateKeyEventInfo(const _ControlImpl& source, _KeyInfo& keyInfo)
+{
+ return false;
+}
+
+bool
_ControlImpl::OnKeyPressed(const _ControlImpl& source, const _KeyInfo& keyInfo)
{
return false;
if (r == E_SUCCESS)
{
+ if (event.GetEventType() == _UI_EVENT_KEY)
+ {
+ CallTranslateKeyEventInfo(event,isFiltered);
+ }
+
ProcessTunnelingEvent(tunnelingPath, event, isFiltered);
if (event.GetEventType() == _UI_EVENT_TOUCH)
}
result
+_UiEventManager::CallTranslateKeyEventInfo(const _UiEvent& event, bool& isFiltered)
+{
+ _ControlManager* pControlManager = _ControlManager::GetInstance();
+ SysTryReturn(NID_UI, pControlManager, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] System error occurred.");
+
+ _Control* pTarget = pControlManager->GetObject(event.GetDestination());
+ SysTryReturn(NID_UI, pTarget, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] pTarget is null.");
+
+ _UiKeyEvent& keyEvent = static_cast<_UiKeyEvent&>(const_cast<_UiEvent&>(event));
+
+ _KeyInfo* pKeyInfo = keyEvent.GetKeyInfo();
+ SysTryReturn(NID_UI, pKeyInfo, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] pTarget is null.");
+
+ _IPropagatedKeyEventListener* pKeyEventListener = pTarget->GetPropagatedKeyEventListener();
+ SysTryReturn(NID_UI, pKeyEventListener, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] System error occurred.");
+
+ pKeyEventListener->TranslateKeyEventInfo(*pTarget, *pKeyInfo);
+
+ return E_SUCCESS;
+}
+
+result
_UiEventManager::ProcessGlobalGesture(const _UiEvent& event, bool& isFiltered)
{
if (event.GetEventType() != _UI_EVENT_TOUCH)
return *this;
}
-const _KeyInfo*
+_KeyInfo*
_UiKeyEvent::GetKeyInfo(void) const
{
- return &__keyInfo;
+ return const_cast<_KeyInfo*>(&__keyInfo);
}
_UiKeyEvent*
virtual ~_IPropagatedKeyEventListener(void){}
virtual bool OnPreviewKeyPressed(const _Control& source, const _KeyInfo& keyInfo) = 0;
virtual bool OnPreviewKeyReleased(const _Control& source, const _KeyInfo& keyInfo) = 0;
+ virtual bool TranslateKeyEventInfo(const _Control& source, _KeyInfo& keyInfo) = 0;
};
class _OSP_EXPORT_ _Control // Temp: export only for test
virtual void OnFocusableStateChanged(bool focusalbeState);
// Event Callbacks
+ virtual bool TranslateKeyEventInfo(const _ControlImpl& source, _KeyInfo& keyInfo);
virtual bool OnKeyPressed(const _ControlImpl& source, const _KeyInfo& keyInfo);
virtual bool OnKeyReleased(const _ControlImpl& source, const _KeyInfo& keyInfo);
_UiObjectHandle GetTarget(void) const;
_UiObjectHandle GetTarget(int x, int y) const;
void RemoveAllEventListenerList(Tizen::Base::Collection::HashMapT<_UiEventType, Tizen::Base::Collection::LinkedListT<_IUiEventListener*>*>* pMap);
+ result CallTranslateKeyEventInfo(const _UiEvent& event, bool& isFiltered);
_UiEventManager(void);
~_UiEventManager(void);
_UiEventManager(const _UiEventManager& rhs);
_UiKeyEvent& operator =(const _UiKeyEvent& rhs);
public:
- const _KeyInfo* GetKeyInfo(void) const;
+ _KeyInfo* GetKeyInfo(void) const;
private:
void SetKeyState(KeyState keyState);