modify TouchCapture to support Owner control
authorminkyu kim <imetjade.kim@samsung.com>
Sun, 24 Mar 2013 07:59:21 +0000 (16:59 +0900)
committerminkyu kim <imetjade.kim@samsung.com>
Sun, 24 Mar 2013 08:06:48 +0000 (17:06 +0900)
Change-Id: I5d0155ac73fff25f1466e8721b194551edf80e9e

14 files changed:
src/ui/FUi_Control.cpp
src/ui/FUi_EflUiEventManager.cpp
src/ui/FUi_TouchManager.cpp
src/ui/controls/FUiCtrl_ContextMenu.cpp
src/ui/controls/FUiCtrl_DateTimeBar.cpp
src/ui/controls/FUiCtrl_FastScroll.cpp
src/ui/controls/FUiCtrl_MessageBoxPresenter.cpp
src/ui/controls/FUiCtrl_OptionMenu.cpp
src/ui/controls/FUiCtrl_OptionMenuPresenter.cpp
src/ui/controls/FUiCtrl_Popup.cpp
src/ui/controls/FUiCtrl_ProgressPopup.cpp
src/ui/inc/FUi_Control.h
src/ui/inc/FUi_TouchManager.h
src/ui/inc/FUi_Types.h

index 72a15df..86b412b 100755 (executable)
@@ -4033,12 +4033,12 @@ _Control::GetDescription(void) const
 }
 
 void
-_Control::SetTouchCapture(bool allowOutOfBounds)
+_Control::SetTouchCapture(_TouchCapture touchCaptureType)
 {
        _TouchManager* pTouchManager = _TouchManager::GetInstance();
        SysTryReturnVoidResult(NID_UI, pTouchManager != null, E_SYSTEM, "[E_SYSTEM] TouchManager Instance is null");
 
-       pTouchManager->SetCapturedControl(this, allowOutOfBounds);
+       pTouchManager->SetCapturedControl(this, touchCaptureType);
 }
 
 void
@@ -4047,7 +4047,7 @@ _Control::ReleaseTouchCapture(void)
        _TouchManager* pTouchManager = _TouchManager::GetInstance();
        SysTryReturnVoidResult(NID_UI, pTouchManager != null, E_SYSTEM, "[E_SYSTEM] TouchManager Instance is null");
 
-       pTouchManager->SetCapturedControl(null, false);
+       pTouchManager->SetCapturedControl(null, _TOUCH_CAPTURE_ALLOW_INNER_BOUNDS);
 }
 
 _Control*
