if (status == _TOUCH_PRESSED)
{
- _Control* pControl = GetTarget(current.x, current.y, pRootControl);
+ pTouchManager->SetListenerOnly(pointId, false);
+ _Control* pControl = GetTarget(current.x, current.y, pRootControl, pointId);
if (pControl == null)
{
_TouchEvent(const _TouchEvent& rhs);
_TouchEvent& operator =(const _TouchEvent& rhs);
- _Control* GetTarget(int x, int y, const _Control* pRootControl) const
+ _Control* GetTarget(int x, int y, const _Control* pRootControl, int pointId) const
{
ClearLastResult();
_TouchManager* pTouchManager = _TouchManager::GetInstance();
SysTryReturn(NID_UI, pTouchManager, null, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
- _Control* pCapturedControl = pTouchManager->GetCapturedControl();
- _Control* pControl = null;
-
_ControlManager* pControlManager = _ControlManager::GetInstance();
SysTryReturn(NID_UI, pControlManager, null, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+ _Control* pControl = null;
+
Tizen::Graphics::FloatPoint ptf(static_cast<float>(x), static_cast<float>(y));
- _ControlVisualElement* pRootControlElement = null;
if (pRootControl)
{
- pRootControlElement = dynamic_cast<_ControlVisualElement*>(pRootControl->GetVisualElement());
+ _ControlVisualElement* pRootControlElement = dynamic_cast<_ControlVisualElement*>(pRootControl->GetVisualElement());
+ if (pRootControlElement == null)
+ {
+ SetLastResult(E_SYSTEM);
+ return null;
+ }
+
+ _ControlVisualElement* pControlVisualElement = pRootControlElement->GetControlChildAtPoint(ptf);
+ if (pControlVisualElement)
+ {
+ pControl = static_cast <_Control*>(pControlVisualElement->GetUserData());
+ }
}
else
{
- _Window* pWindow = null;
- pWindow = pControlManager->GetTouchedWindow();
- if (pWindow == null)
+ _Window* pTouchedWindow = pControlManager->GetTouchedWindow();
+ if (pTouchedWindow == null)
{
SetLastResult(E_SYSTEM);
return null;
}
- int owneeCount = pWindow->GetOwneeCount();
- if (owneeCount > 0)
+ _RootVisualElement* pRootVisualElement = pTouchedWindow->GetRootVisualElement();
+ if (pRootVisualElement == null)
{
- _Window* pOwneeWindow = null;
+ SetLastResult(E_SYSTEM);
+ return null;
+ }
+
+ Tizen::Graphics::Rectangle touchedWindowBounds = pTouchedWindow->GetBounds();
+ ptf.x = static_cast<float>(x - touchedWindowBounds.x);
+ ptf.y = static_cast<float>(y - touchedWindowBounds.y);
- for(int i =owneeCount-1; i>=0; i--)
+ Tizen::Base::Collection::IList* pList = pRootVisualElement->GetChildrenN();
+ if (!pList)
+ {
+ SetLastResult(E_SYSTEM);
+ return null;
+ }
+
+ int count = pList->GetCount();
+ for (int i = count-1; i>=0; i--)
+ {
+ _ControlVisualElement* pChildControlVisualElement = dynamic_cast<_ControlVisualElement*>(pList->GetAt(i));
+ if (pChildControlVisualElement)
{
- pOwneeWindow = pWindow->GetOwnee(i);
- if (pOwneeWindow && pOwneeWindow->GetVisibleState() == true && pOwneeWindow->GetEnableState())
+ _Control* pChildControl = static_cast<_Control*>(pChildControlVisualElement->GetUserData());
+ if (pChildControl == null)
{
- Tizen::Graphics::Rectangle rc(pOwneeWindow->GetAbsoluteBounds(true));
- if ((x >= rc.x) && (x <= (rc.x + rc.width)) && (y >= rc.y) && (y <= (rc.y + rc.height)))
+ continue;
+ }
+
+ _Window* pChildWindow = dynamic_cast<_Window*>(pChildControl);
+ if (pChildWindow == null)
+ {
+ continue;
+ }
+
+ Tizen::Graphics::FloatPoint tempPoint(ptf);
+
+ if (pChildWindow && pChildWindow->GetWindowType() == _WINDOW_TYPE_VE)
+ {
+ Tizen::Graphics::Rectangle windowBounds = pChildWindow->GetBounds();
+ tempPoint.x = static_cast<float>(tempPoint.x - windowBounds.x);
+ tempPoint.y = static_cast<float>(tempPoint.y - windowBounds.y);
+ }
+
+ _ControlVisualElement* pControlVisualElement = pChildControlVisualElement->GetControlChildAtPoint(tempPoint);
+ if (pControlVisualElement)
+ {
+ pControl = static_cast <_Control*>(pControlVisualElement->GetUserData());
+ if (pControl == null)
+ {
+ pControl = dynamic_cast<_Control*>(pTouchedWindow);
+ pTouchManager->SetListenerOnly(pointId, true);
+ if (pList)
+ {
+ delete pList;
+ }
+ return pControl;
+ }
+ else
{
- pWindow = pOwneeWindow;
break;
}
}
}
}
-
- Rectangle winBounds = pWindow->GetBounds();
-
- ptf.x = static_cast<float>(x - winBounds.x);
- ptf.y = static_cast<float>(y - winBounds.y);
-
- pRootControlElement = dynamic_cast <_ControlVisualElement*>(pWindow->GetVisualElement());
- }
-
- if (pRootControlElement == null)
- {
- SetLastResult(E_SYSTEM);
- return null;
- }
-
- _ControlVisualElement* pControlVisualElement = pRootControlElement->GetControlChildAtPoint(ptf);
- if (pControlVisualElement)
- {
- pControl = static_cast <_Control*>(pControlVisualElement->GetUserData());
+ delete pList;
}
+ _Control* pCapturedControl = pTouchManager->GetCapturedControl();
if (pCapturedControl)
{
if (pTouchManager->IsCaptureAllowedOwnerBounds())