From: Adeel Kazmi Date: Wed, 26 Aug 2020 18:10:03 +0000 (+0100) Subject: Moved RotationGesture to the Public API X-Git-Tag: dali_1.9.27~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F16%2F242416%2F3;p=platform%2Fcore%2Fuifw%2Fdali-core.git Moved RotationGesture to the Public API Change-Id: Ibb604d9e4fef2cb7843c00aa0f09e306a47af9d9 --- diff --git a/automated-tests/src/dali/utc-Dali-LongPressGestureRecognizer.cpp b/automated-tests/src/dali/utc-Dali-LongPressGestureRecognizer.cpp index 456dac7..ab81b80 100644 --- a/automated-tests/src/dali/utc-Dali-LongPressGestureRecognizer.cpp +++ b/automated-tests/src/dali/utc-Dali-LongPressGestureRecognizer.cpp @@ -324,8 +324,6 @@ int UtcDaliLongPressGestureRecognizerMultiplePointsLongPress(void) LongPressGestureDetector detector = LongPressGestureDetector::New(); - detector.SetTouchesRequired(2,2); - Actor actor = Actor::New(); actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT); @@ -336,6 +334,7 @@ int UtcDaliLongPressGestureRecognizerMultiplePointsLongPress(void) application.Render(); detector.Attach(actor); + detector.SetTouchesRequired(2,2); // Set after we've attached forcing us to change things internally SignalData data; GestureReceivedFunctor functor(data); diff --git a/automated-tests/src/dali/utc-Dali-RotationGesture.cpp b/automated-tests/src/dali/utc-Dali-RotationGesture.cpp index 4287ebf..e140a98 100644 --- a/automated-tests/src/dali/utc-Dali-RotationGesture.cpp +++ b/automated-tests/src/dali/utc-Dali-RotationGesture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,8 +19,6 @@ #include #include -#include -#include #include using namespace Dali; @@ -43,17 +41,17 @@ int UtcDaliRotationGestureConstructor(void) RotationGesture gesture(Gesture::Started); DALI_TEST_EQUALS(Gesture::Started, gesture.state, TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture.rotation.radian, TEST_LOCATION); - DALI_TEST_EQUALS(DevelGesture::Rotation, static_cast< DevelGesture::Type >( gesture.type ), TEST_LOCATION); + DALI_TEST_EQUALS(Gesture::Rotation, gesture.type, TEST_LOCATION); RotationGesture gesture2(Gesture::Continuing); DALI_TEST_EQUALS(Gesture::Continuing, gesture2.state, TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture2.rotation.radian, TEST_LOCATION); - DALI_TEST_EQUALS(DevelGesture::Rotation, static_cast< DevelGesture::Type >( gesture2.type ), TEST_LOCATION); + DALI_TEST_EQUALS(Gesture::Rotation, gesture2.type, TEST_LOCATION); RotationGesture gesture3(Gesture::Finished); DALI_TEST_EQUALS(Gesture::Finished, gesture3.state, TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture3.rotation.radian, TEST_LOCATION); - DALI_TEST_EQUALS(DevelGesture::Rotation, static_cast< DevelGesture::Type >( gesture3.type ), TEST_LOCATION); + DALI_TEST_EQUALS(Gesture::Rotation, gesture3.type, TEST_LOCATION); // Test copy constructor gesture3.rotation = 3.0f; @@ -61,7 +59,7 @@ int UtcDaliRotationGestureConstructor(void) RotationGesture rotation(gesture3); DALI_TEST_EQUALS(Gesture::Finished, rotation.state, TEST_LOCATION); DALI_TEST_EQUALS(3.0f, rotation.rotation.radian, TEST_LOCATION); -DALI_TEST_EQUALS(DevelGesture::Rotation, static_cast< DevelGesture::Type >( rotation.type ), TEST_LOCATION); + DALI_TEST_EQUALS(Gesture::Rotation, rotation.type, TEST_LOCATION); END_TEST; } @@ -71,19 +69,19 @@ int UtcDaliRotationGestureAssignment(void) RotationGesture gesture(Gesture::Started); DALI_TEST_EQUALS(Gesture::Started, gesture.state, TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture.rotation.radian, TEST_LOCATION); - DALI_TEST_EQUALS(DevelGesture::Rotation, static_cast< DevelGesture::Type >( gesture.type ), TEST_LOCATION); + DALI_TEST_EQUALS(Gesture::Rotation, gesture.type, TEST_LOCATION); RotationGesture gesture2(Gesture::Continuing); DALI_TEST_EQUALS(Gesture::Continuing, gesture2.state, TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture2.rotation.radian, TEST_LOCATION); - DALI_TEST_EQUALS(DevelGesture::Rotation, static_cast< DevelGesture::Type >( gesture2.type ), TEST_LOCATION); + DALI_TEST_EQUALS(Gesture::Rotation, gesture2.type, TEST_LOCATION); gesture2.rotation.radian = 3.0f; gesture = gesture2; DALI_TEST_EQUALS(Gesture::Continuing, gesture.state, TEST_LOCATION); DALI_TEST_EQUALS(3.0f, gesture.rotation.radian, TEST_LOCATION); - DALI_TEST_EQUALS(DevelGesture::Rotation, static_cast< DevelGesture::Type >( gesture.type ), TEST_LOCATION); + DALI_TEST_EQUALS(Gesture::Rotation, gesture.type, TEST_LOCATION); END_TEST; } @@ -92,7 +90,7 @@ int UtcDaliRotationGestureDynamicAllocation(void) RotationGesture* gesture = new RotationGesture( Gesture::Started ); DALI_TEST_EQUALS(Gesture::Started, gesture->state, TEST_LOCATION); DALI_TEST_EQUALS(0.0f, gesture->rotation.radian, TEST_LOCATION); - DALI_TEST_EQUALS(DevelGesture::Rotation, static_cast< DevelGesture::Type >( gesture->type ), TEST_LOCATION); + DALI_TEST_EQUALS(Gesture::Rotation, gesture->type, TEST_LOCATION); delete gesture; END_TEST; diff --git a/automated-tests/src/dali/utc-Dali-RotationGestureDetector.cpp b/automated-tests/src/dali/utc-Dali-RotationGestureDetector.cpp index 7c50017..48fa876 100644 --- a/automated-tests/src/dali/utc-Dali-RotationGestureDetector.cpp +++ b/automated-tests/src/dali/utc-Dali-RotationGestureDetector.cpp @@ -21,9 +21,6 @@ #include #include #include -#include -#include -#include #include #include diff --git a/automated-tests/src/dali/utc-Dali-RotationGestureRecognizer.cpp b/automated-tests/src/dali/utc-Dali-RotationGestureRecognizer.cpp index dd92e00..85ba2e3 100644 --- a/automated-tests/src/dali/utc-Dali-RotationGestureRecognizer.cpp +++ b/automated-tests/src/dali/utc-Dali-RotationGestureRecognizer.cpp @@ -21,8 +21,6 @@ #include #include #include -#include -#include #include diff --git a/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp b/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp index f6ca243..54685ee 100644 --- a/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp +++ b/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp @@ -23,7 +23,6 @@ #include #include #include -#include using namespace Dali; diff --git a/dali/devel-api/events/gesture-devel.h b/dali/devel-api/events/gesture-devel.h deleted file mode 100644 index 45ca3df..0000000 --- a/dali/devel-api/events/gesture-devel.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef DALI_GESTURE_DEVEL_H -#define DALI_GESTURE_DEVEL_H - -/* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0 - * - * 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. - * - */ - -#include - -namespace Dali -{ - -namespace DevelGesture -{ - -/** - * @copydoc Dali::Gesture::Type - */ -enum Type -{ - Pinch = Gesture::Pinch, - Pan = Gesture::Pan, - Tap = Gesture::Tap, - LongPress = Gesture::LongPress, - - // Devel Gesture Types - Rotation = 1 << 4, ///< When the user rotates two fingers around a particular ares of the screen. -}; - -} // namespace DevelGesture - -} // namespace Dali - -#endif // DALI_GESTURE_DEVEL_H diff --git a/dali/devel-api/file.list b/dali/devel-api/file.list index f93c67e..5ae82c1 100644 --- a/dali/devel-api/file.list +++ b/dali/devel-api/file.list @@ -15,8 +15,6 @@ SET( devel_api_src_files ${devel_api_src_dir}/common/stage.cpp ${devel_api_src_dir}/events/hit-test-algorithm.cpp ${devel_api_src_dir}/events/long-press-gesture-detector-devel.cpp - ${devel_api_src_dir}/events/rotation-gesture.cpp - ${devel_api_src_dir}/events/rotation-gesture-detector.cpp ${devel_api_src_dir}/events/key-event-devel.cpp ${devel_api_src_dir}/events/wheel-event-devel.cpp ${devel_api_src_dir}/images/distance-field.cpp @@ -71,11 +69,8 @@ SET( devel_api_core_common_header_files SET( devel_api_core_events_header_files - ${devel_api_src_dir}/events/gesture-devel.h ${devel_api_src_dir}/events/hit-test-algorithm.h ${devel_api_src_dir}/events/long-press-gesture-detector-devel.h - ${devel_api_src_dir}/events/rotation-gesture.h - ${devel_api_src_dir}/events/rotation-gesture-detector.h ${devel_api_src_dir}/events/key-event-devel.h ${devel_api_src_dir}/events/wheel-event-devel.h ) diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp old mode 100755 new mode 100644 index 30cdbd8..91f19d9 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -1817,7 +1817,7 @@ ActorGestureData& Actor::GetGestureData() return *mGestureData; } -bool Actor::IsGestureRequred( DevelGesture::Type type ) const +bool Actor::IsGestureRequred( Gesture::Type type ) const { return mGestureData && mGestureData->IsGestureRequred( type ); } diff --git a/dali/internal/event/actors/actor-impl.h b/dali/internal/event/actors/actor-impl.h index e34b5c5..4b65bb6 100644 --- a/dali/internal/event/actors/actor-impl.h +++ b/dali/internal/event/actors/actor-impl.h @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -1400,7 +1399,7 @@ public: * @param[in] type The gesture type. * @return True if the gesture is required, false otherwise. */ - bool IsGestureRequred( DevelGesture::Type type ) const; + bool IsGestureRequred( Gesture::Type type ) const; // Signals diff --git a/dali/internal/event/events/actor-gesture-data.cpp b/dali/internal/event/events/actor-gesture-data.cpp index a6efbf0..1967bac 100644 --- a/dali/internal/event/events/actor-gesture-data.cpp +++ b/dali/internal/event/events/actor-gesture-data.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ namespace Internal { ActorGestureData::ActorGestureData() -: gesturesRequired( DevelGesture::Type( 0 ) ), +: gesturesRequired( Gesture::Type( 0 ) ), panDetectors( nullptr ), pinchDetectors( nullptr ), longPressDetectors( nullptr ), @@ -45,7 +45,7 @@ ActorGestureData::~ActorGestureData() void ActorGestureData::AddGestureDetector( GestureDetector& detector ) { - const DevelGesture::Type type( detector.GetType() ); + const Gesture::Type type( detector.GetType() ); GestureDetectorContainer*& containerPtr( GetContainerPtr( type ) ); if ( NULL == containerPtr ) @@ -54,12 +54,12 @@ void ActorGestureData::AddGestureDetector( GestureDetector& detector ) } containerPtr->push_back( &detector ); - gesturesRequired = DevelGesture::Type( gesturesRequired | type ); + gesturesRequired = Gesture::Type( gesturesRequired | type ); } void ActorGestureData::RemoveGestureDetector( GestureDetector& detector ) { - const DevelGesture::Type type( detector.GetType() ); + const Gesture::Type type( detector.GetType() ); GestureDetectorContainer*& containerPtr( GetContainerPtr( type ) ); DALI_ASSERT_DEBUG( containerPtr && "Container had not been created" ); @@ -71,42 +71,42 @@ void ActorGestureData::RemoveGestureDetector( GestureDetector& detector ) if ( container.empty() ) { - gesturesRequired = DevelGesture::Type( gesturesRequired & ~type ); + gesturesRequired = Gesture::Type( gesturesRequired & ~type ); delete containerPtr; containerPtr = NULL; } } -GestureDetectorContainer& ActorGestureData::GetGestureDetectorContainer( DevelGesture::Type type ) +GestureDetectorContainer& ActorGestureData::GetGestureDetectorContainer( Gesture::Type type ) { return *GetContainerPtr( type ); } -GestureDetectorContainer*& ActorGestureData::GetContainerPtr( DevelGesture::Type type ) +GestureDetectorContainer*& ActorGestureData::GetContainerPtr( Gesture::Type type ) { switch ( type ) { - case DevelGesture::Pan: + case Gesture::Pan: { return panDetectors; } - case DevelGesture::Pinch: + case Gesture::Pinch: { return pinchDetectors; } - case DevelGesture::LongPress: + case Gesture::LongPress: { return longPressDetectors; } - case DevelGesture::Tap: + case Gesture::Tap: { return tapDetectors; } - case DevelGesture::Rotation: + case Gesture::Rotation: { return rotationDetectors; } diff --git a/dali/internal/event/events/actor-gesture-data.h b/dali/internal/event/events/actor-gesture-data.h index 8412e54..55cfb99 100644 --- a/dali/internal/event/events/actor-gesture-data.h +++ b/dali/internal/event/events/actor-gesture-data.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_ACTOR_GESTURE_DATA_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ */ // INTERNAL INCLUDES -#include #include namespace Dali @@ -67,7 +66,7 @@ public: * @param[in] type The gesture type. * @return true if the gesture is required, false otherwise. */ - inline bool IsGestureRequred( DevelGesture::Type type ) const + inline bool IsGestureRequred( Gesture::Type type ) const { return type & gesturesRequired; } @@ -77,7 +76,7 @@ public: * @param[in] type The container type required * @pre Ensure IsGestureRequired() is used to check if the container is actually available. */ - GestureDetectorContainer& GetGestureDetectorContainer( DevelGesture::Type type ); + GestureDetectorContainer& GetGestureDetectorContainer( Gesture::Type type ); private: @@ -85,11 +84,11 @@ private: * Helper to retrieve the appropriate container type. * @param[in] type The container type required. */ - inline GestureDetectorContainer*& GetContainerPtr( DevelGesture::Type type ); + inline GestureDetectorContainer*& GetContainerPtr( Gesture::Type type ); private: - DevelGesture::Type gesturesRequired; ///< Stores which gestures are required + Gesture::Type gesturesRequired; ///< Stores which gestures are required GestureDetectorContainer* panDetectors; ///< Pointer to a container of pan-detectors GestureDetectorContainer* pinchDetectors; ///< Pointer to a container of pinch-detectors diff --git a/dali/internal/event/events/gesture-detector-impl.cpp b/dali/internal/event/events/gesture-detector-impl.cpp index c75d497..8d84221 100644 --- a/dali/internal/event/events/gesture-detector-impl.cpp +++ b/dali/internal/event/events/gesture-detector-impl.cpp @@ -34,18 +34,13 @@ namespace Dali namespace Internal { -GestureDetector::GestureDetector( DevelGesture::Type type, const SceneGraph::PropertyOwner* sceneObject ) +GestureDetector::GestureDetector( Gesture::Type type, const SceneGraph::PropertyOwner* sceneObject ) : Object( sceneObject ), mType( type ), mGestureEventProcessor( ThreadLocalStorage::Get().GetGestureEventProcessor() ) { } -GestureDetector::GestureDetector( Gesture::Type type, const SceneGraph::PropertyOwner* sceneObject ) -: GestureDetector( static_cast< DevelGesture::Type >( type ), sceneObject ) -{ -} - GestureDetector::~GestureDetector() { if ( !mPendingAttachActors.empty() ) diff --git a/dali/internal/event/events/gesture-detector-impl.h b/dali/internal/event/events/gesture-detector-impl.h index 7cb0ffe..ba8e71f 100644 --- a/dali/internal/event/events/gesture-detector-impl.h +++ b/dali/internal/event/events/gesture-detector-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_GESTURE_DETECTOR_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -98,7 +98,7 @@ public: * Retrieves the type of GestureDetector * @return The GestureDetector Type */ - DevelGesture::Type GetType() const + Gesture::Type GetType() const { return mType; } @@ -118,11 +118,6 @@ protected: // Creation & Destruction * @param pointer to the scene object, nullptr if none * by default GestureDetectors don't have our own scene object */ - GestureDetector( DevelGesture::Type type, const SceneGraph::PropertyOwner* sceneObject = nullptr ); - - /** - * @copydoc GestureDetector( DevelGesture::Type, const SceneGraph::PropertyOwner* ) - */ GestureDetector( Gesture::Type type, const SceneGraph::PropertyOwner* sceneObject = nullptr ); /** @@ -174,7 +169,7 @@ private: protected: - DevelGesture::Type mType; ///< The gesture detector will detect this type of gesture. + Gesture::Type mType; ///< The gesture detector will detect this type of gesture. GestureDetectorActorContainer mAttachedActors; ///< Object::Observer is used to provide weak-pointer behaviour GestureDetectorActorContainer mPendingAttachActors; ///< Object::Observer is used to provide weak-pointer behaviour GestureEventProcessor& mGestureEventProcessor; ///< A reference to the gesture event processor. diff --git a/dali/internal/event/events/gesture-event-processor.cpp b/dali/internal/event/events/gesture-event-processor.cpp index 63617b6..e6eb904 100644 --- a/dali/internal/event/events/gesture-event-processor.cpp +++ b/dali/internal/event/events/gesture-event-processor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -65,35 +65,35 @@ void GestureEventProcessor::AddGestureDetector(GestureDetector* gestureDetector, { switch (gestureDetector->GetType()) { - case DevelGesture::LongPress: + case Gesture::LongPress: { LongPressGestureDetector* longPress = static_cast(gestureDetector); mLongPressGestureProcessor.AddGestureDetector(longPress, scene); break; } - case DevelGesture::Pan: + case Gesture::Pan: { PanGestureDetector* pan = static_cast(gestureDetector); mPanGestureProcessor.AddGestureDetector(pan, scene, envOptionMinimumPanDistance, envOptionMinimumPanEvents); break; } - case DevelGesture::Pinch: + case Gesture::Pinch: { PinchGestureDetector* pinch = static_cast(gestureDetector); mPinchGestureProcessor.AddGestureDetector(pinch, scene); break; } - case DevelGesture::Tap: + case Gesture::Tap: { TapGestureDetector* tap = static_cast(gestureDetector); mTapGestureProcessor.AddGestureDetector(tap, scene); break; } - case DevelGesture::Rotation: + case Gesture::Rotation: { RotationGestureDetector* rotation = static_cast(gestureDetector); mRotationGestureProcessor.AddGestureDetector(rotation, scene); @@ -106,35 +106,35 @@ void GestureEventProcessor::RemoveGestureDetector(GestureDetector* gestureDetect { switch (gestureDetector->GetType()) { - case DevelGesture::LongPress: + case Gesture::LongPress: { LongPressGestureDetector* longPress = static_cast(gestureDetector); mLongPressGestureProcessor.RemoveGestureDetector(longPress); break; } - case DevelGesture::Pan: + case Gesture::Pan: { PanGestureDetector* pan = static_cast(gestureDetector); mPanGestureProcessor.RemoveGestureDetector(pan); break; } - case DevelGesture::Pinch: + case Gesture::Pinch: { PinchGestureDetector* pinch = static_cast(gestureDetector); mPinchGestureProcessor.RemoveGestureDetector(pinch); break; } - case DevelGesture::Tap: + case Gesture::Tap: { TapGestureDetector* tap = static_cast(gestureDetector); mTapGestureProcessor.RemoveGestureDetector(tap); break; } - case DevelGesture::Rotation: + case Gesture::Rotation: { RotationGestureDetector* rotation = static_cast(gestureDetector); mRotationGestureProcessor.RemoveGestureDetector(rotation); @@ -147,35 +147,35 @@ void GestureEventProcessor::GestureDetectorUpdated(GestureDetector* gestureDetec { switch (gestureDetector->GetType()) { - case DevelGesture::LongPress: + case Gesture::LongPress: { LongPressGestureDetector* longPress = static_cast(gestureDetector); mLongPressGestureProcessor.GestureDetectorUpdated(longPress); break; } - case DevelGesture::Pan: + case Gesture::Pan: { PanGestureDetector* pan = static_cast(gestureDetector); mPanGestureProcessor.GestureDetectorUpdated(pan); break; } - case DevelGesture::Pinch: + case Gesture::Pinch: { PinchGestureDetector* pinch = static_cast(gestureDetector); mPinchGestureProcessor.GestureDetectorUpdated(pinch); break; } - case DevelGesture::Tap: + case Gesture::Tap: { TapGestureDetector* tap = static_cast(gestureDetector); mTapGestureProcessor.GestureDetectorUpdated(tap); break; } - case DevelGesture::Rotation: + case Gesture::Rotation: { // Nothing to do break; @@ -185,28 +185,10 @@ void GestureEventProcessor::GestureDetectorUpdated(GestureDetector* gestureDetec void GestureEventProcessor::SetGestureProperties( const Gesture& gesture ) { - bool requestUpdate = false; + DALI_ASSERT_DEBUG( gesture.type == Gesture::Pan && "Only PanGesture has a scene object\n" ); - switch ( static_cast< DevelGesture::Type >( gesture.type ) ) - { - case DevelGesture::Pan: - { - const PanGesture& pan = static_cast< const PanGesture& >( gesture ); - requestUpdate = mPanGestureProcessor.SetPanGestureProperties( pan ); - break; - } - - 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; - } - } - - if( requestUpdate ) + const PanGesture& pan = static_cast< const PanGesture& >( gesture ); + if( mPanGestureProcessor.SetPanGestureProperties( pan ) ) { // We may not be updating so we need to ask the render controller for an update. mRenderController.RequestUpdate( false ); diff --git a/dali/internal/event/events/gesture-event.cpp b/dali/internal/event/events/gesture-event.cpp index f42e514..571c28d 100644 --- a/dali/internal/event/events/gesture-event.cpp +++ b/dali/internal/event/events/gesture-event.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,17 +28,12 @@ GestureEvent::~GestureEvent() { } -GestureEvent::GestureEvent( DevelGesture::Type gesture, Gesture::State gestureState ) +GestureEvent::GestureEvent( Gesture::Type gesture, Gesture::State gestureState ) : gestureType( gesture ), state( gestureState ), time( 0 ) { } - -GestureEvent::GestureEvent(Gesture::Type gesture, Gesture::State gestureState) -: GestureEvent( static_cast< DevelGesture::Type >( gesture ), gestureState ) -{ -} } // namespace Internal } // namespace Dali diff --git a/dali/internal/event/events/gesture-event.h b/dali/internal/event/events/gesture-event.h index cb4dd77..952fbad 100644 --- a/dali/internal/event/events/gesture-event.h +++ b/dali/internal/event/events/gesture-event.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_EVENT_GESTURE_EVENT_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ // INTERNAL INCLUDES #include -#include #include namespace Dali @@ -47,7 +46,7 @@ struct GestureEvent /** * Gesture Type. */ - DevelGesture::Type gestureType; + Gesture::Type gestureType; /** * The state of the gesture. @@ -66,12 +65,7 @@ protected: // Constructors only to be used by derived structures. * @param[in] gesture The type of gesture event. * @param[in] gestureState The state of the gesture event. */ - GestureEvent( DevelGesture::Type gesture, Gesture::State gestureState); - - /** - * @copydoc GestureEvent( DevelGesture::Type, Gesture::State ) - */ - GestureEvent( Gesture::Type gesture, Gesture::State gestureState ); + GestureEvent( Gesture::Type gesture, Gesture::State gestureState); }; } // namespace Internal diff --git a/dali/internal/event/events/gesture-processor.cpp b/dali/internal/event/events/gesture-processor.cpp index c294c54..f18671b 100644 --- a/dali/internal/event/events/gesture-processor.cpp +++ b/dali/internal/event/events/gesture-processor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,13 +41,8 @@ namespace */ struct GestureHitTestCheck : public HitTestAlgorithm::HitTestInterface { - GestureHitTestCheck( DevelGesture::Type type ) - : mType( type ) - { - } - GestureHitTestCheck( Gesture::Type type ) - : GestureHitTestCheck( static_cast< DevelGesture::Type >( type ) ) + : mType( type ) { } @@ -68,13 +63,13 @@ struct GestureHitTestCheck : public HitTestAlgorithm::HitTestInterface return layer->IsTouchConsumed(); } - DevelGesture::Type mType; + Gesture::Type mType; }; } // unnamed namespace -GestureProcessor::GestureProcessor( DevelGesture::Type type ) +GestureProcessor::GestureProcessor( Gesture::Type type ) : mGestureRecognizer(), mNeedsUpdate( false ), mType( type ), @@ -83,12 +78,6 @@ GestureProcessor::GestureProcessor( DevelGesture::Type type ) { } -GestureProcessor::GestureProcessor( Gesture::Type type ) -: GestureProcessor( static_cast< DevelGesture::Type >( type ) ) -{ -} - - GestureProcessor::~GestureProcessor() { ResetActor(); diff --git a/dali/internal/event/events/gesture-processor.h b/dali/internal/event/events/gesture-processor.h index ed430df..47e5dab 100644 --- a/dali/internal/event/events/gesture-processor.h +++ b/dali/internal/event/events/gesture-processor.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_GESTURE_PROCESSOR_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ */ // INTERNAL INCLUDES -#include #include #include #include @@ -65,11 +64,6 @@ protected: /** * Protected constructor. Cannot create an instance of GestureProcessor */ - GestureProcessor( DevelGesture::Type type ); - - /** - * Protected constructor. Cannot create an instance of GestureProcessor - */ GestureProcessor( Gesture::Type type ); /** @@ -196,7 +190,7 @@ protected: //Data private: // Data - DevelGesture::Type mType; ///< Type of GestureProcessor + Gesture::Type mType; ///< Type of GestureProcessor Actor* mCurrentGesturedActor; ///< The current actor that has been gestured. bool mGesturedActorDisconnected:1; ///< Indicates whether the gestured actor has been disconnected from the scene }; diff --git a/dali/internal/event/events/gesture-recognizer.h b/dali/internal/event/events/gesture-recognizer.h index 8505191..d616647 100644 --- a/dali/internal/event/events/gesture-recognizer.h +++ b/dali/internal/event/events/gesture-recognizer.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_GESTURE_RECOGNIZER_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,6 @@ #include #include #include -#include #include namespace Dali @@ -76,7 +75,7 @@ public: * Returns the type of gesture detector. * @return Type of gesture detector. */ - DevelGesture::Type GetType() const { return mType; } + Gesture::Type GetType() const { return mType; } /** * Called when we get a touch event. @@ -96,7 +95,7 @@ protected: * @param[in] screenSize The size of the screen. * @param[in] detectorType The type of gesture detector. */ - GestureRecognizer( Vector2 screenSize, DevelGesture::Type detectorType ) + GestureRecognizer( Vector2 screenSize, Gesture::Type detectorType ) : mScreenSize( screenSize ), mType( detectorType ), mScene( nullptr ) @@ -104,20 +103,12 @@ protected: } /** - * copydoc GestureRecognizer( Vector2, DevelGesture::Type ) - */ - GestureRecognizer( Vector2 screenSize, Gesture::Type detectorType ) - : GestureRecognizer( screenSize, static_cast< DevelGesture::Type >( detectorType ) ) - { - } - - /** * Protected Constructor. Should only be able to create derived class objects. * * Use this constructor with the screen size is not used in the dereived class. * @param[in] detectorType The type of gesture detector. */ - GestureRecognizer( DevelGesture::Type detectorType ) + GestureRecognizer( Gesture::Type detectorType ) : GestureRecognizer( Vector2::ZERO, detectorType ) { } @@ -129,7 +120,7 @@ protected: protected: Vector2 mScreenSize; - DevelGesture::Type mType; + Gesture::Type mType; Scene* mScene; }; diff --git a/dali/internal/event/events/gesture-requests.h b/dali/internal/event/events/gesture-requests.h index 06a41bc..85fbf68 100644 --- a/dali/internal/event/events/gesture-requests.h +++ b/dali/internal/event/events/gesture-requests.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_GESTURE_REQUESTS_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ // INTERNAL INCLUDES #include -#include namespace Dali { @@ -39,16 +38,8 @@ struct GestureRequest * Default Constructor * @param[in] typeRequired The gesture type required */ - GestureRequest( DevelGesture::Type typeRequired ) - : type( typeRequired ) - { - } - - /** - * @copydoc GestureRequest( DevelGesture::Type ) - */ GestureRequest( Gesture::Type typeRequired ) - : GestureRequest( static_cast< DevelGesture::Type >( typeRequired ) ) + : type( typeRequired ) { } @@ -59,7 +50,7 @@ struct GestureRequest // Data Members - DevelGesture::Type type; ///< The type of gesture required. + Gesture::Type type; ///< The type of gesture required. }; /** diff --git a/dali/internal/event/events/rotation-gesture/rotation-gesture-detector-impl.cpp b/dali/internal/event/events/rotation-gesture/rotation-gesture-detector-impl.cpp index 6b75613..debf1d0 100644 --- a/dali/internal/event/events/rotation-gesture/rotation-gesture-detector-impl.cpp +++ b/dali/internal/event/events/rotation-gesture/rotation-gesture-detector-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,11 +22,10 @@ #include // for strcmp // INTERNAL INCLUDES +#include #include -#include #include #include -#include namespace Dali { @@ -59,7 +58,7 @@ RotationGestureDetectorPtr RotationGestureDetector::New() } RotationGestureDetector::RotationGestureDetector() -: GestureDetector( DevelGesture::Rotation ) +: GestureDetector( Gesture::Rotation ) { } diff --git a/dali/internal/event/events/rotation-gesture/rotation-gesture-detector-impl.h b/dali/internal/event/events/rotation-gesture/rotation-gesture-detector-impl.h index becfe0f..8af877a 100644 --- a/dali/internal/event/events/rotation-gesture/rotation-gesture-detector-impl.h +++ b/dali/internal/event/events/rotation-gesture/rotation-gesture-detector-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_ROTATION_GESTURE_DETECTOR_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,8 +19,8 @@ */ // INTERNAL INCLUDES +#include #include -#include namespace Dali { diff --git a/dali/internal/event/events/rotation-gesture/rotation-gesture-event.h b/dali/internal/event/events/rotation-gesture/rotation-gesture-event.h index 38b83cd..436c7cd 100644 --- a/dali/internal/event/events/rotation-gesture/rotation-gesture-event.h +++ b/dali/internal/event/events/rotation-gesture/rotation-gesture-event.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_EVENT_ROTATION_GESTURE_EVENT_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ // INTERNAL INCLUDES #include #include -#include #include namespace Dali @@ -48,7 +47,7 @@ struct RotationGestureEvent : public GestureEvent * @param[in] state The state of the gesture */ RotationGestureEvent( Gesture::State state ) - : GestureEvent( DevelGesture::Rotation, state ) + : GestureEvent( Gesture::Rotation, state ) { } diff --git a/dali/internal/event/events/rotation-gesture/rotation-gesture-processor.cpp b/dali/internal/event/events/rotation-gesture/rotation-gesture-processor.cpp index 9c26faa..45a7719 100644 --- a/dali/internal/event/events/rotation-gesture/rotation-gesture-processor.cpp +++ b/dali/internal/event/events/rotation-gesture/rotation-gesture-processor.cpp @@ -23,15 +23,14 @@ // INTERNAL INCLUDES #include +#include #include -#include #include #include #include #include #include #include -#include namespace Dali { @@ -102,7 +101,7 @@ struct IsNotAttachedFunctor } // unnamed namespace RotationGestureProcessor::RotationGestureProcessor() -: GestureProcessor( DevelGesture::Rotation ), +: GestureProcessor( Gesture::Rotation ), mRotationGestureDetectors(), mCurrentRotationEmitters(), mCurrentRotationEvent( nullptr ), diff --git a/dali/internal/event/events/rotation-gesture/rotation-gesture-recognizer.cpp b/dali/internal/event/events/rotation-gesture/rotation-gesture-recognizer.cpp index 6de3490..2873612 100644 --- a/dali/internal/event/events/rotation-gesture/rotation-gesture-recognizer.cpp +++ b/dali/internal/event/events/rotation-gesture/rotation-gesture-recognizer.cpp @@ -24,7 +24,6 @@ // INTERNAL INCLUDES #include #include -#include #include #include #include @@ -56,7 +55,7 @@ inline Vector2 GetCenterPoint( const Integration::Point& point1, const Integrati } // unnamed namespace RotationGestureRecognizer::RotationGestureRecognizer( Observer& observer, uint32_t minimumTouchEvents, uint32_t minimumTouchEventsAfterStart ) -: GestureRecognizer( DevelGesture::Rotation ), +: GestureRecognizer( Gesture::Rotation ), mObserver( observer ), mState( Clear ), mTouchEvents(), diff --git a/dali/public-api/dali-core.h b/dali/public-api/dali-core.h index 7c8af2b..a53cb12 100644 --- a/dali/public-api/dali-core.h +++ b/dali/public-api/dali-core.h @@ -56,6 +56,8 @@ #include #include #include +#include +#include #include #include #include diff --git a/dali/public-api/events/gesture.h b/dali/public-api/events/gesture.h index 0dcdc14..0e9a6ff 100644 --- a/dali/public-api/events/gesture.h +++ b/dali/public-api/events/gesture.h @@ -2,7 +2,7 @@ #define DALI_GESTURE_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,7 +80,8 @@ struct DALI_CORE_API Gesture Pinch = 1 << 0, ///< When two touch points move away or towards each other. @SINCE_1_0.0 Pan = 1 << 1, ///< When the user drags their finger(s) in a particular direction. @SINCE_1_0.0 Tap = 1 << 2, ///< When the user taps the screen. @SINCE_1_0.0 - LongPress = 1 << 3 ///< When the user continues to touch the same area on the screen for the device configured time. @SINCE_1_0.0 + LongPress = 1 << 3, ///< When the user continues to touch the same area on the screen for the device configured time. @SINCE_1_0.0 + Rotation = 1 << 4, ///< When the user rotates two fingers around a particular ares of the screen. @SINCE_1_9.27 }; /** diff --git a/dali/devel-api/events/rotation-gesture-detector.cpp b/dali/public-api/events/rotation-gesture-detector.cpp similarity index 94% rename from dali/devel-api/events/rotation-gesture-detector.cpp rename to dali/public-api/events/rotation-gesture-detector.cpp index 16f007e..f174867 100644 --- a/dali/devel-api/events/rotation-gesture-detector.cpp +++ b/dali/public-api/events/rotation-gesture-detector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include +#include // INTERNAL INCLUDES #include diff --git a/dali/devel-api/events/rotation-gesture-detector.h b/dali/public-api/events/rotation-gesture-detector.h similarity index 94% rename from dali/devel-api/events/rotation-gesture-detector.h rename to dali/public-api/events/rotation-gesture-detector.h index 837110a..eab0de2 100644 --- a/dali/devel-api/events/rotation-gesture-detector.h +++ b/dali/public-api/events/rotation-gesture-detector.h @@ -2,7 +2,7 @@ #define DALI_ROTATION_GESTURE_DETECTOR_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,6 +51,8 @@ struct RotationGesture; * | %Signal Name | Method | * |-------------------|-----------------------| * | rotationDetected | @ref DetectedSignal() | + * + * @SINCE_1_9.27 */ class DALI_CORE_API RotationGestureDetector : public GestureDetector { @@ -66,6 +68,7 @@ public: // Creation & Destruction /** * @brief Creates an uninitialized RotationGestureDetector; this can be initialized with RotationGestureDetector::New(). * + * @SINCE_1_9.27 * Calling member functions with an uninitialized RotationGestureDetector handle is not allowed. */ RotationGestureDetector(); @@ -73,6 +76,7 @@ public: // Creation & Destruction /** * @brief Creates an initialized RotationGestureDetector. * + * @SINCE_1_9.27 * @return A handle to a newly allocated Dali resource */ static RotationGestureDetector New(); @@ -80,6 +84,7 @@ public: // Creation & Destruction /** * @brief Downcasts a handle to RotationGestureDetector handle. * + * @SINCE_1_9.27 * If handle points to a RotationGestureDetector object, the * downcast produces valid handle. If not, the returned handle is left uninitialized. * @param[in] handle Handle to an object @@ -90,6 +95,7 @@ public: // Creation & Destruction /** * @brief Destructor. * + * @SINCE_1_9.27 * This is non-virtual since derived Handle types must not contain data or virtual methods. */ ~RotationGestureDetector(); @@ -97,6 +103,7 @@ public: // Creation & Destruction /** * @brief This copy constructor is required for (smart) pointer semantics. * + * @SINCE_1_9.27 * @param[in] handle A reference to the copied handle */ RotationGestureDetector(const RotationGestureDetector& handle); @@ -104,6 +111,7 @@ public: // Creation & Destruction /** * @brief This assignment operator is required for (smart) pointer semantics. * + * @SINCE_1_9.27 * @param[in] rhs A reference to the copied handle * @return A reference to this */ @@ -118,6 +126,7 @@ public: // Signals * @code * void YourCallbackName( Actor actor, const RotationGesture& gesture ); * @endcode + * @SINCE_1_9.27 * @return The signal to connect to * @pre The gesture detector has been initialized. */ @@ -129,6 +138,7 @@ public: // Not intended for Application developers /** * @brief This constructor is used by RotationGestureDetector::New() methods. * + * @SINCE_1_9.27 * @param[in] internal A pointer to a newly allocated Dali resource */ explicit DALI_INTERNAL RotationGestureDetector(Internal::RotationGestureDetector* internal); diff --git a/dali/devel-api/events/rotation-gesture.cpp b/dali/public-api/events/rotation-gesture.cpp similarity index 84% rename from dali/devel-api/events/rotation-gesture.cpp rename to dali/public-api/events/rotation-gesture.cpp index 05b1258..03d6d81 100644 --- a/dali/devel-api/events/rotation-gesture.cpp +++ b/dali/public-api/events/rotation-gesture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,17 +16,16 @@ */ // CLASS HEADER -#include +#include // INTERNAL INCLUDES #include -#include namespace Dali { RotationGesture::RotationGesture( Gesture::State state ) -: Gesture( static_cast< Gesture::Type >( DevelGesture::Rotation ), state ) +: Gesture( Gesture::Rotation, state ) { } diff --git a/dali/devel-api/events/rotation-gesture.h b/dali/public-api/events/rotation-gesture.h similarity index 92% rename from dali/devel-api/events/rotation-gesture.h rename to dali/public-api/events/rotation-gesture.h index 5f3e2f8..fa3894f 100644 --- a/dali/devel-api/events/rotation-gesture.h +++ b/dali/public-api/events/rotation-gesture.h @@ -2,7 +2,7 @@ #define DALI_ROTATION_GESTURE_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,6 +37,7 @@ namespace Dali * * A rotation gesture will continue to be sent to the actor under the center point of the rotation * until the rotation ends. + * @SINCE_1_9.27 */ struct DALI_CORE_API RotationGesture: public Gesture { @@ -44,19 +45,21 @@ struct DALI_CORE_API RotationGesture: public Gesture /** * @brief Default Constructor. - * + * @SINCE_1_9.27 * @param[in] state The state of the gesture */ RotationGesture( Gesture::State state ); /** * @brief Copy constructor. + * @SINCE_1_9.27 * @param[in] rhs A reference to the copied handle */ RotationGesture( const RotationGesture& rhs ); /** * @brief Assignment operator. + * @SINCE_1_9.27 * @param[in] rhs A reference to the copied handle * @return A reference to this */ @@ -64,6 +67,7 @@ struct DALI_CORE_API RotationGesture: public Gesture /** * @brief Virtual destructor. + * @SINCE_1_9.27 */ virtual ~RotationGesture(); @@ -71,16 +75,19 @@ struct DALI_CORE_API RotationGesture: public Gesture /** * @brief The overall rotation from the start of the rotation gesture till the latest rotation gesture. + * @SINCE_1_9.27 */ Radian rotation; /** * @brief The center point of the two points that caused the rotation gesture in screen coordinates. + * @SINCE_1_9.27 */ Vector2 screenCenterPoint; /** * @brief The center point of the two points that caused the rotation gesture in local actor coordinates. + * @SINCE_1_9.27 */ Vector2 localCenterPoint; }; diff --git a/dali/public-api/file.list b/dali/public-api/file.list index 4b4d5b6..b24f3c5 100644 --- a/dali/public-api/file.list +++ b/dali/public-api/file.list @@ -31,6 +31,8 @@ SET( public_api_src_files ${public_api_src_dir}/events/pan-gesture-detector.cpp ${public_api_src_dir}/events/pinch-gesture.cpp ${public_api_src_dir}/events/pinch-gesture-detector.cpp + ${public_api_src_dir}/events/rotation-gesture.cpp + ${public_api_src_dir}/events/rotation-gesture-detector.cpp ${public_api_src_dir}/events/tap-gesture.cpp ${public_api_src_dir}/events/tap-gesture-detector.cpp ${public_api_src_dir}/events/touch-point.cpp @@ -143,6 +145,8 @@ SET( public_api_core_events_header_files ${public_api_src_dir}/events/pinch-gesture.h ${public_api_src_dir}/events/pinch-gesture-detector.h ${public_api_src_dir}/events/point-state.h + ${public_api_src_dir}/events/rotation-gesture.h + ${public_api_src_dir}/events/rotation-gesture-detector.h ${public_api_src_dir}/events/tap-gesture.h ${public_api_src_dir}/events/tap-gesture-detector.h ${public_api_src_dir}/events/touch-point.h