index b72566d..5ba9b67 100644 (file)
@@ -598,10 +598,25 @@ private:
 
                if (pCapturedControl)
                {
-                       if (pTouchManager->IsCaptureAllowedOutOfBounds())
+                       if (pTouchManager->GetCaptureAllowedType() == _TOUCH_CAPTURE_ALLOW_OUT_OF_BOUNDS)
                        {
                                pControl = pCapturedControl;
                        }
+                       else if (pTouchManager->GetCaptureAllowedType() == _TOUCH_CAPTURE_ALLOW_OWNER_BOUNDS)
+                       {
+                               Tizen::Graphics::Rectangle rc(pCapturedControl->GetAbsoluteBounds());
+                               Tizen::Graphics::Rectangle ownerRc((dynamic_cast<_Window*>(pCapturedControl)->GetOwner())->GetAbsoluteBounds());
+
+                               if ((x < ownerRc.x) || (x > (ownerRc.x + ownerRc.width)) || (y < ownerRc.y) || (y > (ownerRc.y + ownerRc.height)))
+                               {
+                                       pControl = dynamic_cast<_Window*>(pCapturedControl)->GetOwner();
+                               }
+
+                               if ((x < rc.x) || (x > (rc.x + rc.width)) || (y < rc.y) || (y > (rc.y + rc.height)))
+                               {
+                                       pControl = pCapturedControl;
+                               }
+                       }
                        else
                        {
                                Tizen::Graphics::Rectangle rc(pCapturedControl->GetAbsoluteBounds());
index e51affe..c58bc70 100644 (file)
@@ -586,7 +586,7 @@ _TouchManager::_TouchManager(void)
        , __touchCanceled(false)
        , __touchAllowed(true)
        , __pTouchEventListener(null)
-       , __captureAllowOutOfBounds(false)
+       , __touchCaptureType(_TOUCH_CAPTURE_ALLOW_INNER_BOUNDS)
        , __isSendingDelayedEvent(true)
        , __touchCanceledOnGestureSuccess(false)
        , __changedTouchableTarget(null)
@@ -998,7 +998,7 @@ _TouchManager::IsInTouchMoveAllowanceBounds(const _Control& source, const _Touch
 }
 
 void
-_TouchManager::SetCapturedControl(const _Control* pControl, bool allowOutOfBounds)
+_TouchManager::SetCapturedControl(const _Control* pControl, _TouchCapture touchCaptureType)
 {
        if (pControl)
        {
@@ -1009,7 +1009,7 @@ _TouchManager::SetCapturedControl(const _Control* pControl, bool allowOutOfBound
                __capturedControlHandle = _ControlHandle();
        }
 
-       __captureAllowOutOfBounds = allowOutOfBounds;
+       __touchCaptureType = touchCaptureType;
 }
 
 _Control*
@@ -1021,10 +1021,10 @@ _TouchManager::GetCapturedControl(void) const
        return pControlManager->GetObject(__capturedControlHandle);
 }
 
-bool
-_TouchManager::IsCaptureAllowedOutOfBounds(void) const
+_TouchCapture
+_TouchManager::GetCaptureAllowedType(void) const
 {
-       return __captureAllowOutOfBounds;
+       return __touchCaptureType;
 }
 
 void
index a15320e..a043647 100644 (file)
@@ -312,11 +312,11 @@ _ContextMenu::OnAttachedToMainTree(void)
 
        if (__style == CONTEXT_MENU_CORE_STYLE_LIST)
        {
-               SetTouchCapture();
+               SetTouchCapture(_TOUCH_CAPTURE_ALLOW_INNER_BOUNDS);
        }
        else
        {
-               SetTouchCapture(true);
+               SetTouchCapture(_TOUCH_CAPTURE_ALLOW_OUT_OF_BOUNDS);
        }
 
        SetAllAccessibilityElement();
index ed98d7f..130062f 100644 (file)
@@ -465,7 +465,7 @@ _DateTimeBar::OnAttachedToMainTree(void)
 
        __pDateTimeBarPresenter->StartAnimationEffect();
 
-       SetTouchCapture();
+       SetTouchCapture(_TOUCH_CAPTURE_ALLOW_INNER_BOUNDS);
 
        __isAttachedToMainTree = true;
 
index aea5323..16a8e99 100644 (file)
@@ -59,7 +59,7 @@ public:
                else
                {
                        __onAccessibility = true;
-                       __pFastScroll->SetTouchCapture(true);
+                       __pFastScroll->SetTouchCapture(_TOUCH_CAPTURE_ALLOW_OUT_OF_BOUNDS);
                }
 
                _AccessibilityContainer* pAccessibilityContainer = __pFastScroll->GetAccessibilityContainer();
index cc6e2bf..0772c66 100755 (executable)
@@ -465,11 +465,11 @@ _MessageBoxPresenter::ShowAndWait(int& modalResult)
 
        if (__pMessageBox->GetMsgBoxStyle() == MSGBOX_STYLE_NONE)
        {
-               __pMessageBox->SetTouchCapture(true);
+               __pMessageBox->SetTouchCapture(_TOUCH_CAPTURE_ALLOW_OUT_OF_BOUNDS);
        }
        else
        {
-               __pMessageBox->SetTouchCapture();
+               __pMessageBox->SetTouchCapture(_TOUCH_CAPTURE_ALLOW_INNER_BOUNDS);
        }
 
        ProcessEvent();
index c99db8c..ff623fb 100644 (file)
@@ -422,7 +422,7 @@ _OptionMenu::ShowSubMenu(int mainIndex, _OptionMenuItem& item)
        }
 
        __pSubMenu->Open();
-       SetTouchCapture();
+       SetTouchCapture(_TOUCH_CAPTURE_ALLOW_INNER_BOUNDS);
        __subMenuIndex = mainIndex;
 
        return E_SUCCESS;
@@ -540,7 +540,7 @@ _OptionMenu::OnActivated(void)
                __pOptionMenuPresenter->SetOptionMenuVisibility(true);
        }
 
