Applied IPropagatedTouchEventListener on ListView, GroupedListView
authorSuhwan_Park <suhwan0927.park@samsung.com>
Thu, 11 Apr 2013 04:48:31 +0000 (13:48 +0900)
committerSuhwan_Park <suhwan0927.park@samsung.com>
Thu, 11 Apr 2013 12:16:05 +0000 (21:16 +0900)
Change-Id: I2e2335b4f9fa31a41a3a32bee214028701aff30c
Signed-off-by: Suhwan_Park <suhwan0927.park@samsung.com>
src/ui/CMakeLists.txt
src/ui/controls/FUiCtrl_GroupedListViewImpl.cpp
src/ui/controls/FUiCtrl_ListViewImpl.cpp
src/ui/controls/FUiCtrl_ListViewItem.cpp
src/ui/controls/FUiCtrl_ListViewTouchEventHandler.cpp [deleted file]
src/ui/inc/FUiCtrl_GroupedListViewImpl.h
src/ui/inc/FUiCtrl_ListViewImpl.h
src/ui/inc/FUiCtrl_ListViewItem.h
src/ui/inc/FUiCtrl_ListViewTouchEventHandler.h [deleted file]

index a08e633..d66e184 100644 (file)
@@ -558,7 +558,6 @@ SET (${this_target}_SOURCE_FILES
        controls/FUiCtrl_ListViewItem.cpp
        controls/FUiCtrl_ListViewItemProviderAdaptor.cpp
        controls/FUiCtrl_ListViewModel.cpp
-       controls/FUiCtrl_ListViewTouchEventHandler.cpp
        controls/FUiCtrl_SimpleItemImpl.cpp
        controls/FUiCtrl_UiListViewItemEvent.cpp
        controls/FUiCtrl_UiListViewItemEventArg.cpp
index eb98aae..71995aa 100644 (file)
 #include <FApp_AppInfo.h>
 #include <FGrp_TextTextSimple.h>
 #include "FUi_CoordinateSystemUtils.h"
+#include "FUi_ITouchLongPressGestureEventListener.h"
 #include "FUi_Math.h"
 #include "FUi_ResourceManager.h"
+#include "FUi_TouchEventArg.h"
+#include "FUi_TouchLongPressGestureDetector.h"
+#include "FUi_TouchManager.h"
 #include "FUi_UiBuilder.h"
 #include "FUiCtrl_FastScrollEvent.h"
 #include "FUiCtrl_FastScrollEventArg.h"
 #include "FUiCtrl_ScrollEventArg.h"
 
 using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
 using namespace Tizen::Base::Runtime;
+using namespace Tizen::Base::Utility;
 using namespace Tizen::Graphics;
 using namespace Tizen::Graphics::_Text;
 
 namespace Tizen { namespace Ui { namespace Controls
 {
 
+class _GroupedListViewImpl::_GroupedListViewPropagatedTouchEventListener
+       : public Tizen::Ui::_IPropagatedTouchEventListener
+       , public Tizen::Ui::_ITouchLongPressGestureEventListener
+{
+public:
+
+       _GroupedListViewPropagatedTouchEventListener(_GroupedListViewImpl& impl)
+               : __impl(impl)
+               , __core(impl.GetCore())
+               , __public(impl.GetPublic())
+               , __oldPreviousPressedTime(0)
+               , __previousPressedTime(0)
+               , __currentPressedTime(0)
+               , __previousPressedPoint(0.0f, 0.0f)
+               , __currentPressedPoint(0.0f, 0.0f)
+               , __pLongPressedGesture(null)
+       {
+               __pTouchManager = _TouchManager::GetInstance();
+               SysTryReturnVoidResult(NID_UI, (__pTouchManager != null), E_SYSTEM, "[E_SYSTEM] System error occurred.");
+
+               // Add _TouchLongPressGestureDetector
+               __pLongPressedGesture = new (std::nothrow) _TouchLongPressGestureDetector();
+               SysTryReturnVoidResult(NID_UI_CTRL, (__pLongPressedGesture != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+               __core.AddGestureDetector(*__pLongPressedGesture);
+               __pLongPressedGesture->AddGestureListener(*this);
+       }
+
+       virtual ~_GroupedListViewPropagatedTouchEventListener(void)
+       {
+               if (__pLongPressedGesture != null)
+               {
+                       __pLongPressedGesture->RemoveGestureListener(*this);
+                       __core.RemoveGestureDetector(*__pLongPressedGesture);
+
+                       delete __pLongPressedGesture;
+                       __pLongPressedGesture = null;
+               }
+       }
+
+       virtual bool OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
+       {
+               return __impl.CallOnTouchPressed(source, touchInfo);
+       }
+
+       virtual bool OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
+       {
+               return __impl.CallOnTouchReleased(source, touchInfo);
+       }
+
+       virtual bool OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
+       {
+               return __impl.CallOnTouchMoved(source, touchInfo);
+       }
+
+       virtual bool OnTouchCanceled(const _Control& source, const _TouchInfo& touchInfo)
+       {
+               return __impl.CallOnTouchCanceled(source, touchInfo);
+       }
+
+       virtual _UiTouchEventDelivery OnPreviewTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
+       {
+               _UiTouchEventDelivery isFiltered = _UI_TOUCH_EVENT_DELIVERY_NO;
+               IPropagatedTouchEventListener* pListener = __impl.GetPublicPropagatedTouchEventListener();
+
+               if (pListener != null)
+               {
+                       Control& control = __impl.GetPublic();
+
+                       TouchEventInfo publicTouchInfo;
+
+                       _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
+                       SysTryReturn(NID_UI, pEventArg, _UI_TOUCH_EVENT_DELIVERY_YES, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
+
+                       publicTouchInfo.Construct(*pEventArg);
+
+                       if (pEventArg)
+                       {
+                               delete pEventArg;
+                               pEventArg = null;
+                       }
+
+                       if (pListener->OnTouchPressed(control, publicTouchInfo) == true)
+                       {
+                               return _UI_TOUCH_EVENT_DELIVERY_NO;
+                       }
+               }
+
+               // public TouchEventListener
+               if (ProcessTouchEventListener(touchInfo) == true)
+               {
+                       return _UI_TOUCH_EVENT_DELIVERY_NO;
+               }
+
+               isFiltered = __impl.OnPreviewTouchPressed(__impl, touchInfo);
+               if (isFiltered == _UI_TOUCH_EVENT_DELIVERY_NO)
+               {
+                       return _UI_TOUCH_EVENT_DELIVERY_NO;
+               }
+
+               isFiltered = __core.OnPreviewTouchPressed(source, touchInfo);
+
+               return isFiltered;
+       }
+
+       virtual _UiTouchEventDelivery OnPreviewTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
+       {
+               _UiTouchEventDelivery isFiltered = _UI_TOUCH_EVENT_DELIVERY_NO;
+               IPropagatedTouchEventListener* pListener = __impl.GetPublicPropagatedTouchEventListener();
+
+               if (pListener != null)
+               {
+                       Control& control = __impl.GetPublic();
+
+                       TouchEventInfo publicTouchInfo;
+
+                       _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
+                       SysTryReturn(NID_UI, pEventArg, _UI_TOUCH_EVENT_DELIVERY_YES, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
+
+                       publicTouchInfo.Construct(*pEventArg);
+
+                       if (pEventArg)
+                       {
+                               delete pEventArg;
+                               pEventArg = null;
+                       }
+
+                       if (pListener->OnTouchReleased(control, publicTouchInfo) == true)
+                       {
+                               return _UI_TOUCH_EVENT_DELIVERY_NO;
+                       }
+               }
+
+               // public TouchEventListener
+               if (ProcessTouchEventListener(touchInfo) == true)
+               {
+                       return _UI_TOUCH_EVENT_DELIVERY_NO;
+               }
+
+               isFiltered = __impl.OnPreviewTouchReleased(__impl, touchInfo);
+               if (isFiltered == _UI_TOUCH_EVENT_DELIVERY_NO)
+               {
+                       return _UI_TOUCH_EVENT_DELIVERY_NO;
+               }
+
+               isFiltered = __core.OnPreviewTouchReleased(source, touchInfo);
+
+               return isFiltered;
+       }
+
+       virtual _UiTouchEventDelivery OnPreviewTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
+       {
+               _UiTouchEventDelivery isFiltered = _UI_TOUCH_EVENT_DELIVERY_NO;
+               IPropagatedTouchEventListener* pListener = __impl.GetPublicPropagatedTouchEventListener();
+
+               if (pListener != null)
+               {
+                       Control& control = __impl.GetPublic();
+
+                       TouchEventInfo publicTouchInfo;
+
+                       _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
+                       SysTryReturn(NID_UI, pEventArg, _UI_TOUCH_EVENT_DELIVERY_YES, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
+
+                       publicTouchInfo.Construct(*pEventArg);
+
+                       if (pEventArg)
+                       {
+                               delete pEventArg;
+                               pEventArg = null;
+                       }
+
+                       if (pListener->OnTouchMoved(control, publicTouchInfo) == true)
+                       {
+                               return _UI_TOUCH_EVENT_DELIVERY_NO;
+                       }
+               }
+
+               // public TouchEventListener
+               if (ProcessTouchEventListener(touchInfo) == true)
+               {
+                       return _UI_TOUCH_EVENT_DELIVERY_NO;
+               }
+
+               isFiltered = __impl.OnPreviewTouchMoved(__impl, touchInfo);
+               if (isFiltered == _UI_TOUCH_EVENT_DELIVERY_NO)
+               {
+                       return _UI_TOUCH_EVENT_DELIVERY_NO;
+               }
+
+               isFiltered = __core.OnPreviewTouchMoved(source, touchInfo);
+
+               return isFiltered;
+       }
+
+       virtual _UiTouchEventDelivery OnPreviewTouchCanceled(const _Control& source, const _TouchInfo& touchInfo)
+       {
+               IPropagatedTouchEventListener* pListener = __impl.GetPublicPropagatedTouchEventListener();
+
+               if (pListener != null)
+               {
+                       Control& control = __impl.GetPublic();
+
+                       TouchEventInfo publicTouchInfo;
+
+                       _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
+                       SysTryReturn(NID_UI, pEventArg, _UI_TOUCH_EVENT_DELIVERY_YES, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
+
+                       publicTouchInfo.Construct(*pEventArg);
+
+                       if (pEventArg)
+                       {
+                               delete pEventArg;
+                               pEventArg = null;
+                       }
+
+                       if (pListener->OnTouchCanceled(control, publicTouchInfo) == true)
+                       {
+                               return _UI_TOUCH_EVENT_DELIVERY_NO;
+                       }
+               }
+
+               // public TouchEventListener
+               if (ProcessTouchEventListener(touchInfo) == true)
+               {
+                       return _UI_TOUCH_EVENT_DELIVERY_NO;
+               }
+
+               return _UI_TOUCH_EVENT_DELIVERY_YES;
+       }
+
+       virtual void OnTouchPressHandled(const _Control& source)
+       {
+               __impl.OnTouchPressHandled(source);
+       }
+
+       virtual void OnTouchReleaseHandled(const _Control& source)
+       {
+               __impl.OnTouchReleaseHandled(source);
+       }
+
+       virtual void OnTouchMoveHandled(const _Control& source)
+       {
+               __impl.OnTouchMoveHandled(source);
+       }
+
+       virtual void OnTouchCancelHandled(const _Control& source)
+       {
+               __impl.OnTouchCancelHandled(source);
+       }
+
+       bool OnLongPressGestureDetected(_TouchLongPressGestureDetector& gesture)
+       {
+               bool filtered = ProcessTouchEventListener();
+
+               if (!filtered)
+               {
+                       __impl.FireListViewItemLongPressedEvent();
+               }
+
+               return filtered;
+       }
+
+       bool OnLongPressGestureCanceled(_TouchLongPressGestureDetector& gesture)
+       {
+               return false;
+       }
+
+private:
+
+       bool ProcessTouchEventListener(const _TouchInfo& touchInfo)
+       {
+               bool filtered = false;
+
+               if (touchInfo.GetTouchStatus() == _TOUCH_PRESSED)
+               {
+                       filtered = ProcessTouchDoublePressed(touchInfo);
+               }
+
+               if (!filtered)
+               {
+                       ProcessTouchEvent(touchInfo);
+               }
+
+               filtered = __impl.IsInputEventConsumed();
+
+               if (filtered)
+               {
+                       __impl.ResetInputEventConsumed();
+               }
+
+               return filtered;
+       }
+
+       bool ProcessTouchEventListener(void)
+       {
+               // for TouchLongPressed
+               _TouchInfo touchInfo(0, _TOUCH_LONG_PRESSED, __currentPressedPoint, false, 0);
+
+               return ProcessTouchEventListener(touchInfo);
+       }
+
+       void ProcessTouchEvent(const _TouchInfo& touchInfo)
+       {
+               TouchEventInfo publicTouchInfo;
+
+               _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
+               SysTryReturnVoidResult(NID_UI, pEventArg, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+               publicTouchInfo.Construct(*pEventArg);
+
+               _Control* pDraggedControl = __pTouchManager->GetTouchControlSource();
+
+               IEnumeratorT<IEventListener*>* pEnumerator = __impl.GetTouchEventListener()->GetEnumeratorN();
+               if (pEnumerator)
+               {
+                       while (pEnumerator->MoveNext() == E_SUCCESS)
+                       {
+                               IEventListener* pListener = null;
+                               pEnumerator->GetCurrent(pListener);
+
+                               ITouchEventListener* pTouchEventListener = dynamic_cast <ITouchEventListener*>(pListener);
+                               if (pTouchEventListener != null)
+                               {
+                                       FirePublicListener(*pTouchEventListener, publicTouchInfo);
+
+                                       if (touchInfo.GetTouchStatus() == _TOUCH_RELEASED)
+                                       {
+                                               if (pDraggedControl == null)    //if exist dragged control, don't send focus event
+                                               {
+                                                       FireFocusListener(*pTouchEventListener, publicTouchInfo);
+                                               }
+                                       }
+                                       else if (touchInfo.GetTouchStatus() == _TOUCH_MOVED)
+                                       {
+                                               FireFocusListener(*pTouchEventListener, publicTouchInfo);
+                                       }
+                               }
+                       }
+
+                       delete pEnumerator;
+               }
+
+               delete pEventArg;
+       }
+
+       bool ProcessTouchDoublePressed(const _TouchInfo& touchinfo)
+       {
+               if (__pTouchManager->GetPointCount() == 1)
+               {
+                       __oldPreviousPressedTime = __previousPressedTime;
+                       __previousPressedTime = __currentPressedTime;
+                       __currentPressedTime = touchinfo.GetTimeStamp();
+                       __previousPressedPoint.x = __currentPressedPoint.x;
+                       __previousPressedPoint.y = __currentPressedPoint.y;
+                       __currentPressedPoint.x = touchinfo.GetCurrentPosition().x;
+                       __currentPressedPoint.y = touchinfo.GetCurrentPosition().y;
+
+                       if (Math::Abs(__previousPressedTime - __currentPressedTime) < DOUBLE_PRESS_TIME)
+                       {
+                               if (Math::Abs(__previousPressedTime - __oldPreviousPressedTime) > DOUBLE_PRESS_TIME)
+                               {
+                                       if ((Math::Abs(__previousPressedPoint.x - __currentPressedPoint.x) < DOUBLE_PRESS_MOVE_ALLOWANCE)
+                                               && (Math::Abs(__previousPressedPoint.y - __currentPressedPoint.y) < DOUBLE_PRESS_MOVE_ALLOWANCE))
+                                       {
+                                               _TouchInfo touchInfo(0, _TOUCH_DOUBLE_PRESSED, __currentPressedPoint, false, 0);
+                                               ProcessTouchEvent(touchInfo);
+
+                                               return true;
+                                       }
+                               }
+                       }
+               }
+
+               return false;
+       }
+
+       void FirePublicListener(ITouchEventListener& listener, const TouchEventInfo& touchEventInfo)
+       {
+               switch (touchEventInfo.GetTouchStatus())
+               {
+               case TOUCH_PRESSED:
+                       listener.OnTouchPressed(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
+                       break;
+               case TOUCH_LONG_PRESSED:
+                       listener.OnTouchLongPressed(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
+                       break;
+               case TOUCH_RELEASED:
+                       listener.OnTouchReleased(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
+                       break;
+               case TOUCH_MOVED:
+                       listener.OnTouchMoved(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
+                       break;
+               case TOUCH_DOUBLE_PRESSED:
+                       listener.OnTouchDoublePressed(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
+                       break;
+               case TOUCH_FOCUS_IN:
+                       listener.OnTouchFocusIn(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
+                       break;
+               case TOUCH_FOCUS_OUT:
+                       listener.OnTouchFocusOut(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
+                       break;
+               case TOUCH_CANCELED:
+                       listener.OnTouchCanceled(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
+                       break;
+               default:
+                       break;
+               }
+       }
+
+       void FireFocusListener(ITouchEventListener& listener, const TouchEventInfo& touchEventInfo)
+       {
+               _ControlManager* pControlManager = _ControlManager::GetInstance();
+               SysTryReturnVoidResult(NID_UI, pControlManager, E_SYSTEM, "[E_SYSTEM] System error occurred.");
+
+               Point screenPoint(__pTouchManager->GetScreenPoint(touchEventInfo.GetPointId()).x,
+                                                 __pTouchManager->GetScreenPoint(touchEventInfo.GetPointId()).y);
+
+               _Control* pTouchedControl = pControlManager->GetTopmostTouchedControl(screenPoint);
+               SysTryReturnVoidResult(NID_UI, pTouchedControl, E_INVALID_CONDITION, "[E_INVALID_CONDITION] pTouchedControl is null.");
+
+               if (__pTouchManager->GetFocusedControlSource() != pTouchedControl)
+               {
+                       if (&(__core) != pTouchedControl)
+                       {
+                               if (__pTouchManager->GetFocusedControlSource() == &(__core))
+                               {
+                                       listener.OnTouchFocusOut(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
+                               }
+                       }
+                       else
+                       {
+                               listener.OnTouchFocusIn(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
+                       }
+
+                       __pTouchManager->SetFocusedControlSource(*pTouchedControl);
+               }
+       }
+
+       _TouchEventArg* GetTouchEventArgN(const _TouchInfo& touchInfo)
+       {
+               FloatPoint startPoint;
+
+               _TouchEventArg* pEventArg = new (std::nothrow) _TouchEventArg(__public, touchInfo.GetTouchStatus());
+               SysTryReturn(NID_UI, pEventArg, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+               startPoint.SetPosition(__pTouchManager->GetStartPoint(touchInfo.GetPointId()).x - __core.GetAbsoluteBoundsF().x,
+                                                          __pTouchManager->GetStartPoint(touchInfo.GetPointId()).y - __core.GetAbsoluteBoundsF().y);
+
+               pEventArg->SetTouchPosition(touchInfo.GetPointId(), startPoint.x, startPoint.y,
+                                                                       touchInfo.GetCurrentPosition().x, touchInfo.GetCurrentPosition().y);
+
+               // need to flick distance setting
+
+               return pEventArg;
+       }
+
+private:
+       static const int DOUBLE_PRESS_TIME = 500;
+       static const int DOUBLE_PRESS_MOVE_ALLOWANCE = 10;
+
+       _GroupedListViewImpl& __impl;
+       _Control& __core;
+       Control& __public;
+       _TouchManager* __pTouchManager;
+
+       unsigned int __oldPreviousPressedTime;
+       unsigned int __previousPressedTime;
+       unsigned int __currentPressedTime;
+       Tizen::Graphics::FloatPoint __previousPressedPoint;
+       Tizen::Graphics::FloatPoint __currentPressedPoint;
+       _TouchLongPressGestureDetector* __pLongPressedGesture;
+};
+
 _GroupedListViewImpl*
 _GroupedListViewImpl::GetInstance(GroupedListView& groupedListView)
 {
@@ -74,17 +554,9 @@ _GroupedListViewImpl::_GroupedListViewImpl(GroupedListView* pGroupedList, _Table
        , __redrawListView(true)
        , __isBoundsChanged(false)
        , __pItemNeedsLazyDeletion(null)
-       , __pTouchEventHandler(null)
-       , __pLongPressedGesture(null)
+       , __pPropagatedTouchEventListener(null)
 {
        GET_COLOR_CONFIG(TABLEVIEW::EMPTY_CONTENTS_TEXT_NORMAL, __emptyTextColor);
-
-       // Add _TouchLongPressGestureDetector
-       __pLongPressedGesture = new (std::nothrow) _TouchLongPressGestureDetector();
-       SysTryReturnVoidResult(NID_UI_CTRL, (__pLongPressedGesture != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
-
-       pCore->AddGestureDetector(*__pLongPressedGesture);
-       __pLongPressedGesture->AddGestureListener(*this);
 }
 
 _GroupedListViewImpl::~_GroupedListViewImpl()
@@ -117,17 +589,8 @@ _GroupedListViewImpl::~_GroupedListViewImpl()
                __pEmptyText = null;
        }
 
-       delete __pTouchEventHandler;
-       __pTouchEventHandler = null;
-
-       if (__pLongPressedGesture != null)
-       {
-               __pLongPressedGesture->RemoveGestureListener(*this);
-               GetCore().RemoveGestureDetector(*__pLongPressedGesture);
-
-               delete __pLongPressedGesture;
-               __pLongPressedGesture = null;
-       }
+       delete __pPropagatedTouchEventListener;
+       __pPropagatedTouchEventListener = null;
 }
 
 const char*
@@ -203,6 +666,13 @@ _GroupedListViewImpl::CreateGroupedListViewImplN(GroupedListView* pControl, Grou
        r = CheckConstruction(pCore, pImpl);
        SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), null, r, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
+       pImpl->__pPropagatedTouchEventListener = new (std::nothrow) _GroupedListViewPropagatedTouchEventListener(*pImpl);
+
+       if (pImpl->__pPropagatedTouchEventListener != null)
+       {
+               pCore->SetPropagatedTouchEventListener(pImpl->__pPropagatedTouchEventListener);
+       }
+
        return pImpl;
 }
 
@@ -650,7 +1120,8 @@ _GroupedListViewImpl::RefreshList(int groupIndex, int itemIndex, ListRefreshType
                        // find touched item.
                        GetItemIndexFromPosition(GetCurrentTouchPosition(), touchedGroupIndex, touchedItemIndex);
 
-                       if ((touchedGroupIndex == groupIndex) && (touchedItemIndex == itemIndex) && (pTouchManager->GetTouchStatus(0) != TOUCH_RELEASED))
+                       if (pListViewItem->IsItemSelected() && (touchedGroupIndex == groupIndex) && (touchedItemIndex == itemIndex)
+                                       && (pTouchManager->GetTouchStatus(0) != TOUCH_RELEASED))
                        {
                                needChangeEventTarget = true;
                        }
@@ -1267,6 +1738,30 @@ _GroupedListViewImpl::FireListViewItemEvent(int groupIndex, int itemIndex, _Tabl
 }
 
 void
+_GroupedListViewImpl::FireListViewItemLongPressedEvent(void)
+{
+       if (__pListItemEvent != null)
+       {
+               int groupIndex = -1;
+               int itemIndex = -1;
+               int elementId = -1;
+
+               if ((GetItemIndexFromPosition(GetCurrentTouchPosition(), groupIndex, itemIndex, elementId) == E_SUCCESS) && (itemIndex != -1))
+               {
+                       __pItemNeedsLazyDeletion = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
+
+                       if ((__pItemNeedsLazyDeletion != null) && (!__pItemNeedsLazyDeletion->IsContextItem()))
+                       {
+                               _ListItemEventArg* pArg = new (std::nothrow) _ListItemEventArg(groupIndex, itemIndex, elementId, 0, NOTIFY_TYPE_LONG_PRESSED_ITEM);
+                               __pListItemEvent->Fire(*pArg);
+
+                               __pItemNeedsLazyDeletion = null;
+                       }
+               }
+       }
+}
+
+void
 _GroupedListViewImpl::OnScrollEndReached(_Control& source, ScrollEndEvent type)
 {
        if (__pScrollEvent != null)
@@ -1446,78 +1941,21 @@ _GroupedListViewImpl::OnFontInfoRequested(unsigned long& style, float& size)
        style = FONT_STYLE_PLAIN;
 }
 
-bool
-_GroupedListViewImpl::OnTouchPressed(const _ControlImpl& source, const _TouchInfo& touchinfo)
-{
-       return (__pTouchEventHandler != null) ? __pTouchEventHandler->ProcessTouchEventListener(touchinfo) : false;
-}
-
-bool
-_GroupedListViewImpl::OnTouchReleased(const _ControlImpl& source, const _TouchInfo& touchinfo)
-{
-       return (__pTouchEventHandler != null) ? __pTouchEventHandler->ProcessTouchEventListener(touchinfo) : false;
-}
-
-bool
-_GroupedListViewImpl::OnTouchMoved(const _ControlImpl& source, const _TouchInfo& touchinfo)
-{
-       return (__pTouchEventHandler != null) ? __pTouchEventHandler->ProcessTouchEventListener(touchinfo) : false;
-}
-
-bool
-_GroupedListViewImpl::OnTouchCanceled(const _ControlImpl& source, const _TouchInfo& touchinfo)
-{
-       return (__pTouchEventHandler != null) ? __pTouchEventHandler->ProcessTouchEventListener(touchinfo) : false;
-}
-
-bool
-_GroupedListViewImpl::OnLongPressGestureDetected(_TouchLongPressGestureDetector& gesture)
+FloatPoint
+_GroupedListViewImpl::GetCurrentTouchPosition(void)
 {
-       bool filtered = false;
-
-       if (__pTouchEventHandler != null)
-       {
-               filtered = __pTouchEventHandler->ProcessTouchEventListener();
-       }
-
-       if (!filtered && (__pListItemEvent != null))
-       {
-               int groupIndex = -1;
-               int itemIndex = -1;
-               int elementId = -1;
-
-               if ((GetItemIndexFromPosition(GetCurrentTouchPosition(), groupIndex, itemIndex, elementId) == E_SUCCESS) && (itemIndex != -1))
-               {
-                       __pItemNeedsLazyDeletion = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
-
-                       if ((__pItemNeedsLazyDeletion != null) && (!__pItemNeedsLazyDeletion->IsContextItem()))
-                       {
-                               _ListItemEventArg* pArg = new (std::nothrow) _ListItemEventArg(groupIndex, itemIndex, elementId, 0, NOTIFY_TYPE_LONG_PRESSED_ITEM);
-                               __pListItemEvent->Fire(*pArg);
-
-                               __pItemNeedsLazyDeletion = null;
-                       }
-               }
-       }
+       FloatPoint currentTouchPos = _TouchManager::GetInstance()->GetScreenPoint(0);
+       FloatRectangle bounds = GetCore().GetAbsoluteBoundsF();
 
-       return filtered;
-}
+       currentTouchPos.x -= bounds.x;
+       currentTouchPos.y -= bounds.y;
 
-bool
-_GroupedListViewImpl::OnLongPressGestureCanceled(_TouchLongPressGestureDetector& gesture)
-{
-       return false;
+       return currentTouchPos;
 }
 
 result
 _GroupedListViewImpl::OnTouchEventListenerAdded(void)
 {
-       // support ITouchEventListener
-       if (GetTouchEventListener()->GetCount() == 1)
-       {
-               __pTouchEventHandler = new (std::nothrow) _ListViewTouchEventHandler(*this, LIST_VIEW_STYLE_GROUPED);
-       }
-
        return E_SUCCESS;
 }
 
@@ -1527,31 +1965,6 @@ _GroupedListViewImpl::OnTouchEventListenerRemoved(void)
        return E_SUCCESS;
 }
 
-bool
-_GroupedListViewImpl::GetInputEventConsumeState(void)
-{
-       bool filtered = IsInputEventConsumed();
-
-       if (filtered)
-       {
-               ResetInputEventConsumed();
-       }
-
-       return filtered;
-}
-
-FloatPoint
-_GroupedListViewImpl::GetCurrentTouchPosition(void)
-{
-       FloatPoint currentTouchPos = _TouchManager::GetInstance()->GetScreenPoint(0);
-       FloatRectangle bounds = GetCore().GetAbsoluteBoundsF();
-
-       currentTouchPos.x -= bounds.x;
-       currentTouchPos.y -= bounds.y;
-
-       return currentTouchPos;
-}
-
 class _GroupedListViewMaker
        : public _UiBuilderControlMaker
 {
index e322d61..f213097 100644 (file)
 #include <FGrp_TextTextSimple.h>
 #include "FUi_CoordinateSystemUtils.h"
 #include "FUi_Math.h"
+#include "FUi_ITouchLongPressGestureEventListener.h"
 #include "FUi_ResourceManager.h"
+#include "FUi_TouchEventArg.h"
+#include "FUi_TouchLongPressGestureDetector.h"
+#include "FUi_TouchManager.h"
 #include "FUi_UiBuilder.h"
 #include "FUiCtrl_FastScrollEvent.h"
 #include "FUiCtrl_FastScrollEventArg.h"
 #include "FUiCtrl_ScrollEventArg.h"
 
 using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
 using namespace Tizen::Base::Runtime;
+using namespace Tizen::Base::Utility;
 using namespace Tizen::Graphics;
 using namespace Tizen::Graphics::_Text;
 
 namespace Tizen { namespace Ui { namespace Controls
 {
 
+class _ListViewImpl::_ListViewPropagatedTouchEventListener
+       : public Tizen::Ui::_IPropagatedTouchEventListener
+       , public Tizen::Ui::_ITouchLongPressGestureEventListener
+{
+public:
+
+       _ListViewPropagatedTouchEventListener(_ListViewImpl& impl)
+               : __impl(impl)
+               , __core(impl.GetCore())
+               , __public(impl.GetPublic())
+               , __oldPreviousPressedTime(0)
+               , __previousPressedTime(0)
+               , __currentPressedTime(0)
+               , __previousPressedPoint(0.0f, 0.0f)
+               , __currentPressedPoint(0.0f, 0.0f)
+               , __pLongPressedGesture(null)
+       {
+               __pTouchManager = _TouchManager::GetInstance();
+               SysTryReturnVoidResult(NID_UI, (__pTouchManager != null), E_SYSTEM, "[E_SYSTEM] System error occurred.");
+
+               // Add _TouchLongPressGestureDetector
+               __pLongPressedGesture = new (std::nothrow) _TouchLongPressGestureDetector();
+               SysTryReturnVoidResult(NID_UI_CTRL, (__pLongPressedGesture != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+               __core.AddGestureDetector(*__pLongPressedGesture);
+               __pLongPressedGesture->AddGestureListener(*this);
+       }
+
+       virtual ~_ListViewPropagatedTouchEventListener(void)
+       {
+               if (__pLongPressedGesture != null)
+               {
+                       __pLongPressedGesture->RemoveGestureListener(*this);
+                       __core.RemoveGestureDetector(*__pLongPressedGesture);
+
+                       delete __pLongPressedGesture;
+                       __pLongPressedGesture = null;
+               }
+       }
+
+       virtual bool OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
+       {
+               return __impl.CallOnTouchPressed(source, touchInfo);
+       }
+
+       virtual bool OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
+       {
+               return __impl.CallOnTouchReleased(source, touchInfo);
+       }
+
+       virtual bool OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
+       {
+               return __impl.CallOnTouchMoved(source, touchInfo);
+       }
+
+       virtual bool OnTouchCanceled(const _Control& source, const _TouchInfo& touchInfo)
+       {
+               return __impl.CallOnTouchCanceled(source, touchInfo);
+       }
+
+       virtual _UiTouchEventDelivery OnPreviewTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
+       {
+               _UiTouchEventDelivery isFiltered = _UI_TOUCH_EVENT_DELIVERY_NO;
+               IPropagatedTouchEventListener* pListener = __impl.GetPublicPropagatedTouchEventListener();
+
+               if (pListener != null)
+               {
+                       Control& control = __impl.GetPublic();
+
+                       TouchEventInfo publicTouchInfo;
+
+                       _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
+                       SysTryReturn(NID_UI, pEventArg, _UI_TOUCH_EVENT_DELIVERY_YES, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
+
+                       publicTouchInfo.Construct(*pEventArg);
+
+                       if (pEventArg)
+                       {
+                               delete pEventArg;
+                               pEventArg = null;
+                       }
+
+                       if (pListener->OnTouchPressed(control, publicTouchInfo) == true)
+                       {
+                               return _UI_TOUCH_EVENT_DELIVERY_NO;
+                       }
+               }
+
+               // public TouchEventListener
+               if (ProcessTouchEventListener(touchInfo) == true)
+               {
+                       return _UI_TOUCH_EVENT_DELIVERY_NO;
+               }
+
+               isFiltered = __impl.OnPreviewTouchPressed(__impl, touchInfo);
+               if (isFiltered == _UI_TOUCH_EVENT_DELIVERY_NO)
+               {
+                       return _UI_TOUCH_EVENT_DELIVERY_NO;
+               }
+
+               isFiltered = __core.OnPreviewTouchPressed(source, touchInfo);
+
+               return isFiltered;
+       }
+
+       virtual _UiTouchEventDelivery OnPreviewTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
+       {
+               _UiTouchEventDelivery isFiltered = _UI_TOUCH_EVENT_DELIVERY_NO;
+               IPropagatedTouchEventListener* pListener = __impl.GetPublicPropagatedTouchEventListener();
+
+               if (pListener != null)
+               {
+                       Control& control = __impl.GetPublic();
+
+                       TouchEventInfo publicTouchInfo;
+
+                       _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
+                       SysTryReturn(NID_UI, pEventArg, _UI_TOUCH_EVENT_DELIVERY_YES, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
+
+                       publicTouchInfo.Construct(*pEventArg);
+
+                       if (pEventArg)
+                       {
+                               delete pEventArg;
+                               pEventArg = null;
+                       }
+
+                       if (pListener->OnTouchReleased(control, publicTouchInfo) == true)
+                       {
+                               return _UI_TOUCH_EVENT_DELIVERY_NO;
+                       }
+               }
+
+               // public TouchEventListener
+               if (ProcessTouchEventListener(touchInfo) == true)
+               {
+                       return _UI_TOUCH_EVENT_DELIVERY_NO;
+               }
+
+               isFiltered = __impl.OnPreviewTouchReleased(__impl, touchInfo);
+               if (isFiltered == _UI_TOUCH_EVENT_DELIVERY_NO)
+               {
+                       return _UI_TOUCH_EVENT_DELIVERY_NO;
+               }
+
+               isFiltered = __core.OnPreviewTouchReleased(source, touchInfo);
+
+               return isFiltered;
+       }
+
+       virtual _UiTouchEventDelivery OnPreviewTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
+       {
+               _UiTouchEventDelivery isFiltered = _UI_TOUCH_EVENT_DELIVERY_NO;
+               IPropagatedTouchEventListener* pListener = __impl.GetPublicPropagatedTouchEventListener();
+
+               if (pListener != null)
+               {
+                       Control& control = __impl.GetPublic();
+
+                       TouchEventInfo publicTouchInfo;
+
+                       _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
+                       SysTryReturn(NID_UI, pEventArg, _UI_TOUCH_EVENT_DELIVERY_YES, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
+
+                       publicTouchInfo.Construct(*pEventArg);
+
+                       if (pEventArg)
+                       {
+                               delete pEventArg;
+                               pEventArg = null;
+                       }
+
+                       if (pListener->OnTouchMoved(control, publicTouchInfo) == true)
+                       {
+                               return _UI_TOUCH_EVENT_DELIVERY_NO;
+                       }
+               }
+
+               // public TouchEventListener
+               if (ProcessTouchEventListener(touchInfo) == true)
+               {
+                       return _UI_TOUCH_EVENT_DELIVERY_NO;
+               }
+
+               isFiltered = __impl.OnPreviewTouchMoved(__impl, touchInfo);
+               if (isFiltered == _UI_TOUCH_EVENT_DELIVERY_NO)
+               {
+                       return _UI_TOUCH_EVENT_DELIVERY_NO;
+               }
+
+               isFiltered = __core.OnPreviewTouchMoved(source, touchInfo);
+
+               return isFiltered;
+       }
+
+       virtual _UiTouchEventDelivery OnPreviewTouchCanceled(const _Control& source, const _TouchInfo& touchInfo)
+       {
+               IPropagatedTouchEventListener* pListener = __impl.GetPublicPropagatedTouchEventListener();
+
+               if (pListener != null)
+               {
+                       Control& control = __impl.GetPublic();
+
+                       TouchEventInfo publicTouchInfo;
+
+                       _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
+                       SysTryReturn(NID_UI, pEventArg, _UI_TOUCH_EVENT_DELIVERY_YES, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
+
+                       publicTouchInfo.Construct(*pEventArg);
+
+                       if (pEventArg)
+                       {
+                               delete pEventArg;
+                               pEventArg = null;
+                       }
+
+                       if (pListener->OnTouchCanceled(control, publicTouchInfo) == true)
+                       {
+                               return _UI_TOUCH_EVENT_DELIVERY_NO;
+                       }
+               }
+
+               // public TouchEventListener
+               if (ProcessTouchEventListener(touchInfo) == true)
+               {
+                       return _UI_TOUCH_EVENT_DELIVERY_NO;
+               }
+
+               return _UI_TOUCH_EVENT_DELIVERY_YES;
+       }
+
+       virtual void OnTouchPressHandled(const _Control& source)
+       {
+               __impl.OnTouchPressHandled(source);
+       }
+
+       virtual void OnTouchReleaseHandled(const _Control& source)
+       {
+               __impl.OnTouchReleaseHandled(source);
+       }
+
+       virtual void OnTouchMoveHandled(const _Control& source)
+       {
+               __impl.OnTouchMoveHandled(source);
+       }
+
+       virtual void OnTouchCancelHandled(const _Control& source)
+       {
+               __impl.OnTouchCancelHandled(source);
+       }
+
+       bool OnLongPressGestureDetected(_TouchLongPressGestureDetector& gesture)
+       {
+               bool filtered = ProcessTouchEventListener();
+
+               if (!filtered)
+               {
+                       __impl.FireListViewItemLongPressedEvent();
+               }
+
+               return filtered;
+       }
+
+       bool OnLongPressGestureCanceled(_TouchLongPressGestureDetector& gesture)
+       {
+               return false;
+       }
+
+private:
+
+       bool ProcessTouchEventListener(const _TouchInfo& touchInfo)
+       {
+               bool filtered = false;
+
+               if (touchInfo.GetTouchStatus() == _TOUCH_PRESSED)
+               {
+                       filtered = ProcessTouchDoublePressed(touchInfo);
+               }
+
+               if (!filtered)
+               {
+                       ProcessTouchEvent(touchInfo);
+               }
+
+               filtered = __impl.IsInputEventConsumed();
+
+               if (filtered)
+               {
+                       __impl.ResetInputEventConsumed();
+               }
+
+               return filtered;
+       }
+
+       bool ProcessTouchEventListener(void)
+       {
+               // for TouchLongPressed
+               _TouchInfo touchInfo(0, _TOUCH_LONG_PRESSED, __currentPressedPoint, false, 0);
+
+               return ProcessTouchEventListener(touchInfo);
+       }
+
+       void ProcessTouchEvent(const _TouchInfo& touchInfo)
+       {
+               TouchEventInfo publicTouchInfo;
+
+               _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
+               SysTryReturnVoidResult(NID_UI, pEventArg, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+               publicTouchInfo.Construct(*pEventArg);
+
+               _Control* pDraggedControl = __pTouchManager->GetTouchControlSource();
+
+               IEnumeratorT<IEventListener*>* pEnumerator = __impl.GetTouchEventListener()->GetEnumeratorN();
+               if (pEnumerator)
+               {
+                       while (pEnumerator->MoveNext() == E_SUCCESS)
+                       {
+                               IEventListener* pListener = null;
+                               pEnumerator->GetCurrent(pListener);
+
+                               ITouchEventListener* pTouchEventListener = dynamic_cast <ITouchEventListener*>(pListener);
+                               if (pTouchEventListener != null)
+                               {
+                                       FirePublicListener(*pTouchEventListener, publicTouchInfo);
+
+                                       if (touchInfo.GetTouchStatus() == _TOUCH_RELEASED)
+                                       {
+                                               if (pDraggedControl == null)    //if exist dragged control, don't send focus event
+                                               {
+                                                       FireFocusListener(*pTouchEventListener, publicTouchInfo);
+                                               }
+                                       }
+                                       else if (touchInfo.GetTouchStatus() == _TOUCH_MOVED)
+                                       {
+                                               FireFocusListener(*pTouchEventListener, publicTouchInfo);
+                                       }
+                               }
+                       }
+
+                       delete pEnumerator;
+               }
+
+               delete pEventArg;
+       }
+
+       bool ProcessTouchDoublePressed(const _TouchInfo& touchinfo)
+       {
+               if (__pTouchManager->GetPointCount() == 1)
+               {
+                       __oldPreviousPressedTime = __previousPressedTime;
+                       __previousPressedTime = __currentPressedTime;
+                       __currentPressedTime = touchinfo.GetTimeStamp();
+                       __previousPressedPoint.x = __currentPressedPoint.x;
+                       __previousPressedPoint.y = __currentPressedPoint.y;
+                       __currentPressedPoint.x = touchinfo.GetCurrentPosition().x;
+                       __currentPressedPoint.y = touchinfo.GetCurrentPosition().y;
+
+                       if (Math::Abs(__previousPressedTime - __currentPressedTime) < DOUBLE_PRESS_TIME)
+                       {
+                               if (Math::Abs(__previousPressedTime - __oldPreviousPressedTime) > DOUBLE_PRESS_TIME)
+                               {
+                                       if ((Math::Abs(__previousPressedPoint.x - __currentPressedPoint.x) < DOUBLE_PRESS_MOVE_ALLOWANCE)
+                                               && (Math::Abs(__previousPressedPoint.y - __currentPressedPoint.y) < DOUBLE_PRESS_MOVE_ALLOWANCE))
+                                       {
+                                               _TouchInfo touchInfo(0, _TOUCH_DOUBLE_PRESSED, __currentPressedPoint, false, 0);
+                                               ProcessTouchEvent(touchInfo);
+
+                                               return true;
+                                       }
+                               }
+                       }
+               }
+
+               return false;
+       }
+
+       void FirePublicListener(ITouchEventListener& listener, const TouchEventInfo& touchEventInfo)
+       {
+               switch (touchEventInfo.GetTouchStatus())
+               {
+               case TOUCH_PRESSED:
+                       listener.OnTouchPressed(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
+                       break;
+               case TOUCH_LONG_PRESSED:
+                       listener.OnTouchLongPressed(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
+                       break;
+               case TOUCH_RELEASED:
+                       listener.OnTouchReleased(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
+                       break;
+               case TOUCH_MOVED:
+                       listener.OnTouchMoved(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
+                       break;
+               case TOUCH_DOUBLE_PRESSED:
+                       listener.OnTouchDoublePressed(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
+                       break;
+               case TOUCH_FOCUS_IN:
+                       listener.OnTouchFocusIn(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
+                       break;
+               case TOUCH_FOCUS_OUT:
+                       listener.OnTouchFocusOut(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
+                       break;
+               case TOUCH_CANCELED:
+                       listener.OnTouchCanceled(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
+                       break;
+               default:
+                       break;
+               }
+       }
+
+       void FireFocusListener(ITouchEventListener& listener, const TouchEventInfo& touchEventInfo)
+       {
+               _ControlManager* pControlManager = _ControlManager::GetInstance();
+               SysTryReturnVoidResult(NID_UI, pControlManager, E_SYSTEM, "[E_SYSTEM] System error occurred.");
+
+               Point screenPoint(__pTouchManager->GetScreenPoint(touchEventInfo.GetPointId()).x,
+                                                 __pTouchManager->GetScreenPoint(touchEventInfo.GetPointId()).y);
+
+               _Control* pTouchedControl = pControlManager->GetTopmostTouchedControl(screenPoint);
+               SysTryReturnVoidResult(NID_UI, pTouchedControl, E_INVALID_CONDITION, "[E_INVALID_CONDITION] pTouchedControl is null.");
+
+               if (__pTouchManager->GetFocusedControlSource() != pTouchedControl)
+               {
+                       if (&(__core) != pTouchedControl)
+                       {
+                               if (__pTouchManager->GetFocusedControlSource() == &(__core))
+                               {
+                                       listener.OnTouchFocusOut(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
+                               }
+                       }
+                       else
+                       {
+                               listener.OnTouchFocusIn(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
+                       }
+
+                       __pTouchManager->SetFocusedControlSource(*pTouchedControl);
+               }
+       }
+
+       _TouchEventArg* GetTouchEventArgN(const _TouchInfo& touchInfo)
+       {
+               FloatPoint startPoint;
+
+               _TouchEventArg* pEventArg = new (std::nothrow) _TouchEventArg(__public, touchInfo.GetTouchStatus());
+               SysTryReturn(NID_UI, pEventArg, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+               startPoint.SetPosition(__pTouchManager->GetStartPoint(touchInfo.GetPointId()).x - __core.GetAbsoluteBoundsF().x,
+                                                          __pTouchManager->GetStartPoint(touchInfo.GetPointId()).y - __core.GetAbsoluteBoundsF().y);
+
+               pEventArg->SetTouchPosition(touchInfo.GetPointId(), startPoint.x, startPoint.y,
+                                                                       touchInfo.GetCurrentPosition().x, touchInfo.GetCurrentPosition().y);
+
+               // need to flick distance setting
+
+               return pEventArg;
+       }
+
+private:
+       static const int DOUBLE_PRESS_TIME = 500;
+       static const int DOUBLE_PRESS_MOVE_ALLOWANCE = 10;
+
+       _ListViewImpl& __impl;
+       _Control& __core;
+       Control& __public;
+       _TouchManager* __pTouchManager;
+
+       unsigned int __oldPreviousPressedTime;
+       unsigned int __previousPressedTime;
+       unsigned int __currentPressedTime;
+       Tizen::Graphics::FloatPoint __previousPressedPoint;
+       Tizen::Graphics::FloatPoint __currentPressedPoint;
+       _TouchLongPressGestureDetector* __pLongPressedGesture;
+};
+
 _ListViewImpl*
 _ListViewImpl::GetInstance(ListView& listView)
 {
@@ -72,17 +552,9 @@ _ListViewImpl::_ListViewImpl(ListView* pList, _TableView* pCore)
        , __redrawListView(true)
        , __isBoundsChanged(false)
        , __pItemNeedsLazyDeletion(null)
-       , __pTouchEventHandler(null)
-       , __pLongPressedGesture(null)
+       , __pPropagatedTouchEventListener(null)
 {
        GET_COLOR_CONFIG(TABLEVIEW::EMPTY_CONTENTS_TEXT_NORMAL, __emptyTextColor);
-
-       // Add _TouchLongPressGestureDetector
-       __pLongPressedGesture = new (std::nothrow) _TouchLongPressGestureDetector();
-       SysTryReturnVoidResult(NID_UI_CTRL, (__pLongPressedGesture != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
-
-       pCore->AddGestureDetector(*__pLongPressedGesture);
-       __pLongPressedGesture->AddGestureListener(*this);
 }
 
 _ListViewImpl::~_ListViewImpl()
@@ -115,17 +587,8 @@ _ListViewImpl::~_ListViewImpl()
                __pEmptyText = null;
        }
 
-       delete __pTouchEventHandler;
-       __pTouchEventHandler = null;
-
-       if (__pLongPressedGesture != null)
-       {
-               __pLongPressedGesture->RemoveGestureListener(*this);
-               GetCore().RemoveGestureDetector(*__pLongPressedGesture);
-
-               delete __pLongPressedGesture;
-               __pLongPressedGesture = null;
-       }
+       delete __pPropagatedTouchEventListener;
+       __pPropagatedTouchEventListener = null;
 }
 
 const char*
@@ -200,6 +663,13 @@ _ListViewImpl::CreateListViewImplN(ListView* pControl, bool itemDivider, ListScr
        r = CheckConstruction(pCore, pImpl);
        SysTryReturn(NID_UI_CTRL, (r == E_SUCCESS), null, r, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
+       pImpl->__pPropagatedTouchEventListener = new (std::nothrow) _ListViewPropagatedTouchEventListener(*pImpl);
+
+       if (pImpl->__pPropagatedTouchEventListener != null)
+       {
+               pCore->SetPropagatedTouchEventListener(pImpl->__pPropagatedTouchEventListener);
+       }
+
        return pImpl;
 }
 
@@ -618,7 +1088,8 @@ _ListViewImpl::RefreshList(int index, ListRefreshType type, bool needFlush)
                        _TouchManager* pTouchManager = _TouchManager::GetInstance();
                        bool needChangeEventTarget = false;
 
-                       if ((GetItemIndexFromPosition(GetCurrentTouchPosition()) == index) && (pTouchManager->GetTouchStatus(0) != TOUCH_RELEASED))
+                       if (pListViewItem->IsItemSelected() && (GetItemIndexFromPosition(GetCurrentTouchPosition()) == index)
+                                       && (pTouchManager->GetTouchStatus(0) != TOUCH_RELEASED))
                        {
                                needChangeEventTarget = true;
                        }
@@ -1326,41 +1797,34 @@ _ListViewImpl::OnFontInfoRequested(unsigned long& style, float& size)
        style = FONT_STYLE_PLAIN;
 }
 
-bool
-_ListViewImpl::OnTouchPressed(const _ControlImpl& source, const _TouchInfo& touchinfo)
+FloatPoint
+_ListViewImpl::GetCurrentTouchPosition(void)
 {
-       return (__pTouchEventHandler != null) ? __pTouchEventHandler->ProcessTouchEventListener(touchinfo) : false;
-}
+       FloatPoint currentTouchPos = _TouchManager::GetInstance()->GetScreenPoint(0);
+       FloatRectangle bounds = GetCore().GetAbsoluteBoundsF();
 
-bool
-_ListViewImpl::OnTouchReleased(const _ControlImpl& source, const _TouchInfo& touchinfo)
-{
-       return (__pTouchEventHandler != null) ? __pTouchEventHandler->ProcessTouchEventListener(touchinfo) : false;
+       currentTouchPos.x -= bounds.x;
+       currentTouchPos.y -= bounds.y;
+
+       return currentTouchPos;
 }
 
-bool
-_ListViewImpl::OnTouchMoved(const _ControlImpl& source, const _TouchInfo& touchinfo)
+result
+_ListViewImpl::OnTouchEventListenerAdded(void)
 {
-       return (__pTouchEventHandler != null) ? __pTouchEventHandler->ProcessTouchEventListener(touchinfo) : false;
+       return E_SUCCESS;
 }
 
-bool
-_ListViewImpl::OnTouchCanceled(const _ControlImpl& source, const _TouchInfo& touchinfo)
+result
+_ListViewImpl::OnTouchEventListenerRemoved(void)
 {
-       return (__pTouchEventHandler != null) ? __pTouchEventHandler->ProcessTouchEventListener(touchinfo) : false;
+       return E_SUCCESS;
 }
 
-bool
-_ListViewImpl::OnLongPressGestureDetected(_TouchLongPressGestureDetector& gesture)
+void
+_ListViewImpl::FireListViewItemLongPressedEvent(void)
 {
-       bool filtered = false;
-
-       if (__pTouchEventHandler != null)
-       {
-               filtered = __pTouchEventHandler->ProcessTouchEventListener();
-       }
-
-       if (!filtered && (__pListItemEvent != null))
+       if (__pListItemEvent != null)
        {
                int itemIndex = -1;
                int elementId = -1;
@@ -1378,57 +1842,6 @@ _ListViewImpl::OnLongPressGestureDetected(_TouchLongPressGestureDetector& gestur
                        }
                }
        }
-
-       return filtered;
-}
-
-bool
-_ListViewImpl::OnLongPressGestureCanceled(_TouchLongPressGestureDetector& gesture)
-{
-       return false;
-}
-
-result
-_ListViewImpl::OnTouchEventListenerAdded(void)
-{
-       // support ITouchEventListener
-       if (GetTouchEventListener()->GetCount() == 1)
-       {
-               __pTouchEventHandler = new (std::nothrow) _ListViewTouchEventHandler(*this, LIST_VIEW_STYLE_SIMPLE);
-       }
-
-       return E_SUCCESS;
-}
-
-result
-_ListViewImpl::OnTouchEventListenerRemoved(void)
-{
-       return E_SUCCESS;
-}
-
-bool
-_ListViewImpl::GetInputEventConsumeState(void)
-{
-       bool filtered = IsInputEventConsumed();
-
-       if (filtered)
-       {
-               ResetInputEventConsumed();
-       }
-
-       return filtered;
-}
-
-FloatPoint
-_ListViewImpl::GetCurrentTouchPosition(void)
-{
-       FloatPoint currentTouchPos = _TouchManager::GetInstance()->GetScreenPoint(0);
-       FloatRectangle bounds = GetCore().GetAbsoluteBoundsF();
-
-       currentTouchPos.x -= bounds.x;
-       currentTouchPos.y -= bounds.y;
-
-       return currentTouchPos;
 }
 
 class _ListViewMaker
index 6e5a63a..06a1922 100755 (executable)
@@ -547,6 +547,7 @@ _ListViewItem::SetCurrentStatus(_ListViewItemStatus& currentStatus)
        __prevTouchPos = currentStatus.currentTouchPosition;
        __selectionEabled = currentStatus.elementSelectionEnabled;
        __selectedElementId = currentStatus.selectedElementId;
+       __touchPressed = true;
 
        if (__selectionEabled)
        {
@@ -598,6 +599,12 @@ _ListViewItem::GetCurrentStatus(_ListViewItemStatus& currentStatus)
        currentStatus.selectedElementId = __selectedElementId;
 }
 
+bool
+_ListViewItem::IsItemSelected(void)
+{
+       return __touchPressed;
+}
+
 int
 _ListViewItem::GetElementIdFromPosition(const FloatPoint& position) const
 {
diff --git a/src/ui/controls/FUiCtrl_ListViewTouchEventHandler.cpp b/src/ui/controls/FUiCtrl_ListViewTouchEventHandler.cpp
deleted file mode 100644 (file)
index e136da9..0000000
+++ /dev/null
@@ -1,257 +0,0 @@
-//
-// Open Service Platform
-// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-/**
- * @file       FUiCtrl_ListViewTouchEventHandler.cpp
- * @brief   This is the implementation file for _ListViewTouchEventHandler class.
- *
- * This file contains the implementation of _ListViewTouchEventHandler class.
- */
-
-#include <FBaseSysLog.h>
-#include "FUiCtrl_GroupedListViewImpl.h"
-#include "FUiCtrl_ListViewImpl.h"
-#include "FUiCtrl_ListViewTouchEventHandler.h"
-
-#ifdef MEMORY_LEAK_CHECK
-#include "mem_leak_check.h"
-#endif
-
-using namespace Tizen::Base::Collection;
-using namespace Tizen::Base::Runtime;
-using namespace Tizen::Base::Utility;
-using namespace Tizen::Graphics;
-
-namespace Tizen { namespace Ui { namespace Controls
-{
-_ListViewTouchEventHandler::_ListViewTouchEventHandler(_ControlImpl& impl, ListViewStyle style)
-       : __impl(impl)
-       , __core(impl.GetCore())
-       , __public(impl.GetPublic())
-       , __style(style)
-       , __oldPreviousPressedTime(0)
-       , __previousPressedTime(0)
-       , __currentPressedTime(0)
-       , __previousPressedPoint(0.0f, 0.0f)
-       , __currentPressedPoint(0.0f, 0.0f)
-{
-       __pTouchManager = _TouchManager::GetInstance();
-       SysTryReturnVoidResult(NID_UI, (__pTouchManager != null), E_SYSTEM, "[E_SYSTEM] System error occurred.");
-}
-
-_ListViewTouchEventHandler::~_ListViewTouchEventHandler(void)
-{
-}
-
-bool
-_ListViewTouchEventHandler::ProcessTouchEventListener(const _TouchInfo& touchInfo)
-{
-       bool filtered = false;
-
-       if (touchInfo.GetTouchStatus() == _TOUCH_PRESSED)
-       {
-               filtered = ProcessTouchDoublePressed(touchInfo);
-       }
-
-       if (!filtered)
-       {
-               ProcessTouchEvent(touchInfo);
-       }
-
-       if (__style == LIST_VIEW_STYLE_SIMPLE)
-       {
-               filtered = static_cast<_ListViewImpl*>(&__impl)->GetInputEventConsumeState();
-       }
-       else if (__style == LIST_VIEW_STYLE_GROUPED)
-       {
-               filtered = static_cast<_GroupedListViewImpl*>(&__impl)->GetInputEventConsumeState();
-       }
-
-       return filtered;
-}
-
-
-bool
-_ListViewTouchEventHandler::ProcessTouchEventListener(void)
-{
-       // for TouchLongPressed
-       _TouchInfo touchInfo(0, _TOUCH_LONG_PRESSED, __currentPressedPoint, false, 0);
-
-       return ProcessTouchEventListener(touchInfo);
-}
-
-void
-_ListViewTouchEventHandler::ProcessTouchEvent(const _TouchInfo& touchInfo)
-{
-       TouchEventInfo publicTouchInfo;
-
-       _TouchEventArg* pEventArg = GetTouchEventArgN(touchInfo);
-       SysTryReturnVoidResult(NID_UI, pEventArg, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
-
-       publicTouchInfo.Construct(*pEventArg);
-
-       _Control* pDraggedControl = __pTouchManager->GetTouchControlSource();
-
-       IEnumeratorT<IEventListener*>* pEnumerator = __impl.GetTouchEventListener()->GetEnumeratorN();
-       if (pEnumerator)
-       {
-               while (pEnumerator->MoveNext() == E_SUCCESS)
-               {
-                       IEventListener* pListener = null;
-                       pEnumerator->GetCurrent(pListener);
-
-                       ITouchEventListener* pTouchEventListener = dynamic_cast <ITouchEventListener*>(pListener);
-                       if (pTouchEventListener != null)
-                       {
-                               FirePublicListener(*pTouchEventListener, publicTouchInfo);
-
-                               if (touchInfo.GetTouchStatus() == _TOUCH_RELEASED)
-                               {
-                                       if (pDraggedControl == null)    //if exist dragged control, don't send focus event
-                                       {
-                                               FireFocusListener(*pTouchEventListener, publicTouchInfo);
-                                       }
-                               }
-                               else if (touchInfo.GetTouchStatus() == _TOUCH_MOVED)
-                               {
-                                       FireFocusListener(*pTouchEventListener, publicTouchInfo);
-                               }
-                       }
-               }
-
-               delete pEnumerator;
-       }
-
-       delete pEventArg;
-}
-
-bool
-_ListViewTouchEventHandler::ProcessTouchDoublePressed(const _TouchInfo& touchinfo)
-{
-       if (__pTouchManager->GetPointCount() == 1)
-       {
-               __oldPreviousPressedTime = __previousPressedTime;
-               __previousPressedTime = __currentPressedTime;
-               __currentPressedTime = touchinfo.GetTimeStamp();
-               __previousPressedPoint.x = __currentPressedPoint.x;
-               __previousPressedPoint.y = __currentPressedPoint.y;
-               __currentPressedPoint.x = touchinfo.GetCurrentPosition().x;
-               __currentPressedPoint.y = touchinfo.GetCurrentPosition().y;
-
-               if (Math::Abs(__previousPressedTime - __currentPressedTime) < DOUBLE_PRESS_TIME)
-               {
-                       if (Math::Abs(__previousPressedTime - __oldPreviousPressedTime) > DOUBLE_PRESS_TIME)
-                       {
-                               if ((Math::Abs(__previousPressedPoint.x - __currentPressedPoint.x) < DOUBLE_PRESS_MOVE_ALLOWANCE)
-                                       && (Math::Abs(__previousPressedPoint.y - __currentPressedPoint.y) < DOUBLE_PRESS_MOVE_ALLOWANCE))
-                               {
-                                       _TouchInfo touchInfo(0, _TOUCH_DOUBLE_PRESSED, __currentPressedPoint, false, 0);
-                                       ProcessTouchEvent(touchInfo);
-
-                                       return true;
-                               }
-                       }
-               }
-       }
-
-       return false;
-}
-
-void
-_ListViewTouchEventHandler::FirePublicListener(ITouchEventListener& listener, const TouchEventInfo& touchEventInfo)
-{
-       switch (touchEventInfo.GetTouchStatus())
-       {
-       case TOUCH_PRESSED:
-               listener.OnTouchPressed(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
-               break;
-       case TOUCH_LONG_PRESSED:
-               listener.OnTouchLongPressed(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
-               break;
-       case TOUCH_RELEASED:
-               listener.OnTouchReleased(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
-               break;
-       case TOUCH_MOVED:
-               listener.OnTouchMoved(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
-               break;
-       case TOUCH_DOUBLE_PRESSED:
-               listener.OnTouchDoublePressed(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
-               break;
-       case TOUCH_FOCUS_IN:
-               listener.OnTouchFocusIn(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
-               break;
-       case TOUCH_FOCUS_OUT:
-               listener.OnTouchFocusOut(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
-               break;
-       case TOUCH_CANCELED:
-               listener.OnTouchCanceled(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
-               break;
-       default:
-               break;
-       }
-}
-
-void
-_ListViewTouchEventHandler::FireFocusListener(ITouchEventListener& listener, const TouchEventInfo& touchEventInfo)
-{
-       _ControlManager* pControlManager = _ControlManager::GetInstance();
-       SysTryReturnVoidResult(NID_UI, pControlManager, E_SYSTEM, "[E_SYSTEM] System error occurred.");
-
-       Point screenPoint(__pTouchManager->GetScreenPoint(touchEventInfo.GetPointId()).x,
-                                         __pTouchManager->GetScreenPoint(touchEventInfo.GetPointId()).y);
-
-       _Control* pTouchedControl = pControlManager->GetTopmostTouchedControl(screenPoint);
-       SysTryReturnVoidResult(NID_UI, pTouchedControl, E_INVALID_CONDITION, "[E_INVALID_CONDITION] pTouchedControl is null.");
-
-       if (__pTouchManager->GetFocusedControlSource() != pTouchedControl)
-       {
-               if (&(__core) != pTouchedControl)
-               {
-                       if (__pTouchManager->GetFocusedControlSource() == &(__core))
-                       {
-                               listener.OnTouchFocusOut(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
-                       }
-               }
-               else
-               {
-                       listener.OnTouchFocusIn(__public, touchEventInfo.GetCurrentPosition(), touchEventInfo);
-               }
-
-               __pTouchManager->SetFocusedControlSource(*pTouchedControl);
-       }
-}
-
-_TouchEventArg*
-_ListViewTouchEventHandler::GetTouchEventArgN(const _TouchInfo& touchInfo)
-{
-       Point startPoint;
-
-       _TouchEventArg* pEventArg = new (std::nothrow) _TouchEventArg(__public, touchInfo.GetTouchStatus());
-       SysTryReturn(NID_UI, pEventArg, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
-
-       startPoint.SetPosition(__pTouchManager->GetStartPoint(touchInfo.GetPointId()).x - __core.GetAbsoluteBounds().x,
-                                                  __pTouchManager->GetStartPoint(touchInfo.GetPointId()).y - __core.GetAbsoluteBounds().y);
-
-       pEventArg->SetTouchPosition(touchInfo.GetPointId(), startPoint.x, startPoint.y,
-                                                               touchInfo.GetCurrentPosition().x, touchInfo.GetCurrentPosition().y);
-
-       // need to flick distance setting
-
-       return pEventArg;
-}
-
-}}} // Tizen::Ui::Controls
index dd360f9..fd916f1 100644 (file)
 
 #include <FUiCtrlGroupedListView.h>
 #include "FUi_ControlImpl.h"
-#include "FUi_ITouchLongPressGestureEventListener.h"
-#include "FUi_TouchLongPressGestureDetector.h"
 #include "FUiCtrl_IFastScrollListener.h"
 #include "FUiCtrl_IScrollEventListener.h"
 #include "FUiCtrl_IUiListViewItemEventListener.h"
-#include "FUiCtrl_ListViewTouchEventHandler.h"
 #include "FUiCtrl_TableView.h"
 
 namespace Tizen { namespace Ui { namespace Controls
@@ -50,7 +47,6 @@ class _ScrollEvent;
 class _GroupedListViewImpl
        : public _ControlImpl
        , public _ITableViewItemEventListener
-       , public _ITouchLongPressGestureEventListener
        , public _IScrollEventListener
        , public _IUiFastScrollListener
        , public _IUiListViewItemEventListener
@@ -237,20 +233,6 @@ public:
 
        virtual void OnFontInfoRequested(unsigned long& style, float& size);
 
-       virtual bool OnTouchPressed(const _ControlImpl& source, const _TouchInfo& touchinfo);
-
-       virtual bool OnTouchReleased(const _ControlImpl& source, const _TouchInfo& touchinfo);
-
-       virtual bool OnTouchMoved(const _ControlImpl& source, const _TouchInfo& touchinfo);
-
-       virtual bool OnTouchCanceled(const _ControlImpl& source, const _TouchInfo& touchinfo);
-
-       virtual bool OnLongPressGestureDetected(_TouchLongPressGestureDetector& gesture);
-
-       virtual bool OnLongPressGestureCanceled(_TouchLongPressGestureDetector& gesture);
-
-       bool GetInputEventConsumeState(void);
-
 public:
        static _GroupedListViewImpl* GetInstance(GroupedListView& groupedListView);
 
@@ -274,12 +256,14 @@ private:
        void FireListViewItemEvent(int groupIndex, int itemIndex, Tizen::Ui::Controls::_TableViewItem* pItem,
                        Tizen::Ui::Controls::TableViewItemStatus status);
 
+       void FireListViewItemLongPressedEvent(void);
+
+       void SetItemNeedsLazyDeletion(void);
+
        virtual result OnTouchEventListenerAdded(void);
 
        virtual result OnTouchEventListenerRemoved(void);
 
-       void SetItemNeedsLazyDeletion(void);
-
 private:
        _ListItemEvent* __pListItemEvent;
        _PublicLinkEvent* __pLinkEvent;
@@ -294,8 +278,10 @@ private:
        bool __isBoundsChanged;
        _ListViewItem* __pItemNeedsLazyDeletion;
 
-       _ListViewTouchEventHandler* __pTouchEventHandler;
-       _TouchLongPressGestureDetector* __pLongPressedGesture;
+       class _GroupedListViewPropagatedTouchEventListener;
+       _GroupedListViewPropagatedTouchEventListener* __pPropagatedTouchEventListener;
+
+       friend class _GroupedListViewPropagatedTouchEventListener;
 }; // _GroupedListViewImpl
 
 }}} // Tizen::Ui::Controls
index 6c048b7..9ce8304 100644 (file)
 
 #include <FUiCtrlListView.h>
 #include "FUi_ControlImpl.h"
-#include "FUi_ITouchLongPressGestureEventListener.h"
-#include "FUi_TouchLongPressGestureDetector.h"
 #include "FUiCtrl_IFastScrollListener.h"
 #include "FUiCtrl_IScrollEventListener.h"
 #include "FUiCtrl_IUiListViewItemEventListener.h"
-#include "FUiCtrl_ListViewTouchEventHandler.h"
 #include "FUiCtrl_TableView.h"
 
 namespace Tizen { namespace Ui { namespace Controls
@@ -50,7 +47,6 @@ class _ListViewImpl
        : public _ControlImpl
        , public _IScrollEventListener
        , public _ITableViewItemEventListener
-       , public _ITouchLongPressGestureEventListener
        , public _IUiFastScrollListener
        , public _IUiListViewItemEventListener
        , virtual public Tizen::Base::Runtime::IEventListener
@@ -219,20 +215,6 @@ public:
 
        virtual void OnFontInfoRequested(unsigned long& style, float& size);
 
-       virtual bool OnTouchPressed(const _ControlImpl& source, const _TouchInfo& touchinfo);
-
-       virtual bool OnTouchReleased(const _ControlImpl& source, const _TouchInfo& touchinfo);
-
-       virtual bool OnTouchMoved(const _ControlImpl& source, const _TouchInfo& touchinfo);
-
-       virtual bool OnTouchCanceled(const _ControlImpl& source, const _TouchInfo& touchinfo);
-
-       virtual bool OnLongPressGestureDetected(_TouchLongPressGestureDetector& gesture);
-
-       virtual bool OnLongPressGestureCanceled(_TouchLongPressGestureDetector& gesture);
-
-       bool GetInputEventConsumeState(void);
-
 public:
        static _ListViewImpl* GetInstance(ListView& listView);
 
@@ -253,11 +235,13 @@ private:
 
        Tizen::Graphics::FloatPoint GetCurrentTouchPosition(void);
 
+       void SetItemNeedsLazyDeletion(void);
+
        virtual result OnTouchEventListenerAdded(void);
 
        virtual result OnTouchEventListenerRemoved(void);
 
-       void SetItemNeedsLazyDeletion(void);
+       void FireListViewItemLongPressedEvent(void);
 
 private:
        _ListItemEvent* __pListItemEvent;
@@ -273,8 +257,10 @@ private:
        bool __isBoundsChanged;
        _ListViewItem* __pItemNeedsLazyDeletion;
 
-       _ListViewTouchEventHandler* __pTouchEventHandler;
-       _TouchLongPressGestureDetector* __pLongPressedGesture;
+       class _ListViewPropagatedTouchEventListener;
+       _ListViewPropagatedTouchEventListener* __pPropagatedTouchEventListener;
+
+       friend class _ListViewPropagatedTouchEventListener;
 }; // _ListViewImpl
 
 }}} // Tizen::Ui::Controls
index 8b8da84..64bf485 100644 (file)
@@ -170,6 +170,8 @@ public:
 
        void GetCurrentStatus(_ListViewItemStatus& currentStatus);
 
+       bool IsItemSelected(void);
+
        int GetElementIdFromPosition(const Tizen::Graphics::FloatPoint& position) const;
 
        int GetElementIdFromCurrentTouchPosition(void) const;
diff --git a/src/ui/inc/FUiCtrl_ListViewTouchEventHandler.h b/src/ui/inc/FUiCtrl_ListViewTouchEventHandler.h
deleted file mode 100644 (file)
index ec8688a..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-//
-// Open Service Platform
-// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-/**
- * @file       FUiCtrl_ListViewTouchEventHandler.h
- * @brief      This is the header file for the _ListViewTouchEventHandler class.
- *
- * This header file contains the declarations of the _ListViewTouchEventHandler class.
- */
-
-#ifndef _FUI_CTRL_INTERNAL_LIST_VIEW_TOUCH_EVENT_HANDLER_H_
-#define _FUI_CTRL_INTERNAL_LIST_VIEW_TOUCH_EVENT_HANDLER_H_
-
-#include "FUi_Control.h"
-#include "FUi_ControlImpl.h"
-#include "FUi_ControlManager.h"
-#include "FUi_TouchManager.h"
-#include "FUi_TouchEventArg.h"
-
-namespace Tizen { namespace Ui { namespace Controls
-{
-enum ListViewStyle
-{
-       LIST_VIEW_STYLE_SIMPLE,
-       LIST_VIEW_STYLE_GROUPED
-};
-
-class _ListViewTouchEventHandler
-       : virtual public Tizen::Base::Runtime::IEventListener
-{
-public:
-       _ListViewTouchEventHandler(_ControlImpl& impl, ListViewStyle style);
-
-       ~_ListViewTouchEventHandler(void);
-
-       bool ProcessTouchEventListener(const _TouchInfo& touchinfo);
-
-       bool ProcessTouchEventListener(void);
-
-private:
-       _ListViewTouchEventHandler(const _ListViewTouchEventHandler& rhs);
-
-       _ListViewTouchEventHandler& operator =(const _ListViewTouchEventHandler& rhs);
-
-       void ProcessTouchEvent(const _TouchInfo& touchinfo);
-
-       bool ProcessTouchDoublePressed(const _TouchInfo& touchinfo);
-
-       void FirePublicListener(ITouchEventListener& listener, const TouchEventInfo& touchEventInfo);
-
-       void FireFocusListener(ITouchEventListener& listener, const TouchEventInfo& touchEventInfo);
-
-       _TouchEventArg* GetTouchEventArgN(const _TouchInfo& touchInfo);
-
-private:
-       static const int DOUBLE_PRESS_TIME = 500;
-       static const int DOUBLE_PRESS_MOVE_ALLOWANCE = 10;
-
-       _ControlImpl& __impl;
-       _Control& __core;
-       Control& __public;
-       _TouchManager* __pTouchManager;
-
-       ListViewStyle __style;
-
-       unsigned int __oldPreviousPressedTime;
-       unsigned int __previousPressedTime;
-       unsigned int __currentPressedTime;
-       Tizen::Graphics::FloatPoint __previousPressedPoint;
-       Tizen::Graphics::FloatPoint __currentPressedPoint;
-}; // _ListViewTouchEventHandler
-
-}}} // Tizen::Ui::Controls
-
-#endif // _FUI_CTRL_INTERNAL_LIST_VIEW_TOUCH_EVENT_HANDLER_H_