X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Fevents%2Fgesture-event-processor.cpp;h=04863ffa3b23f77688a02fbe79c80ad62ceffc20;hb=a4eb68faf1e75d213c951a7d4d1b67727247917a;hp=b307e6e20acabecb50c6ce8cc0e1d4fc62d85564;hpb=2ada356619fc41af1f590e9d471352d8ce475a83;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/events/gesture-event-processor.cpp b/dali/internal/event/events/gesture-event-processor.cpp index b307e6e..04863ff 100644 --- a/dali/internal/event/events/gesture-event-processor.cpp +++ b/dali/internal/event/events/gesture-event-processor.cpp @@ -25,7 +25,7 @@ // INTERNAL INCLUDES #include #include -#include +#include #include #include #include @@ -41,11 +41,8 @@ GestureEventProcessor::GestureEventProcessor( SceneGraph::UpdateManager& updateM mPanGestureProcessor( updateManager ), mPinchGestureProcessor(), mTapGestureProcessor(), + mRotationGestureProcessor(), mRenderController( renderController ), - mLongPressDetectorCount(0), - mPanDetectorCount(0), - mPinchDetectorCount(0), - mTapDetectorCount(0), envOptionMinimumPanDistance(-1), envOptionMinimumPanEvents(-1) { @@ -57,57 +54,49 @@ GestureEventProcessor::~GestureEventProcessor() void GestureEventProcessor::ProcessTouchEvent( Scene& scene, const Integration::TouchEvent& event) { - if( mLongPressDetectorCount > 0 ) - { - mLongPressGestureProcessor.ProcessTouch(scene, event); - } - if( mPanDetectorCount > 0 ) - { - mPanGestureProcessor.ProcessTouch(scene, event); - } - if( mPinchDetectorCount > 0 ) - { - mPinchGestureProcessor.ProcessTouch(scene, event); - } - if( mTapDetectorCount > 0 ) - { - mTapGestureProcessor.ProcessTouch(scene, event); - } + mLongPressGestureProcessor.ProcessTouch(scene, event); + mPanGestureProcessor.ProcessTouch(scene, event); + mPinchGestureProcessor.ProcessTouch(scene, event); + mTapGestureProcessor.ProcessTouch(scene, event); + mRotationGestureProcessor.ProcessTouch(scene, event); } void GestureEventProcessor::AddGestureDetector(GestureDetector* gestureDetector, Scene& scene) { switch (gestureDetector->GetType()) { - case Gesture::LongPress: + case DevelGesture::LongPress: { LongPressGestureDetector* longPress = static_cast(gestureDetector); mLongPressGestureProcessor.AddGestureDetector(longPress, scene); - mLongPressDetectorCount++; break; } - case Gesture::Pan: + case DevelGesture::Pan: { PanGestureDetector* pan = static_cast(gestureDetector); mPanGestureProcessor.AddGestureDetector(pan, scene, envOptionMinimumPanDistance, envOptionMinimumPanEvents); - mPanDetectorCount++; break; } - case Gesture::Pinch: + case DevelGesture::Pinch: { PinchGestureDetector* pinch = static_cast(gestureDetector); mPinchGestureProcessor.AddGestureDetector(pinch, scene); - mPinchDetectorCount++; break; } - case Gesture::Tap: + case DevelGesture::Tap: { TapGestureDetector* tap = static_cast(gestureDetector); mTapGestureProcessor.AddGestureDetector(tap, scene); - mTapDetectorCount++; + break; + } + + case DevelGesture::Rotation: + { + RotationGestureDetector* rotation = static_cast(gestureDetector); + mRotationGestureProcessor.AddGestureDetector(rotation, scene); break; } } @@ -117,35 +106,38 @@ void GestureEventProcessor::RemoveGestureDetector(GestureDetector* gestureDetect { switch (gestureDetector->GetType()) { - case Gesture::LongPress: + case DevelGesture::LongPress: { LongPressGestureDetector* longPress = static_cast(gestureDetector); mLongPressGestureProcessor.RemoveGestureDetector(longPress); - mLongPressDetectorCount--; break; } - case Gesture::Pan: + case DevelGesture::Pan: { PanGestureDetector* pan = static_cast(gestureDetector); mPanGestureProcessor.RemoveGestureDetector(pan); - mPanDetectorCount--; break; } - case Gesture::Pinch: + case DevelGesture::Pinch: { PinchGestureDetector* pinch = static_cast(gestureDetector); mPinchGestureProcessor.RemoveGestureDetector(pinch); - mPinchDetectorCount--; break; } - case Gesture::Tap: + case DevelGesture::Tap: { TapGestureDetector* tap = static_cast(gestureDetector); mTapGestureProcessor.RemoveGestureDetector(tap); - mTapDetectorCount--; + break; + } + + case DevelGesture::Rotation: + { + RotationGestureDetector* rotation = static_cast(gestureDetector); + mRotationGestureProcessor.RemoveGestureDetector(rotation); break; } } @@ -155,33 +147,39 @@ void GestureEventProcessor::GestureDetectorUpdated(GestureDetector* gestureDetec { switch (gestureDetector->GetType()) { - case Gesture::LongPress: + case DevelGesture::LongPress: { LongPressGestureDetector* longPress = static_cast(gestureDetector); mLongPressGestureProcessor.GestureDetectorUpdated(longPress); break; } - case Gesture::Pan: + case DevelGesture::Pan: { PanGestureDetector* pan = static_cast(gestureDetector); mPanGestureProcessor.GestureDetectorUpdated(pan); break; } - case Gesture::Pinch: + case DevelGesture::Pinch: { PinchGestureDetector* pinch = static_cast(gestureDetector); mPinchGestureProcessor.GestureDetectorUpdated(pinch); break; } - case Gesture::Tap: + case DevelGesture::Tap: { TapGestureDetector* tap = static_cast(gestureDetector); mTapGestureProcessor.GestureDetectorUpdated(tap); break; } + + case DevelGesture::Rotation: + { + // Nothing to do + break; + } } } @@ -189,18 +187,19 @@ void GestureEventProcessor::SetGestureProperties( const Gesture& gesture ) { bool requestUpdate = false; - switch ( gesture.type ) + switch ( static_cast< DevelGesture::Type >( gesture.type ) ) { - case Gesture::Pan: + case DevelGesture::Pan: { const PanGesture& pan = static_cast< const PanGesture& >( gesture ); requestUpdate = mPanGestureProcessor.SetPanGestureProperties( pan ); break; } - case Gesture::LongPress: - case Gesture::Pinch: - case Gesture::Tap: + case DevelGesture::LongPress: + case DevelGesture::Pinch: + case DevelGesture::Tap: + case DevelGesture::Rotation: { DALI_ASSERT_DEBUG( false && "Gesture type does not have scene object\n" ); break; @@ -222,6 +221,7 @@ bool GestureEventProcessor::NeedsUpdate() updateRequired |= mPanGestureProcessor.NeedsUpdate(); updateRequired |= mPinchGestureProcessor.NeedsUpdate(); updateRequired |= mTapGestureProcessor.NeedsUpdate(); + updateRequired |= mRotationGestureProcessor.NeedsUpdate(); return updateRequired; } @@ -321,6 +321,16 @@ void GestureEventProcessor::SetPinchGestureMinimumDistance( float value) mPinchGestureProcessor.SetMinimumPinchDistance( value ); } +void GestureEventProcessor::SetLongPressMinimumHoldingTime( uint32_t value ) +{ + mLongPressGestureProcessor.SetMinimumHoldingTime( value ); +} + +uint32_t GestureEventProcessor::GetLongPressMinimumHoldingTime() const +{ + return mLongPressGestureProcessor.GetMinimumHoldingTime(); +} + const PanGestureProcessor& GestureEventProcessor::GetPanGestureProcessor() { return mPanGestureProcessor;