-       SetTouchCapture();
+       SetTouchCapture(_TOUCH_CAPTURE_ALLOW_INNER_BOUNDS);
 }
 
 void
index 415cccb..cf9be25 100755 (executable)
@@ -1352,7 +1352,7 @@ _OptionMenuPresenter::OnVisibleStateChanged(void)
        {
                if (_ControlManager::GetInstance()->GetTopWindow() == __pOptionMenu)
                {
-                       __pOptionMenu->SetTouchCapture();
+                       __pOptionMenu->SetTouchCapture(_TOUCH_CAPTURE_ALLOW_INNER_BOUNDS);
                }
        }
        else
@@ -1376,7 +1376,7 @@ _OptionMenuPresenter::OnTouchPressed(const _Control& source, const _TouchInfo& t
        if (__pOptionMenu->IsSubMenuShown() == true)
        {
                __pOptionMenu->DestroySubMenu();
-               __pOptionMenu->SetTouchCapture();
+               __pOptionMenu->SetTouchCapture(_TOUCH_CAPTURE_ALLOW_INNER_BOUNDS);
                return true;
        }
 
index b30cc1b..402fcfe 100644 (file)
@@ -440,7 +440,7 @@ _Popup::OnActivated(void)
                        SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
                }
 
-               SetTouchCapture();
+               SetTouchCapture(_TOUCH_CAPTURE_ALLOW_INNER_BOUNDS);
        }
        else
        {
index edf9af5..c5d9bc9 100644 (file)
@@ -565,7 +565,7 @@ _ProgressPopup::OnActivated(void)
                r = _pDimmingLayer->SetDimmingEnabled(true);
                SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
 
-               SetTouchCapture();
+               SetTouchCapture(_TOUCH_CAPTURE_ALLOW_INNER_BOUNDS);
        }
        else
        {
index 6b2aa83..4954595 100755 (executable)
@@ -491,7 +491,7 @@ public:
 
        void SetMultiTouchEnabled(bool enabled);
        bool IsMultiTouchEnabled(void) const;
-       void SetTouchCapture(bool allowOutOfBounds = false);
+       void SetTouchCapture(_TouchCapture touchCaptureType);
        void ReleaseTouchCapture(void);
 
        bool IsDragEnabled(void) const;
index b535ed5..fe6738f 100644 (file)
@@ -336,7 +336,7 @@ public:
         *
         * @since 2.0
         */
-       void SetCapturedControl(const _Control* pControl, bool allowOutOfBounds);
+       void SetCapturedControl(const _Control* pControl, _TouchCapture touchCaptureType);
 
        /**
         * This method returns touch captured control
@@ -346,7 +346,7 @@ public:
         */
        _Control* GetCapturedControl(void) const;
 
-       bool IsCaptureAllowedOutOfBounds(void) const;
+       _TouchCapture GetCaptureAllowedType(void) const;
 
        /**
        * This method resets touch information, point count and cursorID etc.
@@ -413,7 +413,7 @@ private:
        bool __touchCanceled;
        bool __touchAllowed;
        _ITouchEventListener* __pTouchEventListener;
-       bool __captureAllowOutOfBounds; //will be deleted
+       _TouchCapture __touchCaptureType;       //will be deleted
        bool __isSendingDelayedEvent;
        bool __touchCanceledOnGestureSuccess;
        _Control* __changedTouchableTarget;
index 0c2e2af..a113f53 100644 (file)
@@ -72,6 +72,13 @@ enum _ControlZOrderUpdate
        _CONTROL_ZORDER_UPDATE_DOWNWARD,
 };
 
+enum _TouchCapture
+{
+       _TOUCH_CAPTURE_ALLOW_INNER_BOUNDS,
+       _TOUCH_CAPTURE_ALLOW_OWNER_BOUNDS,
+       _TOUCH_CAPTURE_ALLOW_OUT_OF_BOUNDS
+};
+
 template <int V>
 struct _IntToType
 {