From a57d543cd372560a9065a31b32184a6a02d49e77 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gy=C3=B6rgy=20Straub?= Date: Wed, 2 Sep 2020 13:48:18 +0100 Subject: [PATCH] Moved Gesture::State and -::Type to gesture-enumerations.h. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Change-Id: I1094170d47c8dd6246bf5a32244424c9a3976c3d Signed-off-by: György Straub --- .../dali-toolkit-test-utils/dummy-control.h | 4 +-- .../src/dali-toolkit/utc-Dali-ControlImpl.cpp | 36 +++++++++++----------- .../accessibility-manager-impl.cpp | 6 ++-- .../accessibility-manager-impl.h | 2 +- .../controls/control/control-data-impl.cpp | 8 ++--- .../page-turn-view/page-turn-view-impl.cpp | 14 ++++----- .../controls/scroll-bar/scroll-bar-impl.cpp | 6 ++-- .../scrollable/item-view/item-view-impl.cpp | 16 +++++----- .../controls/scrollable/item-view/item-view-impl.h | 2 +- .../scrollable/scroll-view/scroll-view-impl.cpp | 30 +++++++++--------- .../scrollable/scroll-view/scroll-view-impl.h | 2 +- .../internal/controls/slider/slider-impl.cpp | 4 +-- .../controls/text-controls/text-editor-impl.cpp | 2 +- .../controls/text-controls/text-field-impl.cpp | 2 +- .../drag-and-drop-detector-impl.cpp | 8 ++--- .../internal/text/decorator/text-decorator.cpp | 12 ++++---- .../internal/text/text-controller-impl.cpp | 11 +++---- dali-toolkit/internal/text/text-controller.cpp | 12 ++++---- dali-toolkit/internal/text/text-controller.h | 4 +-- dali-toolkit/public-api/controls/control-impl.cpp | 22 ++++++------- dali-toolkit/public-api/controls/control-impl.h | 6 ++-- 21 files changed, 104 insertions(+), 105 deletions(-) diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h index de4d66e..6321c1e 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.h @@ -90,8 +90,8 @@ public: static DummyControl New(); public: - inline void EnableGestureDetection(Gesture::Type type) { Internal::Control::EnableGestureDetection(type); } - inline void DisableGestureDetection(Gesture::Type type) { Internal::Control::DisableGestureDetection(type); } + inline void EnableGestureDetection(GestureType::Value type) { Internal::Control::EnableGestureDetection(type); } + inline void DisableGestureDetection(GestureType::Value type) { Internal::Control::DisableGestureDetection(type); } inline PinchGestureDetector GetPinchGestureDetector() const { return Internal::Control::GetPinchGestureDetector(); } inline PanGestureDetector GetPanGestureDetector() const { return Internal::Control::GetPanGestureDetector(); } inline TapGestureDetector GetTapGestureDetector() const { return Internal::Control::GetTapGestureDetector(); } diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp index 36a8b22..baa6b9e 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp @@ -72,19 +72,19 @@ int UtcDaliControlImplEnableGestureDetector(void) DummyControlImpl& dummyImpl = static_cast(dummy.GetImplementation()); DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() ); - dummyImpl.EnableGestureDetection(Gesture::Pinch); + dummyImpl.EnableGestureDetection(GestureType::PINCH); DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() ); DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() ); - dummyImpl.EnableGestureDetection(Gesture::Pan); + dummyImpl.EnableGestureDetection(GestureType::PAN); DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() ); DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() ); - dummyImpl.EnableGestureDetection(Gesture::Tap); + dummyImpl.EnableGestureDetection(GestureType::TAP); DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() ); DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() ); - dummyImpl.EnableGestureDetection(Gesture::LongPress); + dummyImpl.EnableGestureDetection(GestureType::LONG_PRESS); DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() ); } @@ -98,7 +98,7 @@ int UtcDaliControlImplEnableGestureDetector(void) DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() ); DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() ); - dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); + dummyImpl.EnableGestureDetection( GestureType::Value(GestureType::PINCH | GestureType::PAN | GestureType::TAP | GestureType::LONG_PRESS) ); DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() ); DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() ); @@ -107,7 +107,7 @@ int UtcDaliControlImplEnableGestureDetector(void) // Enable when already enabled - dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); + dummyImpl.EnableGestureDetection( GestureType::Value(GestureType::PINCH | GestureType::PAN | GestureType::TAP | GestureType::LONG_PRESS) ); DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() ); DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() ); @@ -126,22 +126,22 @@ int UtcDaliControlImplDisableGestureDetector(void) DummyControl dummy = DummyControl::New(); DummyControlImpl& dummyImpl = static_cast(dummy.GetImplementation()); - dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); + dummyImpl.EnableGestureDetection( GestureType::Value(GestureType::PINCH | GestureType::PAN | GestureType::TAP | GestureType::LONG_PRESS) ); DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() ); - dummyImpl.DisableGestureDetection(Gesture::Pinch); + dummyImpl.DisableGestureDetection(GestureType::PINCH); DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() ); DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() ); - dummyImpl.DisableGestureDetection(Gesture::Pan); + dummyImpl.DisableGestureDetection(GestureType::PAN); DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() ); DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() ); - dummyImpl.DisableGestureDetection(Gesture::Tap); + dummyImpl.DisableGestureDetection(GestureType::TAP); DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() ); DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() ); - dummyImpl.DisableGestureDetection(Gesture::LongPress); + dummyImpl.DisableGestureDetection(GestureType::LONG_PRESS); DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() ); } @@ -150,14 +150,14 @@ int UtcDaliControlImplDisableGestureDetector(void) DummyControl dummy = DummyControl::New(); DummyControlImpl& dummyImpl = static_cast(dummy.GetImplementation()); - dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); + dummyImpl.EnableGestureDetection( GestureType::Value(GestureType::PINCH | GestureType::PAN | GestureType::TAP | GestureType::LONG_PRESS) ); DALI_TEST_CHECK( dummyImpl.GetPinchGestureDetector() ); DALI_TEST_CHECK( dummyImpl.GetPanGestureDetector() ); DALI_TEST_CHECK( dummyImpl.GetTapGestureDetector() ); DALI_TEST_CHECK( dummyImpl.GetLongPressGestureDetector() ); - dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); + dummyImpl.DisableGestureDetection( GestureType::Value(GestureType::PINCH | GestureType::PAN | GestureType::TAP | GestureType::LONG_PRESS) ); DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() ); DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() ); @@ -175,7 +175,7 @@ int UtcDaliControlImplDisableGestureDetector(void) DALI_TEST_CHECK( !dummyImpl.GetTapGestureDetector() ); DALI_TEST_CHECK( !dummyImpl.GetLongPressGestureDetector() ); - dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); + dummyImpl.DisableGestureDetection( GestureType::Value(GestureType::PINCH | GestureType::PAN | GestureType::TAP | GestureType::LONG_PRESS) ); DALI_TEST_CHECK( !dummyImpl.GetPinchGestureDetector() ); DALI_TEST_CHECK( !dummyImpl.GetPanGestureDetector() ); @@ -188,7 +188,7 @@ int UtcDaliControlImplDisableGestureDetector(void) DummyControl dummy = DummyControl::New(); DummyControlImpl& dummyImpl = static_cast(dummy.GetImplementation()); - dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); + dummyImpl.EnableGestureDetection( GestureType::Value(GestureType::PINCH | GestureType::PAN | GestureType::TAP | GestureType::LONG_PRESS) ); PinchGestureDetector pinch = dummyImpl.GetPinchGestureDetector(); PanGestureDetector pan = dummyImpl.GetPanGestureDetector(); @@ -200,7 +200,7 @@ int UtcDaliControlImplDisableGestureDetector(void) DALI_TEST_EQUALS( 0 == tap.GetAttachedActorCount(), false, TEST_LOCATION ); DALI_TEST_EQUALS( 0 == longPress.GetAttachedActorCount(), false, TEST_LOCATION ); - dummyImpl.DisableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); + dummyImpl.DisableGestureDetection( GestureType::Value(GestureType::PINCH | GestureType::PAN | GestureType::TAP | GestureType::LONG_PRESS) ); DALI_TEST_EQUALS( 0 == pinch.GetAttachedActorCount(), true, TEST_LOCATION ); DALI_TEST_EQUALS( 0 == pan.GetAttachedActorCount(), true, TEST_LOCATION ); @@ -229,7 +229,7 @@ int UtcDaliControlImplOnGestureMethods(void) application.Render(); Impl::DummyControl& dummyImpl = static_cast(dummy.GetImplementation()); - dummyImpl.EnableGestureDetection( Gesture::Type(Gesture::Pinch | Gesture::Pan | Gesture::Tap | Gesture::LongPress) ); + dummyImpl.EnableGestureDetection( GestureType::Value(GestureType::PINCH | GestureType::PAN | GestureType::TAP | GestureType::LONG_PRESS) ); DALI_TEST_CHECK( dummyImpl.pinchCalled == false ); @@ -1285,7 +1285,7 @@ int UtcDaliControlImplOnPinch(void) application.Render(); Toolkit::Internal::Control& impl = Toolkit::Internal::GetImplementation(control); - impl.EnableGestureDetection(Gesture::Pinch); + impl.EnableGestureDetection(GestureType::PINCH); // Scale becomes 0.6666666 TestStartPinch( application, Vector2( 5.0f, 20.0f ), Vector2( 35.0f, 20.0f ), diff --git a/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp index b19ab8d..e336eee 100644 --- a/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp +++ b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp @@ -1322,17 +1322,17 @@ bool AccessibilityManager::HandlePanGesture(const AccessibilityGestureEvent& pan } } - // Gesture::Finished (Up) events are delivered with previous (Motion) event position + // GestureState::FINISHED (Up) events are delivered with previous (Motion) event position // Use the real previous position; otherwise we may incorrectly get a ZERO velocity if ( AccessibilityGestureEvent::FINISHED != panEvent.state ) { - // Store the previous position for next Gesture::Finished iteration. + // Store the previous position for next GestureState::FINISHED iteration. mPreviousPosition = panEvent.previousPosition; } Actor rootActor = Stage::GetCurrent().GetRootLayer(); - Dali::PanGesture pan = DevelPanGesture::New( static_cast(panEvent.state) ); + Dali::PanGesture pan = DevelPanGesture::New( static_cast(panEvent.state) ); DevelPanGesture::SetTime( pan, panEvent.time ); DevelPanGesture::SetNumberOfTouches( pan, panEvent.numberOfTouches ); DevelPanGesture::SetScreenPosition( pan, panEvent.currentPosition ); diff --git a/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h index 3d02c5f..4eddb86 100644 --- a/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h +++ b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.h @@ -711,7 +711,7 @@ private: FocusIDPair mCurrentFocusActor; ///< The focus order and actor ID of current focused actor Actor mCurrentGesturedActor; ///< The actor that will handle the gesture Actor mFocusIndicatorActor; ///< The focus indicator actor shared by all the focusable actors for highlight - Vector2 mPreviousPosition; ///< The previous pan position; useful for calculating velocity for Gesture::Finished events + Vector2 mPreviousPosition; ///< The previous pan position; useful for calculating velocity for GestureState::FINISHED events unsigned int mRecursiveFocusMoveCounter; ///< The counter to count the number of recursive focus movement attempted before the focus movement is successful. std::string mFocusSoundFilePath; ///< The path of the focus sound file std::string mFocusChainEndSoundFilePath; ///< The path of the focus chain end sound file diff --git a/dali-toolkit/internal/controls/control/control-data-impl.cpp b/dali-toolkit/internal/controls/control/control-data-impl.cpp index 958dd2c..46a1972 100755 --- a/dali-toolkit/internal/controls/control/control-data-impl.cpp +++ b/dali-toolkit/internal/controls/control/control-data-impl.cpp @@ -229,22 +229,22 @@ static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tra } else if( 0 == strcmp( signalName.c_str(), SIGNAL_TAPPED ) ) { - controlImpl.EnableGestureDetection( Gesture::Tap ); + controlImpl.EnableGestureDetection( GestureType::TAP ); controlImpl.GetTapGestureDetector().DetectedSignal().Connect( tracker, functor ); } else if( 0 == strcmp( signalName.c_str(), SIGNAL_PANNED ) ) { - controlImpl.EnableGestureDetection( Gesture::Pan ); + controlImpl.EnableGestureDetection( GestureType::PAN ); controlImpl.GetPanGestureDetector().DetectedSignal().Connect( tracker, functor ); } else if( 0 == strcmp( signalName.c_str(), SIGNAL_PINCHED ) ) { - controlImpl.EnableGestureDetection( Gesture::Pinch ); + controlImpl.EnableGestureDetection( GestureType::PINCH ); controlImpl.GetPinchGestureDetector().DetectedSignal().Connect( tracker, functor ); } else if( 0 == strcmp( signalName.c_str(), SIGNAL_LONG_PRESSED ) ) { - controlImpl.EnableGestureDetection( Gesture::LongPress ); + controlImpl.EnableGestureDetection( GestureType::LONG_PRESS ); controlImpl.GetLongPressGestureDetector().DetectedSignal().Connect( tracker, functor ); } } diff --git a/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp b/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp index 2964578..e258b69 100644 --- a/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp +++ b/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp @@ -413,7 +413,7 @@ void PageTurnView::OnInitialize() mPages[0].actor.SetProperty( Actor::Property::VISIBLE,true); // enable the pan gesture which is attached to the control - EnableGestureDetection(Gesture::Type(Gesture::Pan)); + EnableGestureDetection(GestureType::Value(GestureType::PAN)); } Shader PageTurnView::CreateShader( const Property::Map& shaderMap ) @@ -614,7 +614,7 @@ void PageTurnView::OnPan( const PanGesture& gesture ) // the pan gesture is attached to control itself instead of each page switch( gesture.GetState() ) { - case Gesture::Started: + case GestureState::STARTED: { // check whether the undergoing turning page number already reaches the maximum allowed if( mPageUpdated && mAnimatingCount< MAXIMUM_TURNING_NUM && mSlidingCount < 1 ) @@ -633,19 +633,19 @@ void PageTurnView::OnPan( const PanGesture& gesture ) } break; } - case Gesture::Continuing: + case GestureState::CONTINUING: { PanContinuing( SetPanPosition( gesture.GetPosition() ) ); // pass in the pan position in the local page coordinate break; } - case Gesture::Finished: - case Gesture::Cancelled: + case GestureState::FINISHED: + case GestureState::CANCELLED: { PanFinished( SetPanPosition( gesture.GetPosition() ), gesture.GetSpeed() ); break; } - case Gesture::Clear: - case Gesture::Possible: + case GestureState::CLEAR: + case GestureState::POSSIBLE: default: { break; diff --git a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp index c588487..f002764 100644 --- a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp +++ b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp @@ -265,7 +265,7 @@ void ScrollBar::SetScrollIndicator( Actor indicator ) mIndicatorFirstShow = true; Self().Add( mIndicator ); - EnableGestureDetection( Gesture::Type( Gesture::Pan ) ); + EnableGestureDetection( GestureType::Value( GestureType::PAN ) ); PanGestureDetector detector( GetPanGestureDetector() ); detector.DetachAll(); @@ -461,7 +461,7 @@ void ScrollBar::OnPan( const PanGesture& gesture ) switch(gesture.GetState()) { - case Dali::Gesture::Started: + case Dali::GestureState::STARTED: { if( !mPanProcessTimer ) { @@ -478,7 +478,7 @@ void ScrollBar::OnPan( const PanGesture& gesture ) break; } - case Dali::Gesture::Continuing: + case Dali::GestureState::CONTINUING: { mGestureDisplacement += gesture.GetDisplacement(); diff --git a/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp b/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp index 6807b16..dc329ed 100644 --- a/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.cpp @@ -347,7 +347,7 @@ ItemView::ItemView(ItemFactory& factory) mScrollDistance(0.0f), mScrollSpeed(0.0f), mScrollOvershoot(0.0f), - mGestureState(Gesture::Clear), + mGestureState(GestureState::CLEAR), mAnimatingOvershootOn(false), mAnimateOvershootOff(false), mAnchoringEnabled(false), @@ -368,7 +368,7 @@ void ItemView::OnInitialize() mWheelScrollDistanceStep = stageSize.y * DEFAULT_WHEEL_SCROLL_DISTANCE_STEP_PROPORTION; self.TouchedSignal().Connect( this, &ItemView::OnTouch ); - EnableGestureDetection(Gesture::Type(Gesture::Pan)); + EnableGestureDetection(GestureType::Value(GestureType::PAN)); mWheelEventFinishedTimer = Timer::New( WHEEL_EVENT_FINISHED_TIME_OUT ); mWheelEventFinishedTimer.TickSignal().Connect( this, &ItemView::OnWheelEventFinished ); @@ -1125,7 +1125,7 @@ bool ItemView::OnTouch( Actor actor, const TouchEvent& touch ) if ( touch.GetState( 0 ) == PointState::DOWN ) { // Cancel ongoing scrolling etc. - mGestureState = Gesture::Clear; + mGestureState = GestureState::CLEAR; mScrollDistance = 0.0f; mScrollSpeed = 0.0f; @@ -1155,7 +1155,7 @@ void ItemView::OnPan( const PanGesture& gesture ) // Short-circuit if there is no active layout if (!mActiveLayout) { - mGestureState = Gesture::Clear; + mGestureState = GestureState::CLEAR; return; } @@ -1163,7 +1163,7 @@ void ItemView::OnPan( const PanGesture& gesture ) switch (mGestureState) { - case Gesture::Finished: + case GestureState::FINISHED: { // Swipe Detection if (fabsf(mScrollDistance) > mMinimumSwipeDistance && @@ -1218,14 +1218,14 @@ void ItemView::OnPan( const PanGesture& gesture ) } break; - case Gesture::Started: // Fall through + case GestureState::STARTED: // Fall through { mTotalPanDisplacement = Vector2::ZERO; mScrollStartedSignal.Emit(GetCurrentScrollPosition()); mRefreshEnabled = true; } - case Gesture::Continuing: + case GestureState::CONTINUING: { const Vector2& displacement = gesture.GetDisplacement(); mScrollDistance = CalculateScrollDistance(displacement, *mActiveLayout); @@ -1278,7 +1278,7 @@ void ItemView::OnPan( const PanGesture& gesture ) } break; - case Gesture::Cancelled: + case GestureState::CANCELLED: { mScrollAnimation = DoAnchoring(); } diff --git a/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h b/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h index 144951e..0cfa9ab 100755 --- a/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h +++ b/dali-toolkit/internal/controls/scrollable/item-view/item-view-impl.h @@ -634,7 +634,7 @@ private: float mScrollSpeed; float mScrollOvershoot; - Dali::Gesture::State mGestureState : 4; + GestureState mGestureState : 8; bool mAnimatingOvershootOn : 1; ///< Whether we are currently animating overshoot to 1.0f/-1.0f (on) or to 0.0f (off) bool mAnimateOvershootOff : 1; ///< Whether we are currently animating overshoot to 1.0f/-1.0f (on) or to 0.0f (off) bool mAnchoringEnabled : 1; diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp index 4f75190..c0fb772 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp @@ -690,7 +690,7 @@ void ScrollView::OnInitialize() mGestureStackDepth = 0; self.TouchedSignal().Connect( this, &ScrollView::OnTouch ); - EnableGestureDetection( Gesture::Type( Gesture::Pan ) ); + EnableGestureDetection( GestureType::Value( GestureType::PAN ) ); // By default we'll allow the user to freely drag the scroll view, // while disabling the other rulers. @@ -1003,7 +1003,7 @@ void ScrollView::SetScrollSensitive(bool sensitive) // while the scroll view is panning, the state needs to be reset. if ( mPanning ) { - PanGesture cancelGesture = DevelPanGesture::New( Gesture::Cancelled ); + PanGesture cancelGesture = DevelPanGesture::New( GestureState::CANCELLED ); OnPan( cancelGesture ); } @@ -2448,7 +2448,7 @@ void ScrollView::GestureContinuing(const Vector2& panDelta) mPanDelta.y+= panDelta.y; // Save the velocity, there is a bug in PanGesture - // Whereby the Gesture::Finished's velocity is either: + // Whereby the GestureState::FINISHED's velocity is either: // NaN (due to time delta of zero between the last two events) // or 0 (due to position being the same between the last two events) @@ -2461,7 +2461,7 @@ void ScrollView::GestureContinuing(const Vector2& panDelta) } // TODO: Upgrade to use a more powerful gesture detector (one that supports multiple touches on pan - so works as pan and flick gesture) -// BUG: Gesture::Finished doesn't always return velocity on release (due to +// BUG: GestureState::FINISHED doesn't always return velocity on release (due to // timeDelta between last two events being 0 sometimes, or posiiton being the same) void ScrollView::OnPan( const PanGesture& gesture ) { @@ -2481,7 +2481,7 @@ void ScrollView::OnPan( const PanGesture& gesture ) // translate Gesture input to get useful data... switch(gesture.GetState()) { - case Gesture::Started: + case GestureState::STARTED: { DALI_LOG_SCROLL_STATE("[0x%X] Pan Started", this); const Vector2& position = gesture.GetPosition(); @@ -2508,7 +2508,7 @@ void ScrollView::OnPan( const PanGesture& gesture ) break; } - case Gesture::Continuing: + case GestureState::CONTINUING: { if ( mPanning ) { @@ -2523,12 +2523,12 @@ void ScrollView::OnPan( const PanGesture& gesture ) break; } - case Gesture::Finished: - case Gesture::Cancelled: + case GestureState::FINISHED: + case GestureState::CANCELLED: { if ( mPanning ) { - DALI_LOG_SCROLL_STATE("[0x%X] Pan %s", this, ( ( gesture.GetState() == Gesture::Finished ) ? "Finished" : "Cancelled" ) ); + DALI_LOG_SCROLL_STATE("[0x%X] Pan %s", this, ( ( gesture.GetState() == GestureState::FINISHED ) ? "Finished" : "Cancelled" ) ); UpdateLocalScrollProperties(); mLastVelocity = gesture.GetVelocity(); @@ -2554,8 +2554,8 @@ void ScrollView::OnPan( const PanGesture& gesture ) break; } - case Gesture::Possible: - case Gesture::Clear: + case GestureState::POSSIBLE: + case GestureState::CLEAR: { // Nothing to do, not needed. break; @@ -2566,11 +2566,11 @@ void ScrollView::OnPan( const PanGesture& gesture ) OnGestureEx(gesture.GetState()); } -void ScrollView::OnGestureEx(Gesture::State state) +void ScrollView::OnGestureEx(GestureState state) { // call necessary signals for application developer - if(state == Gesture::Started) + if(state == GestureState::STARTED) { Vector2 currentScrollPosition = GetCurrentScrollPosition(); Self().SetProperty(Toolkit::ScrollView::Property::SCROLLING, true); @@ -2578,8 +2578,8 @@ void ScrollView::OnGestureEx(Gesture::State state) DALI_LOG_SCROLL_STATE("[0x%X] mScrollStartedSignal 2 [%.2f, %.2f]", this, currentScrollPosition.x, currentScrollPosition.y); mScrollStartedSignal.Emit( currentScrollPosition ); } - else if( (state == Gesture::Finished) || - (state == Gesture::Cancelled) ) // Finished/default + else if( (state == GestureState::FINISHED) || + (state == GestureState::CANCELLED) ) // Finished/default { // when all the gestures have finished, we finish the transform. // so if a user decides to pan (1 gesture), and then pan+zoom (2 gestures) diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h index 55d51f4..d85a156 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h @@ -724,7 +724,7 @@ private: * * @param[in] gesture The gesture event. */ - void OnGestureEx(Gesture::State state); + void OnGestureEx(GestureState state); /** * Performs snapping while taking into account Velocity of gesture diff --git a/dali-toolkit/internal/controls/slider/slider-impl.cpp b/dali-toolkit/internal/controls/slider/slider-impl.cpp index 8282c74..742311a 100644 --- a/dali-toolkit/internal/controls/slider/slider-impl.cpp +++ b/dali-toolkit/internal/controls/slider/slider-impl.cpp @@ -250,7 +250,7 @@ void Slider::OnPan( Actor actor, const PanGesture& gesture ) { switch( gesture.GetState() ) { - case Gesture::Continuing: + case GestureState::CONTINUING: { if( mState == PRESSED ) { @@ -260,7 +260,7 @@ void Slider::OnPan( Actor actor, const PanGesture& gesture ) } break; } - case Gesture::Finished: + case GestureState::FINISHED: { if( mState == PRESSED ) { diff --git a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp index beb29f5..7576bc1 100644 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp @@ -1292,7 +1292,7 @@ void TextEditor::OnInitialize() mController->SetLayoutDirection( layoutDirection ); // Forward input events to controller - EnableGestureDetection( static_cast( Gesture::Tap | Gesture::Pan | Gesture::LongPress ) ); + EnableGestureDetection( static_cast( GestureType::TAP | GestureType::PAN | GestureType::LONG_PRESS ) ); GetTapGestureDetector().SetMaximumTapsRequired( 2 ); self.TouchedSignal().Connect( this, &TextEditor::OnTouched ); diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp index 396e525..dfe68d1 100644 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -1339,7 +1339,7 @@ void TextField::OnInitialize() mController->SetLayoutDirection( layoutDirection ); // Forward input events to controller - EnableGestureDetection( static_cast( Gesture::Tap | Gesture::Pan | Gesture::LongPress ) ); + EnableGestureDetection( static_cast( GestureType::TAP | GestureType::PAN | GestureType::LONG_PRESS ) ); GetTapGestureDetector().SetMaximumTapsRequired( 2 ); self.TouchedSignal().Connect( this, &TextField::OnTouched ); diff --git a/dali-toolkit/internal/drag-drop-detector/drag-and-drop-detector-impl.cpp b/dali-toolkit/internal/drag-drop-detector/drag-and-drop-detector-impl.cpp index 6687e89..994932e 100644 --- a/dali-toolkit/internal/drag-drop-detector/drag-and-drop-detector-impl.cpp +++ b/dali-toolkit/internal/drag-drop-detector/drag-and-drop-detector-impl.cpp @@ -123,9 +123,9 @@ void DragAndDropDetector::OnPan(Dali::Actor actor, const PanGesture& gesture) { Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(actor); - Gesture::State state = gesture.GetState(); + GestureState state = gesture.GetState(); - if(state == Gesture::Started) + if(state == GestureState::STARTED) { mDragLocalPosition = gesture.GetPosition(); mPointDown = true; @@ -149,13 +149,13 @@ void DragAndDropDetector::OnPan(Dali::Actor actor, const PanGesture& gesture) SetPosition(gesture.GetScreenPosition()); EmitStartedSignal(control); } - if(state == Gesture::Continuing) + if(state == GestureState::CONTINUING) { Vector2 screenPosition = gesture.GetScreenPosition(); control.GetParent().ScreenToLocal(mLocalPosition.x, mLocalPosition.y, screenPosition.x, screenPosition.y); mShadowControl.SetProperty( Actor::Property::POSITION, Vector2(mLocalPosition.x - mDragLocalPosition.x, mLocalPosition.y - mDragLocalPosition.y)); } - if(state == Gesture::Finished) + if(state == GestureState::FINISHED) { mDragControl.GetParent().Remove(mShadowControl); EmitEndedSignal(control); diff --git a/dali-toolkit/internal/text/decorator/text-decorator.cpp b/dali-toolkit/internal/text/decorator/text-decorator.cpp index 1f83d15..ad02368 100644 --- a/dali-toolkit/internal/text/decorator/text-decorator.cpp +++ b/dali-toolkit/internal/text/decorator/text-decorator.cpp @@ -1259,8 +1259,8 @@ struct Decorator::Impl : public ConnectionTracker void DoPan( HandleImpl& handle, HandleType type, const PanGesture& gesture ) { - Gesture::State state = gesture.GetState(); - if( Gesture::Started == state ) + GestureState state = gesture.GetState(); + if( GestureState::STARTED == state ) { handle.grabDisplacementX = handle.grabDisplacementY = 0.f; @@ -1276,8 +1276,8 @@ struct Decorator::Impl : public ConnectionTracker const float y = handle.globalPosition.y + handle.grabDisplacementY + 0.5f * handle.lineHeight; const float yVerticallyFlippedCorrected = y - ( handle.verticallyFlippedOnTouch ? handle.lineHeight : 0.f ); - if( ( Gesture::Started == state ) || - ( Gesture::Continuing == state ) ) + if( ( GestureState::STARTED == state ) || + ( GestureState::CONTINUING == state ) ) { Vector2 targetSize; mController.GetTargetSize( targetSize ); @@ -1319,8 +1319,8 @@ struct Decorator::Impl : public ConnectionTracker mIsHandlePanning = true; } - else if( ( Gesture::Finished == state ) || - ( Gesture::Cancelled == state ) ) + else if( ( GestureState::FINISHED == state ) || + ( GestureState::CANCELLED == state ) ) { if( mScrollTimer && ( mScrollTimer.IsRunning() || mNotifyEndOfScroll ) ) diff --git a/dali-toolkit/internal/text/text-controller-impl.cpp b/dali-toolkit/internal/text/text-controller-impl.cpp index dd59fc8..0a8fe4b 100644 --- a/dali-toolkit/internal/text/text-controller-impl.cpp +++ b/dali-toolkit/internal/text/text-controller-impl.cpp @@ -1601,17 +1601,16 @@ void Controller::Impl::OnPanEvent( const Event& event ) return; } - const int state = event.p1.mInt; - + const GestureState state = static_cast( event.p1.mInt ); switch( state ) { - case Gesture::Started: + case GestureState::STARTED: { // Will remove the cursor, handles or text's popup, ... ChangeState( EventData::TEXT_PANNING ); break; } - case Gesture::Continuing: + case GestureState::CONTINUING: { const Vector2& layoutSize = mModel->mVisualModel->GetLayoutSize(); const Vector2 currentScroll = mModel->mScrollPosition; @@ -1635,8 +1634,8 @@ void Controller::Impl::OnPanEvent( const Event& event ) mEventData->mDecorator->UpdatePositions( mModel->mScrollPosition - currentScroll ); break; } - case Gesture::Finished: - case Gesture::Cancelled: // FALLTHROUGH + case GestureState::FINISHED: + case GestureState::CANCELLED: // FALLTHROUGH { // Will go back to the previous state to show the cursor, handles, the text's popup, ... ChangeState( mEventData->mPreviousState ); diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index fb90b85..4edac33 100755 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -3091,14 +3091,14 @@ void Controller::TapEvent( unsigned int tapCount, float x, float y ) mImpl->ResetInputMethodContext(); } -void Controller::PanEvent( Gesture::State state, const Vector2& displacement ) +void Controller::PanEvent( GestureState state, const Vector2& displacement ) { DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected PanEvent" ); if( NULL != mImpl->mEventData ) { Event event( Event::PAN_EVENT ); - event.p1.mInt = state; + event.p1.mInt = static_cast( state ); event.p2.mFloat = displacement.x; event.p3.mFloat = displacement.y; mImpl->mEventData->mEventQueue.push_back( event ); @@ -3107,11 +3107,11 @@ void Controller::PanEvent( Gesture::State state, const Vector2& displacement ) } } -void Controller::LongPressEvent( Gesture::State state, float x, float y ) +void Controller::LongPressEvent( GestureState state, float x, float y ) { DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected LongPressEvent" ); - if( ( state == Gesture::Started ) && + if( ( state == GestureState::STARTED ) && ( NULL != mImpl->mEventData ) ) { // The 1st long-press on inactive text-field is treated as tap @@ -3130,7 +3130,7 @@ void Controller::LongPressEvent( Gesture::State state, float x, float y ) else if( !mImpl->IsShowingRealText() ) { Event event( Event::LONG_PRESS_EVENT ); - event.p1.mInt = state; + event.p1.mInt = static_cast( state ); event.p2.mFloat = x; event.p3.mFloat = y; mImpl->mEventData->mEventQueue.push_back( event ); @@ -3142,7 +3142,7 @@ void Controller::LongPressEvent( Gesture::State state, float x, float y ) mImpl->ResetInputMethodContext(); Event event( Event::LONG_PRESS_EVENT ); - event.p1.mInt = state; + event.p1.mInt = static_cast( state ); event.p2.mFloat = x; event.p3.mFloat = y; mImpl->mEventData->mEventQueue.push_back( event ); diff --git a/dali-toolkit/internal/text/text-controller.h b/dali-toolkit/internal/text/text-controller.h index c7a549e..ad91be0 100755 --- a/dali-toolkit/internal/text/text-controller.h +++ b/dali-toolkit/internal/text/text-controller.h @@ -1470,7 +1470,7 @@ public: // Text-input Event Queuing. * @param[in] state The state of the gesture. * @param[in] displacement This distance panned since the last pan gesture. */ - void PanEvent( Gesture::State state, const Vector2& displacement ); + void PanEvent( GestureState state, const Vector2& displacement ); /** * @brief Called by editable UI controls when a long press gesture occurs. @@ -1479,7 +1479,7 @@ public: // Text-input Event Queuing. * @param[in] x The x position relative to the top-left of the parent control. * @param[in] y The y position relative to the top-left of the parent control. */ - void LongPressEvent( Gesture::State state, float x, float y ); + void LongPressEvent( GestureState state, float x, float y ); /** * @brief Creates a selection event. diff --git a/dali-toolkit/public-api/controls/control-impl.cpp b/dali-toolkit/public-api/controls/control-impl.cpp index 5897750..506b833 100644 --- a/dali-toolkit/public-api/controls/control-impl.cpp +++ b/dali-toolkit/public-api/controls/control-impl.cpp @@ -228,30 +228,30 @@ void Control::ClearBackground() RelayoutRequest(); } -void Control::EnableGestureDetection(Gesture::Type type) +void Control::EnableGestureDetection(GestureType::Value type) { - if ( (type & Gesture::Pinch) && !mImpl->mPinchGestureDetector ) + if ( (type & GestureType::PINCH) && !mImpl->mPinchGestureDetector ) { mImpl->mPinchGestureDetector = PinchGestureDetector::New(); mImpl->mPinchGestureDetector.DetectedSignal().Connect(mImpl, &Impl::PinchDetected); mImpl->mPinchGestureDetector.Attach(Self()); } - if ( (type & Gesture::Pan) && !mImpl->mPanGestureDetector ) + if ( (type & GestureType::PAN) && !mImpl->mPanGestureDetector ) { mImpl->mPanGestureDetector = PanGestureDetector::New(); mImpl->mPanGestureDetector.DetectedSignal().Connect(mImpl, &Impl::PanDetected); mImpl->mPanGestureDetector.Attach(Self()); } - if ( (type & Gesture::Tap) && !mImpl->mTapGestureDetector ) + if ( (type & GestureType::TAP) && !mImpl->mTapGestureDetector ) { mImpl->mTapGestureDetector = TapGestureDetector::New(); mImpl->mTapGestureDetector.DetectedSignal().Connect(mImpl, &Impl::TapDetected); mImpl->mTapGestureDetector.Attach(Self()); } - if ( (type & Gesture::LongPress) && !mImpl->mLongPressGestureDetector ) + if ( (type & GestureType::LONG_PRESS) && !mImpl->mLongPressGestureDetector ) { mImpl->mLongPressGestureDetector = LongPressGestureDetector::New(); mImpl->mLongPressGestureDetector.DetectedSignal().Connect(mImpl, &Impl::LongPressDetected); @@ -259,27 +259,27 @@ void Control::EnableGestureDetection(Gesture::Type type) } } -void Control::DisableGestureDetection(Gesture::Type type) +void Control::DisableGestureDetection(GestureType::Value type) { - if ( (type & Gesture::Pinch) && mImpl->mPinchGestureDetector ) + if ( (type & GestureType::PINCH) && mImpl->mPinchGestureDetector ) { mImpl->mPinchGestureDetector.Detach(Self()); mImpl->mPinchGestureDetector.Reset(); } - if ( (type & Gesture::Pan) && mImpl->mPanGestureDetector ) + if ( (type & GestureType::PAN) && mImpl->mPanGestureDetector ) { mImpl->mPanGestureDetector.Detach(Self()); mImpl->mPanGestureDetector.Reset(); } - if ( (type & Gesture::Tap) && mImpl->mTapGestureDetector ) + if ( (type & GestureType::TAP) && mImpl->mTapGestureDetector ) { mImpl->mTapGestureDetector.Detach(Self()); mImpl->mTapGestureDetector.Reset(); } - if ( (type & Gesture::LongPress) && mImpl->mLongPressGestureDetector) + if ( (type & GestureType::LONG_PRESS) && mImpl->mLongPressGestureDetector) { mImpl->mLongPressGestureDetector.Detach(Self()); mImpl->mLongPressGestureDetector.Reset(); @@ -507,7 +507,7 @@ void Control::OnPinch(const PinchGesture& pinch) mImpl->mStartingPinchScale = new Vector3; } - if( pinch.GetState() == Gesture::Started ) + if( pinch.GetState() == GestureState::STARTED ) { *( mImpl->mStartingPinchScale ) = Self().GetCurrentProperty< Vector3 >( Actor::Property::SCALE ); } diff --git a/dali-toolkit/public-api/controls/control-impl.h b/dali-toolkit/public-api/controls/control-impl.h index 160ac55..237c462 100644 --- a/dali-toolkit/public-api/controls/control-impl.h +++ b/dali-toolkit/public-api/controls/control-impl.h @@ -117,12 +117,12 @@ public: * * Gesture detection can be enabled one at a time or in bitwise format as shown: * @code - * EnableGestureDetection(Gesture::Type(Gesture::Pinch | Gesture::Tap | Gesture::Pan)); + * EnableGestureDetection(GestureType::Value(GestureType::PINCH | GestureType::TAP | GestureType::PAN)); * @endcode * @SINCE_1_0.0 * @param[in] type The gesture type(s) to enable */ - void EnableGestureDetection( Gesture::Type type ); + void EnableGestureDetection( GestureType::Value type ); /** * @brief Allows deriving classes to disable any of the gesture detectors. @@ -132,7 +132,7 @@ public: * @param[in] type The gesture type(s) to disable * @see EnableGetureDetection */ - void DisableGestureDetection( Gesture::Type type ); + void DisableGestureDetection( GestureType::Value type ); /** * @brief If deriving classes wish to fine tune pinch gesture -- 2.7.4