utc-Dali-Internal-Core.cpp
utc-Dali-Internal-FixedSizeMemoryPool.cpp
utc-Dali-Internal-FrustumCulling.cpp
+ utc-Dali-Internal-Gesture.cpp
utc-Dali-Internal-Handles.cpp
+ utc-Dali-Internal-LongPressGesture.cpp
utc-Dali-Internal-MemoryPoolObjectAllocator.cpp
utc-Dali-Internal-OwnerPointer.cpp
+ utc-Dali-Internal-PinchGesture.cpp
+ utc-Dali-Internal-PinchGestureProcessor.cpp
+ utc-Dali-Internal-RotationGesture.cpp
+ utc-Dali-Internal-TapGesture.cpp
+ utc-Dali-Internal-TapGestureProcessor.cpp
)
LIST(APPEND TC_SOURCES
--- /dev/null
+/*
+ * Copyright (c) 2014 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 <iostream>
+
+#include <stdlib.h>
+#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
+#include <dali/internal/event/events/gesture-impl.h>
+
+using namespace Dali;
+
+void utc_dali_internal_gesture_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_internal_gesture_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+
+// TestGesture Struct (Gesture constructor is protected)
+struct TestGesture : public Internal::Gesture
+{
+public:
+ TestGesture(GestureType::Value type, GestureState state)
+ : Gesture(type, state) {}
+
+ virtual ~TestGesture() {}
+};
+
+} // anon namespace
+
+int UtcDaliGestureConstructorP(void)
+{
+ TestApplication application; // Reset all test adapter return codes
+
+ Gesture empty;
+ DALI_TEST_CHECK( !empty );
+
+ Gesture pan( new TestGesture(GestureType::PAN, GestureState::STARTED) );
+ DALI_TEST_EQUALS(GestureType::PAN, pan.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, pan.GetState(), TEST_LOCATION);
+
+ Gesture pinch( new TestGesture(GestureType::PINCH, GestureState::CLEAR) );
+ DALI_TEST_EQUALS(GestureType::PINCH, pinch.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CLEAR, pinch.GetState(), TEST_LOCATION);
+
+ // Test copy constructor
+ Gesture pan2(pan);
+ DALI_TEST_EQUALS(GestureType::PAN, pan2.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, pan2.GetState(), TEST_LOCATION);
+ END_TEST;
+
+ // Test move constructor
+ const auto refCount = pan.GetObjectPtr()->ReferenceCount();
+ Gesture pan3( std::move( pan ) );
+ DALI_TEST_EQUALS(pan, Gesture(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::PAN, pan3.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(pan3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliGestureAssignmentP(void)
+{
+ TestApplication application; // Reset all test adapter return codes
+
+ // Test Assignment operator
+ Gesture pan( new TestGesture(GestureType::PAN, GestureState::FINISHED) );
+ DALI_TEST_EQUALS(GestureType::PAN, pan.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::FINISHED, pan.GetState(), TEST_LOCATION);
+
+ Gesture test( new TestGesture(GestureType::PINCH, GestureState::STARTED) );
+ DALI_TEST_EQUALS(GestureType::PINCH, test.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, test.GetState(), TEST_LOCATION);
+
+ // Copy assignment
+ test = pan;
+ DALI_TEST_EQUALS(GestureType::PAN, test.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::FINISHED, test.GetState(), TEST_LOCATION);
+
+ // Move assignment
+ const auto refCount = pan.GetObjectPtr()->ReferenceCount();
+ Gesture pan3;
+ DALI_TEST_EQUALS(pan3, Gesture(), TEST_LOCATION);
+ pan3 = std::move(pan);
+ DALI_TEST_EQUALS(pan, Gesture(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::PAN, pan3.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(pan3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliGestureGetTypeP(void)
+{
+ TestApplication application; // Reset all test adapter return codes
+
+ Gesture pan( new TestGesture(GestureType::PAN, GestureState::STARTED) );
+ DALI_TEST_EQUALS(GestureType::PAN, pan.GetType(), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliGestureGetStateP(void)
+{
+ TestApplication application; // Reset all test adapter return codes
+
+ Gesture pan( new TestGesture(GestureType::PAN, GestureState::STARTED) );
+ DALI_TEST_EQUALS(GestureState::STARTED, pan.GetState(), TEST_LOCATION);
+
+ GetImplementation(pan).SetState(GestureState::FINISHED);
+ DALI_TEST_EQUALS(GestureState::FINISHED, pan.GetState(), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliGestureGetTimeP(void)
+{
+ TestApplication application; // Reset all test adapter return codes
+
+ Gesture pan( new TestGesture(GestureType::PAN, GestureState::STARTED) );
+ DALI_TEST_EQUALS(0, pan.GetTime(), TEST_LOCATION);
+
+ GetImplementation(pan).SetTime(61282);
+ DALI_TEST_EQUALS(61282, pan.GetTime(), TEST_LOCATION);
+
+ END_TEST;
+}
+
--- /dev/null
+/*
+ * Copyright (c) 2014 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 <iostream>
+
+#include <stdlib.h>
+#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
+#include <dali/internal/event/events/long-press-gesture/long-press-gesture-impl.h>
+
+using namespace Dali;
+
+void utc_dali_internal_long_press_gesture_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_internal_long_press_gesture_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+int UtcDaliLongPressGestureConstructorP(void)
+{
+ TestApplication application;
+
+ LongPressGesture gesture(new Internal::LongPressGesture( GestureState::STARTED ));
+ DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::LONG_PRESS, gesture.GetType(), TEST_LOCATION);
+
+ // Test Copy constructor
+ GetImplementation( gesture ).SetNumberOfTouches( 5u );
+
+ LongPressGesture gesture2(gesture);
+ DALI_TEST_EQUALS(5u, gesture2.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::LONG_PRESS, gesture2.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, gesture2.GetState(), TEST_LOCATION);
+
+ // Test move constructor
+ const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
+ LongPressGesture gesture3( std::move( gesture ) );
+ DALI_TEST_EQUALS(gesture, LongPressGesture(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::LONG_PRESS, gesture3.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliLongPressGestureAssignmentP(void)
+{
+ // Test Assignment operator
+ LongPressGesture gesture(new Internal::LongPressGesture( GestureState::STARTED ));
+ DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::LONG_PRESS, gesture.GetType(), TEST_LOCATION);
+
+ GetImplementation( gesture ).SetNumberOfTouches( 5u );
+
+ LongPressGesture gesture2(new Internal::LongPressGesture( GestureState::FINISHED ));
+ DALI_TEST_EQUALS(GestureState::FINISHED, gesture2.GetState(), TEST_LOCATION);
+ gesture2 = gesture;
+ DALI_TEST_EQUALS(5u, gesture2.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::LONG_PRESS, gesture2.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, gesture2.GetState(), TEST_LOCATION);
+
+ // Move assignment
+ const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
+ LongPressGesture gesture3;
+ DALI_TEST_EQUALS(gesture3, Gesture(), TEST_LOCATION);
+ gesture3 = std::move(gesture);
+ DALI_TEST_EQUALS(gesture, Gesture(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::LONG_PRESS, gesture3.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliLongPressGestureGetNumberOfTouchesP(void)
+{
+ TestApplication application;
+
+ LongPressGesture gesture(new Internal::LongPressGesture(GestureState::STARTED));
+ DALI_TEST_EQUALS(gesture.GetNumberOfTouches(), 1, TEST_LOCATION);
+
+ GetImplementation(gesture).SetNumberOfTouches(4);
+ DALI_TEST_EQUALS(gesture.GetNumberOfTouches(), 4, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliLongPressGestureGetScreenPointP(void)
+{
+ TestApplication application;
+
+ LongPressGesture gesture(new Internal::LongPressGesture(GestureState::STARTED));
+ DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO , TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO , TEST_LOCATION);
+
+ GetImplementation(gesture).SetScreenPoint(Vector2(100.0f, 300.0f));
+ DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2(100.0f, 300.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO , TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliLongPressGestureGetLocalPointP(void)
+{
+ TestApplication application;
+
+ LongPressGesture gesture(new Internal::LongPressGesture(GestureState::STARTED));
+ DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO , TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO , TEST_LOCATION);
+
+ GetImplementation(gesture).SetLocalPoint(Vector2(100.0f, 300.0f));
+ DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2(100.0f, 300.0f), TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO , TEST_LOCATION);
+
+ END_TEST;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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 <iostream>
+
+#include <stdlib.h>
+#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
+#include <dali/internal/event/events/pinch-gesture/pinch-gesture-impl.h>
+
+using namespace Dali;
+
+void utc_dali_internal_pinch_gesture_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_internal_pinch_gesture_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+// Positive test case for a method
+int UtcDaliPinchGestureConstructor(void)
+{
+ TestApplication application; // Reset all test adapter return codes
+
+ PinchGesture gesture(new Internal::PinchGesture( GestureState::STARTED ));
+ DALI_TEST_EQUALS(GestureState::STARTED, gesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.0f, gesture.GetScale(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.0f, gesture.GetSpeed(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::PINCH, gesture.GetType(), TEST_LOCATION);
+
+ PinchGesture gesture2(new Internal::PinchGesture( GestureState::CONTINUING ));
+ DALI_TEST_EQUALS(GestureState::CONTINUING, gesture2.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.0f, gesture2.GetScale(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.0f, gesture2.GetSpeed(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::PINCH, gesture2.GetType(), TEST_LOCATION);
+
+ PinchGesture gesture3(new Internal::PinchGesture( GestureState::FINISHED ));
+ DALI_TEST_EQUALS(GestureState::FINISHED, gesture3.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.0f, gesture3.GetScale(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.0f, gesture3.GetSpeed(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::PINCH, gesture3.GetType(), TEST_LOCATION);
+
+ // Test copy constructor
+ GetImplementation( gesture3 ).SetScale( 3.0f );
+ GetImplementation( gesture3 ).SetSpeed( 5.0f );
+
+ PinchGesture pinch(gesture3);
+ DALI_TEST_EQUALS(GestureState::FINISHED, pinch.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(3.0f, pinch.GetScale(), TEST_LOCATION);
+ DALI_TEST_EQUALS(5.0f, pinch.GetSpeed(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::PINCH, pinch.GetType(), TEST_LOCATION);
+
+ // Test move constructor
+ const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
+ PinchGesture gesture4( std::move( gesture ) );
+ DALI_TEST_CHECK(!gesture);
+ DALI_TEST_EQUALS(GestureType::PINCH, gesture4.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture4.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliPinchGestureAssignment(void)
+{
+ // Test Assignment operator
+ PinchGesture gesture(new Internal::PinchGesture( GestureState::STARTED ));
+ DALI_TEST_EQUALS(GestureState::STARTED, gesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.0f, gesture.GetScale(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.0f, gesture.GetSpeed(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::PINCH, gesture.GetType(), TEST_LOCATION);
+
+ PinchGesture gesture2(new Internal::PinchGesture( GestureState::CONTINUING ));
+ DALI_TEST_EQUALS(GestureState::CONTINUING, gesture2.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.0f, gesture2.GetScale(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.0f, gesture2.GetSpeed(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::PINCH, gesture2.GetType(), TEST_LOCATION);
+
+ GetImplementation( gesture2 ).SetScale( 3.0f );
+ GetImplementation( gesture2 ).SetSpeed( 5.0f );
+
+ gesture = gesture2;
+ DALI_TEST_EQUALS(GestureState::CONTINUING, gesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(3.0f, gesture.GetScale(), TEST_LOCATION);
+ DALI_TEST_EQUALS(5.0f, gesture.GetSpeed(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::PINCH, gesture.GetType(), TEST_LOCATION);
+
+ // Move assignment
+ const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
+ PinchGesture gesture3;
+ DALI_TEST_EQUALS(gesture3, Gesture(), TEST_LOCATION);
+ gesture3 = std::move(gesture);
+ DALI_TEST_CHECK(!gesture);
+ DALI_TEST_EQUALS(GestureType::PINCH, gesture3.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliPinchGestureSetGetScaleP(void)
+{
+ PinchGesture gesture(new Internal::PinchGesture(GestureState::STARTED));
+ DALI_TEST_EQUALS(gesture.GetScale(), 0.0f, TEST_LOCATION);
+
+ GetImplementation(gesture).SetScale(123.0f);
+ DALI_TEST_EQUALS(gesture.GetScale(), 123.0f, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliPinchGestureSetGetSpeedP(void)
+{
+ PinchGesture gesture(new Internal::PinchGesture(GestureState::STARTED));
+ DALI_TEST_EQUALS(gesture.GetSpeed(), 0.0f, TEST_LOCATION);
+
+ GetImplementation(gesture).SetSpeed(123.0f);
+ DALI_TEST_EQUALS(gesture.GetSpeed(), 123.0f, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliPinchGestureSetGetScreenCenterPointP(void)
+{
+ PinchGesture gesture(new Internal::PinchGesture(GestureState::STARTED));
+ DALI_TEST_EQUALS(gesture.GetScreenCenterPoint(), Vector2::ZERO, TEST_LOCATION);
+
+ GetImplementation(gesture).SetScreenCenterPoint(Vector2(123.0f, 321.0f));
+ DALI_TEST_EQUALS(gesture.GetScreenCenterPoint(), Vector2(123.0f,321.0f), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliPinchGestureSetGetLocalCenterPointP(void)
+{
+ PinchGesture gesture(new Internal::PinchGesture(GestureState::STARTED));
+ DALI_TEST_EQUALS(gesture.GetLocalCenterPoint(), Vector2::ZERO, TEST_LOCATION);
+
+ GetImplementation(gesture).SetLocalCenterPoint(Vector2(123.0f,321.0f));
+ DALI_TEST_EQUALS(gesture.GetLocalCenterPoint(), Vector2(123.0f,321.0f), TEST_LOCATION);
+
+ END_TEST;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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 <iostream>
+
+#include <stdlib.h>
+#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
+#include <dali/internal/event/events/pinch-gesture/pinch-gesture-processor.h>
+#include <dali/internal/event/events/pinch-gesture/pinch-gesture-event.h>
+#include <dali/internal/event/common/scene-impl.h>
+
+using namespace Dali;
+
+void utc_dali_internal_pinch_gesture_processor_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_internal_pinch_gesture_processor_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+
+void TestAbortWithState(GestureState state)
+{
+ TestApplication application;
+
+ Internal::PinchGestureProcessor processor;
+ Integration::Scene scene( application.GetScene() );
+ Internal::Scene& sceneImpl = GetImplementation( scene );
+ Internal::PinchGestureEvent event(state);
+
+ try
+ {
+ processor.Process(sceneImpl, event);
+ DALI_TEST_CHECK( false ); // Should not get here as we expect an abort
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( true ); // We aborted, so the test has passed
+ }
+}
+
+} // anon namespace
+
+int UtcDaliPinchGestureProcessorProcessClearStateN(void)
+{
+ TestAbortWithState(GestureState::CLEAR);
+ END_TEST;
+}
+
+int UtcDaliPinchGestureProcessorProcessPossibleStateN(void)
+{
+ TestAbortWithState(GestureState::POSSIBLE);
+ END_TEST;
+}
+
--- /dev/null
+/*
+ * 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.
+ * 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 <iostream>
+
+#include <stdlib.h>
+#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
+#include <dali/internal/event/events/rotation-gesture/rotation-gesture-impl.h>
+
+using namespace Dali;
+
+void utc_dali_internal_rotation_gesture_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_internal_rotation_gesture_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+// Positive test case for a method
+int UtcDaliRotationGestureConstructor(void)
+{
+ TestApplication application; // Reset all test adapter return codes
+
+ RotationGesture gesture(new Internal::RotationGesture( GestureState::STARTED ));
+ DALI_TEST_EQUALS(GestureState::STARTED, gesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.0f, gesture.GetRotation().radian, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::ROTATION, gesture.GetType(), TEST_LOCATION);
+
+ RotationGesture gesture2(new Internal::RotationGesture( GestureState::CONTINUING ));
+ DALI_TEST_EQUALS(GestureState::CONTINUING, gesture2.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.0f, gesture2.GetRotation().radian, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::ROTATION, gesture2.GetType(), TEST_LOCATION);
+
+ RotationGesture gesture3(new Internal::RotationGesture( GestureState::FINISHED ));
+ DALI_TEST_EQUALS(GestureState::FINISHED, gesture3.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.0f, gesture3.GetRotation().radian, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::ROTATION, gesture3.GetType(), TEST_LOCATION);
+
+ // Test copy constructor
+ GetImplementation( gesture3 ).SetRotation( Radian( 3.0f ));
+
+ RotationGesture rotation(gesture3);
+ DALI_TEST_EQUALS(GestureState::FINISHED, rotation.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(3.0f, rotation.GetRotation().radian, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::ROTATION, rotation.GetType(), TEST_LOCATION);
+
+ // Test move constructor
+ const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
+ RotationGesture gesture4( std::move( gesture ) );
+ DALI_TEST_CHECK(!gesture);
+ DALI_TEST_EQUALS(GestureType::ROTATION, gesture4.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture4.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliRotationGestureAssignment(void)
+{
+ // Test Assignment operator
+ RotationGesture gesture(new Internal::RotationGesture( GestureState::STARTED ));
+ DALI_TEST_EQUALS(GestureState::STARTED, gesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.0f, gesture.GetRotation().radian, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::ROTATION, gesture.GetType(), TEST_LOCATION);
+
+ RotationGesture gesture2(new Internal::RotationGesture( GestureState::CONTINUING ));
+ DALI_TEST_EQUALS(GestureState::CONTINUING, gesture2.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.0f, gesture2.GetRotation().radian, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::ROTATION, gesture2.GetType(), TEST_LOCATION);
+
+ GetImplementation( gesture2 ).SetRotation( Radian( 3.0f ));
+
+ gesture = gesture2;
+ DALI_TEST_EQUALS(GestureState::CONTINUING, gesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(3.0f, gesture.GetRotation().radian, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::ROTATION, gesture.GetType(), TEST_LOCATION);
+
+ // Move assignment
+ const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
+ RotationGesture gesture3;
+ DALI_TEST_EQUALS(gesture3, Gesture(), TEST_LOCATION);
+ gesture3 = std::move(gesture);
+ DALI_TEST_CHECK(!gesture);
+ DALI_TEST_EQUALS(GestureType::ROTATION, gesture3.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliRotationGestureSetGetRotationP(void)
+{
+ RotationGesture gesture(new Internal::RotationGesture(GestureState::STARTED));
+ DALI_TEST_EQUALS(gesture.GetRotation(), Radian(), TEST_LOCATION);
+
+ GetImplementation(gesture).SetRotation(Dali::ANGLE_270);
+ DALI_TEST_EQUALS(gesture.GetRotation(), Dali::ANGLE_270, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliRotationGestureSetGetScreenCenterPointP(void)
+{
+ RotationGesture gesture(new Internal::RotationGesture(GestureState::STARTED));
+ DALI_TEST_EQUALS(gesture.GetScreenCenterPoint(), Vector2::ZERO, TEST_LOCATION);
+
+ GetImplementation(gesture).SetScreenCenterPoint(Vector2(123.0f,321.0f));
+ DALI_TEST_EQUALS(gesture.GetScreenCenterPoint(), Vector2(123.0f,321.0f), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliRotationGestureSetGetLocalCenterPointP(void)
+{
+ RotationGesture gesture(new Internal::RotationGesture(GestureState::STARTED));
+ DALI_TEST_EQUALS(gesture.GetLocalCenterPoint(), Vector2::ZERO, TEST_LOCATION);
+
+ GetImplementation(gesture).SetLocalCenterPoint(Vector2(123.0f,321.0f));
+ DALI_TEST_EQUALS(gesture.GetLocalCenterPoint(), Vector2(123.0f,321.0f), TEST_LOCATION);
+
+ END_TEST;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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 <iostream>
+
+#include <stdlib.h>
+#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
+#include <dali/internal/event/events/tap-gesture/tap-gesture-impl.h>
+
+using namespace Dali;
+
+void utc_dali_internal_tap_gesture_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_internal_tap_gesture_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+
+// Positive test case for a method
+int UtcDaliTapGestureConstructor(void)
+{
+ TestApplication application; // Reset all test adapter return codes
+
+ TapGesture gesture(new Internal::TapGesture( GestureState::STARTED ));
+ DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, gesture.GetNumberOfTaps(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::TAP, gesture.GetType(), TEST_LOCATION);
+
+ // Test Copy constructor
+ GetImplementation( gesture ).SetNumberOfTouches( 5u );
+ GetImplementation( gesture ).SetNumberOfTaps( 2u );
+
+ TapGesture gesture2(gesture);
+ DALI_TEST_EQUALS(5u, gesture2.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(2u, gesture2.GetNumberOfTaps(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::TAP, gesture2.GetType(), TEST_LOCATION);
+
+ // Test move constructor
+ const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
+ TapGesture gesture3( std::move( gesture ) );
+ DALI_TEST_CHECK(!gesture);
+ DALI_TEST_EQUALS(GestureType::TAP, gesture3.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliTapGestureAssignment(void)
+{
+ // Test Assignment operator
+ TapGesture gesture(new Internal::TapGesture( GestureState::STARTED ));
+ DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, gesture.GetNumberOfTaps(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::TAP, gesture.GetType(), TEST_LOCATION);
+
+ GetImplementation( gesture ).SetNumberOfTouches( 5u );
+ GetImplementation( gesture ).SetNumberOfTaps( 2u );
+
+ TapGesture gesture2;
+ gesture2 = gesture;
+ DALI_TEST_EQUALS(5u, gesture2.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(2u, gesture2.GetNumberOfTaps(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::TAP, gesture2.GetType(), TEST_LOCATION);
+
+ // Move assignment
+ const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
+ TapGesture gesture3;
+ DALI_TEST_EQUALS(gesture3, Gesture(), TEST_LOCATION);
+ gesture3 = std::move(gesture);
+ DALI_TEST_CHECK(!gesture);
+ DALI_TEST_EQUALS(GestureType::TAP, gesture3.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliTapGestureSetGetNumberOfTapsP(void)
+{
+ TapGesture gesture(new Internal::TapGesture(GestureState::STARTED));
+ DALI_TEST_EQUALS(gesture.GetNumberOfTaps(), 1u, TEST_LOCATION);
+
+ GetImplementation(gesture).SetNumberOfTaps(123u);
+ DALI_TEST_EQUALS(gesture.GetNumberOfTaps(), 123u, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliTapGestureSetGetNumberOfTouchesP(void)
+{
+ TapGesture gesture(new Internal::TapGesture(GestureState::STARTED));
+ DALI_TEST_EQUALS(gesture.GetNumberOfTouches(), 1u, TEST_LOCATION);
+
+ GetImplementation(gesture).SetNumberOfTouches(321u);
+ DALI_TEST_EQUALS(gesture.GetNumberOfTouches(), 321u, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliTapGestureSetGetScreenPointP(void)
+{
+ TapGesture gesture(new Internal::TapGesture(GestureState::STARTED));
+ DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2::ZERO, TEST_LOCATION);
+
+ GetImplementation(gesture).SetScreenPoint(Vector2(123.0f,321.0f));
+ DALI_TEST_EQUALS(gesture.GetScreenPoint(), Vector2(123.0f,321.0f), TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliTapGestureSetGetLocalPointP(void)
+{
+ TapGesture gesture(new Internal::TapGesture(GestureState::STARTED));
+ DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2::ZERO, TEST_LOCATION);
+
+ GetImplementation(gesture).SetLocalPoint(Vector2(123.0f,321.0f));
+ DALI_TEST_EQUALS(gesture.GetLocalPoint(), Vector2(123.0f,321.0f), TEST_LOCATION);
+
+ END_TEST;
+}
--- /dev/null
+/*
+ * Copyright (c) 2014 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 <iostream>
+
+#include <stdlib.h>
+#include <dali/public-api/dali-core.h>
+#include <dali-test-suite-utils.h>
+#include <dali/internal/event/events/tap-gesture/tap-gesture-processor.h>
+#include <dali/internal/event/events/tap-gesture/tap-gesture-event.h>
+#include <dali/internal/event/common/scene-impl.h>
+
+using namespace Dali;
+
+void utc_dali_internal_tap_gesture_processor_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_internal_tap_gesture_processor_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+
+void TestAbortWithState(GestureState state)
+{
+ TestApplication application;
+
+ Internal::TapGestureProcessor processor;
+ Integration::Scene scene( application.GetScene() );
+ Internal::Scene& sceneImpl = GetImplementation( scene );
+ Internal::TapGestureEvent event(state);
+
+ try
+ {
+ processor.Process(sceneImpl, event);
+ DALI_TEST_CHECK( false ); // Should not get here as we expect an abort
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK( true ); // We aborted, so the test has passed
+ }
+}
+
+} // anon namespace
+
+int UtcDaliTapGestureProcessorProcessClearStateN(void)
+{
+ TestAbortWithState(GestureState::CLEAR);
+ END_TEST;
+}
+
+int UtcDaliTapGestureProcessorProcessContinuingStateN(void)
+{
+ TestAbortWithState(GestureState::CONTINUING);
+ END_TEST;
+}
+
+int UtcDaliTapGestureProcessorProcessFinishedStateN(void)
+{
+ TestAbortWithState(GestureState::FINISHED);
+ END_TEST;
+}
+
utc-Dali-FrameBuffer.cpp
utc-Dali-FrameCallbackInterface.cpp
utc-Dali-Geometry.cpp
- utc-Dali-Gesture.cpp
utc-Dali-GestureDetector.cpp
utc-Dali-Handle.cpp
utc-Dali-Hash.cpp
utc-Dali-KeyEvent.cpp
utc-Dali-Layer.cpp
utc-Dali-LocklessBuffer.cpp
- utc-Dali-LongPressGesture.cpp
utc-Dali-LongPressGestureDetector.cpp
utc-Dali-LongPressGestureRecognizer.cpp
utc-Dali-MathUtils.cpp
utc-Dali-PanGestureDetector.cpp
utc-Dali-PanGestureRecognizer.cpp
utc-Dali-Path.cpp
- utc-Dali-PinchGesture.cpp
utc-Dali-PinchGestureDetector.cpp
utc-Dali-PinchGestureRecognizer.cpp
utc-Dali-Pixel.cpp
utc-Dali-Renderer.cpp
utc-Dali-RenderTask.cpp
utc-Dali-RenderTaskList.cpp
- utc-Dali-RotationGesture.cpp
utc-Dali-RotationGestureDetector.cpp
utc-Dali-RotationGestureRecognizer.cpp
utc-Dali-Sampler.cpp
utc-Dali-SignalTemplates.cpp
utc-Dali-SingletonService.cpp
utc-Dali-Stage.cpp
- utc-Dali-TapGesture.cpp
utc-Dali-TapGestureDetector.cpp
utc-Dali-TapGestureRecognizer.cpp
utc-Dali-Texture.cpp
utc-Dali-TextureSet.cpp
utc-Dali-Thread.cpp
utc-Dali-ThreadPool.cpp
+ utc-Dali-TouchEvent.cpp
utc-Dali-TouchEventCombiner.cpp
utc-Dali-TouchProcessing.cpp
utc-Dali-TypeRegistry.cpp
{
TestCustomActor::TestCustomActor()
-: CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS | REQUIRES_WHEEL_EVENTS | REQUIRES_HOVER_EVENTS | DISABLE_SIZE_NEGOTIATION ) ),
+: CustomActorImpl( ActorFlags( DISABLE_SIZE_NEGOTIATION ) ),
mDaliProperty( Property::INVALID_INDEX ),
mSizeSet( Vector3::ZERO ),
mTargetSize( Vector3::ZERO ),
}
TestCustomActor::TestCustomActor(bool nego)
-: CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS | REQUIRES_WHEEL_EVENTS | REQUIRES_HOVER_EVENTS ) ),
+: CustomActorImpl( ActorFlags() ),
mDaliProperty( Property::INVALID_INDEX ),
mSizeSet( Vector3::ZERO ),
mTargetSize( Vector3::ZERO ),
{
AddToCallStacks("OnChildRemove");
}
-void TestCustomActor::OnPropertySet( Property::Index index, Property::Value propertyValue )
+void TestCustomActor::OnPropertySet( Property::Index index, const Property::Value& propertyValue )
{
AddToCallStacks("OnPropertySet");
}
mTargetSize = targetSize;
AddToCallStacks("OnSizeAnimation");
}
-bool TestCustomActor::OnHoverEvent(const HoverEvent& event)
-{
- AddToCallStacks("OnHoverEvent");
- return true;
-}
-bool TestCustomActor::OnWheelEvent(const WheelEvent& event)
-{
- AddToCallStacks("OnWheelEvent");
- return true;
-}
-bool TestCustomActor::OnKeyEvent(const KeyEvent& event)
-{
- AddToCallStacks("OnKeyEvent");
- return true;
-}
void TestCustomActor::OnKeyInputFocusGained()
{
AddToCallStacks("OnKeyInputFocusGained");
void OnSceneDisconnection() override;
void OnChildAdd(Dali::Actor& child) override;
void OnChildRemove(Dali::Actor& child) override;
- void OnPropertySet( Dali::Property::Index index, Dali::Property::Value propertyValue ) override;
+ void OnPropertySet( Dali::Property::Index index, const Dali::Property::Value& propertyValue ) override;
void OnSizeSet(const Dali::Vector3& targetSize) override;
void OnSizeAnimation(Dali::Animation& animation, const Dali::Vector3& targetSize) override;
- bool OnHoverEvent(const Dali::HoverEvent& event) override;
- bool OnWheelEvent(const Dali::WheelEvent& event) override;
- bool OnKeyEvent(const Dali::KeyEvent& event) override;
virtual void OnKeyInputFocusGained();
virtual void OnKeyInputFocusLost();
Dali::Vector3 GetNaturalSize() override;
* Constructor
*/
SimpleTestCustomActor()
- : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS | DISABLE_SIZE_NEGOTIATION ) )
+ : CustomActorImpl( ActorFlags( DISABLE_SIZE_NEGOTIATION ) )
{
}
void OnSizeAnimation(Dali::Animation& animation, const Dali::Vector3& targetSize) override
{
}
- bool OnHoverEvent(const Dali::HoverEvent& event) override
- {
- return true;
- }
- bool OnWheelEvent(const Dali::WheelEvent& event) override
- {
- return true;
- }
- bool OnKeyEvent(const Dali::KeyEvent& event) override
- {
- return true;
- }
virtual void OnKeyInputFocusGained()
{
}
virtual void OnKeyInputFocusLost()
{
}
-
Dali::Vector3 GetNaturalSize() override
{
return Dali::Vector3( 0.0f, 0.0f, 0.0f );
#include <dali/public-api/actors/actor.h>
/**
- * Functor to be connected to an Actor's TouchSignal.
+ * Functor to be connected to an Actor's TouchedSignal.
* Allows the user to specify whether the functor should return true (consumed) or false.
*/
struct TouchEventFunctorConsumeSetter
application.Render();
// connect to its touch signal
- actor.TouchSignal().Connect( TestTouchCallback );
+ actor.TouchedSignal().Connect( TestTouchCallback );
// simulate a touch event in the middle of the screen
Vector2 touchPoint( application.GetScene().GetSize() * 0.5 );
DALI_TEST_CHECK( !gTouchCallBackCalled );
// connect to its touch signal
- actor.TouchSignal().Connect(TestTouchCallback);
+ actor.TouchedSignal().Connect(TestTouchCallback);
Dali::Integration::Point point;
point.SetState( PointState::DOWN );
// connect to actor touch signals, will use touch callbacks to determine which actor is on top.
// Only top actor will get touched.
- actorA.TouchSignal().Connect( TestTouchCallback );
- actorB.TouchSignal().Connect( TestTouchCallback2 );
- actorC.TouchSignal().Connect( TestTouchCallback3 );
+ actorA.TouchedSignal().Connect( TestTouchCallback );
+ actorB.TouchedSignal().Connect( TestTouchCallback2 );
+ actorC.TouchedSignal().Connect( TestTouchCallback3 );
// Connect ChildOrderChangedSignal
bool orderChangedSignal( false );
// connect to actor touch signals, will use touch callbacks to determine which actor is on top.
// Only top actor will get touched.
- actorA.TouchSignal().Connect( TestTouchCallback );
- actorB.TouchSignal().Connect( TestTouchCallback2 );
- actorC.TouchSignal().Connect( TestTouchCallback3 );
+ actorA.TouchedSignal().Connect( TestTouchCallback );
+ actorB.TouchedSignal().Connect( TestTouchCallback2 );
+ actorC.TouchedSignal().Connect( TestTouchCallback3 );
Dali::Integration::Point point;
point.SetDeviceId( 1 );
// connect to actor touch signals, will use touch callbacks to determine which actor is on top.
// Only top actor will get touched.
- actorA.TouchSignal().Connect( TestTouchCallback );
- actorB.TouchSignal().Connect( TestTouchCallback2 );
- actorC.TouchSignal().Connect( TestTouchCallback3 );
+ actorA.TouchedSignal().Connect( TestTouchCallback );
+ actorB.TouchedSignal().Connect( TestTouchCallback2 );
+ actorC.TouchedSignal().Connect( TestTouchCallback3 );
bool orderChangedSignal( false );
Actor orderChangedActor;
// connect to actor touch signals, will use touch callbacks to determine which actor is on top.
// Only top actor will get touched.
- actorA.TouchSignal().Connect( TestTouchCallback );
- actorB.TouchSignal().Connect( TestTouchCallback2 );
- actorC.TouchSignal().Connect( TestTouchCallback3 );
+ actorA.TouchedSignal().Connect( TestTouchCallback );
+ actorB.TouchedSignal().Connect( TestTouchCallback2 );
+ actorC.TouchedSignal().Connect( TestTouchCallback3 );
Dali::Integration::Point point;
point.SetDeviceId( 1 );
// connect to actor touch signals, will use touch callbacks to determine which actor is on top.
// Only top actor will get touched.
- actorA.TouchSignal().Connect( TestTouchCallback );
- actorB.TouchSignal().Connect( TestTouchCallback2 );
- actorC.TouchSignal().Connect( TestTouchCallback3 );
+ actorA.TouchedSignal().Connect( TestTouchCallback );
+ actorB.TouchedSignal().Connect( TestTouchCallback2 );
+ actorC.TouchedSignal().Connect( TestTouchCallback3 );
Dali::Integration::Point point;
point.SetDeviceId( 1 );
// connect to actor touch signals, will use touch callbacks to determine which actor is on top.
// Only top actor will get touched.
- actorA.TouchSignal().Connect( TestTouchCallback );
- actorB.TouchSignal().Connect( TestTouchCallback2 );
- actorC.TouchSignal().Connect( TestTouchCallback3 );
+ actorA.TouchedSignal().Connect( TestTouchCallback );
+ actorB.TouchedSignal().Connect( TestTouchCallback2 );
+ actorC.TouchedSignal().Connect( TestTouchCallback3 );
Dali::Integration::Point point;
point.SetDeviceId( 1 );
// connect to actor touch signals, will use touch callbacks to determine which actor is on top.
// Only top actor will get touched.
- actorA.TouchSignal().Connect( TestTouchCallback );
- actorB.TouchSignal().Connect( TestTouchCallback2 );
- actorC.TouchSignal().Connect( TestTouchCallback3 );
+ actorA.TouchedSignal().Connect( TestTouchCallback );
+ actorB.TouchedSignal().Connect( TestTouchCallback2 );
+ actorC.TouchedSignal().Connect( TestTouchCallback3 );
Dali::Integration::Point point;
point.SetDeviceId( 1 );
// connect to actor touch signals, will use touch callbacks to determine which actor is on top.
// Only top actor will get touched.
- actorA.TouchSignal().Connect( TestTouchCallback );
- actorB.TouchSignal().Connect( TestTouchCallback2 );
- actorC.TouchSignal().Connect( TestTouchCallback3 );
+ actorA.TouchedSignal().Connect( TestTouchCallback );
+ actorB.TouchedSignal().Connect( TestTouchCallback2 );
+ actorC.TouchedSignal().Connect( TestTouchCallback3 );
ResetTouchCallbacks();
DALI_TEST_EQUALS( actor.GetProperty< bool >( Actor::Property::CULLED ), false, TEST_LOCATION );
PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::CULLED, LessThanCondition( 0.5f ) );
- notification.SetNotifyMode( PropertyNotification::NotifyOnChanged );
+ notification.SetNotifyMode( PropertyNotification::NOTIFY_ON_CHANGED );
// Connect NotifySignal
bool propertyNotificationSignal( false );
END_TEST;
}
-int UtcDaliActorTouchSignalNegative(void)
+int UtcDaliActorTouchedSignalNegative(void)
{
TestApplication application;
Dali::Actor instance;
try
{
- instance.TouchSignal();
+ instance.TouchedSignal();
DALI_TEST_CHECK(false); // Should not get here
}
catch(...)
DALI_TEST_CHECK( gTouchCallBackCalled == false );
// connect to its touch signal
- actor.ConnectSignal( &application, "touch", TestCallback() );
+ actor.ConnectSignal( &application, "touched", TestCallback() );
application.SendNotification();
application.Render(1000);
constraint.AddSource( LocalSource( Actor::Property::ORIENTATION ) );
constraint.AddSource( LocalSource( Actor::Property::COLOR ) );
constraint.AddSource( LocalSource( Actor::Property::VISIBLE ) );
- constraint.SetRemoveAction( Constraint::Discard );
+ constraint.SetRemoveAction( Constraint::DISCARD );
constraint.SetTag( 123 );
// Clone the constraint & apply the clone
Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, &BasicFunction< Vector3 > );
DALI_TEST_EQUALS( constraint.GetRemoveAction(), Constraint::DEFAULT_REMOVE_ACTION, TEST_LOCATION );
- constraint.SetRemoveAction( Constraint::Discard );
- DALI_TEST_EQUALS( constraint.GetRemoveAction(), Constraint::Discard, TEST_LOCATION );
+ constraint.SetRemoveAction( Constraint::DISCARD );
+ DALI_TEST_EQUALS( constraint.GetRemoveAction(), Constraint::DISCARD, TEST_LOCATION );
- constraint.SetRemoveAction( Constraint::Bake );
- DALI_TEST_EQUALS( constraint.GetRemoveAction(), Constraint::Bake, TEST_LOCATION );
+ constraint.SetRemoveAction( Constraint::BAKE );
+ DALI_TEST_EQUALS( constraint.GetRemoveAction(), Constraint::BAKE, TEST_LOCATION );
END_TEST;
}
Constraint constraint;
try
{
- constraint.SetRemoveAction( Constraint::Discard );
+ constraint.SetRemoveAction( Constraint::DISCARD );
DALI_TEST_CHECK( false ); // Should not reach here!
}
catch( ... )
// Create a constraint that constrains to position
Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, SetValueFunctor< Vector3 >( position ) );
- constraint.SetRemoveAction( Constraint::Bake );
+ constraint.SetRemoveAction( Constraint::BAKE );
constraint.Apply();
application.SendNotification();
// Create a constraint that constrains to position
Constraint constraint = Constraint::New< Vector3 >( actor, Actor::Property::POSITION, SetValueFunctor< Vector3 >( position ) );
- constraint.SetRemoveAction( Constraint::Discard );
+ constraint.SetRemoveAction( Constraint::DISCARD );
constraint.Apply();
application.SendNotification();
// Create a constraint whose value is discarded when it is removed
Constraint constraint = Constraint::New< Vector4 >( actor, Actor::Property::COLOR, SetHalfOpacity );
- constraint.SetRemoveAction( Constraint::RemoveAction::Discard );
+ constraint.SetRemoveAction( Constraint::RemoveAction::DISCARD );
constraint.Apply();
// Check value after one render, it should be constrained
// Create a constraint whose value is discarded when it is removed
Constraint constraint = Constraint::New< Vector4 >( actor, Actor::Property::COLOR, SetHalfOpacity );
- constraint.SetRemoveAction( Constraint::RemoveAction::Discard );
+ constraint.SetRemoveAction( Constraint::RemoveAction::DISCARD );
constraint.Apply();
// Check value after one render, it should be constrained
Dali::Constraint instance;
try
{
- Dali::Constraint::RemoveAction arg1(Constraint::Bake);
+ Dali::Constraint::RemoveAction arg1(Constraint::BAKE);
instance.SetRemoveAction(arg1);
DALI_TEST_CHECK(false); // Should not get here
}
END_TEST;
}
-int UtcDaliCustomActorOnHoverEvent(void)
-{
- TestApplication application;
- tet_infoline("Testing Dali::CustomActor::OnHoverEvent()");
-
- Test::TestCustomActor custom = Test::TestCustomActor::New();
- DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
-
- // set size for custom actor
- custom.SetProperty( Actor::Property::SIZE, Vector2( 100, 100 ) );
- // add the custom actor to stage
- application.GetScene().Add( custom );
- custom.ResetCallStack();
-
- // Render and notify a couple of times
- application.SendNotification();
- application.Render();
- application.SendNotification();
- application.Render();
-
- // simulate a hover event
- Dali::Integration::Point point;
- point.SetState( PointState::MOTION );
- point.SetScreenPosition( Vector2( 1, 1 ) );
- Dali::Integration::HoverEvent event;
- event.AddPoint( point );
- application.ProcessEvent( event );
-
- DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnHoverEvent", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliCustomActorOnWheelEvent(void)
-{
- TestApplication application;
- tet_infoline("Testing Dali::CustomActor::OnWheelEvent()");
-
- Test::TestCustomActor custom = Test::TestCustomActor::New();
- DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
-
- // set size for custom actor
- custom.SetProperty( Actor::Property::SIZE, Vector2( 100, 100 ) );
- // add the custom actor to stage
- application.GetScene().Add( custom );
- custom.ResetCallStack();
-
- // Render and notify a couple of times
- application.SendNotification();
- application.Render();
- application.SendNotification();
- application.Render();
-
- // simulate a wheel event
- Vector2 screenCoordinates( 10.0f, 10.0f );
- Integration::WheelEvent event( Integration::WheelEvent::MOUSE_WHEEL, 0, 0u, screenCoordinates, 1, 1000u );
- application.ProcessEvent( event );
-
- DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION );
- DALI_TEST_EQUALS( "OnWheelEvent", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION );
- END_TEST;
-}
-
int UtcDaliCustomActorImplOnPropertySet(void)
{
TestApplication application;
{ }
virtual void OnChildRemove(Actor& child)
{ }
- virtual void OnPropertySet( Property::Index index, Property::Value propertyValue )
+ virtual void OnPropertySet( Property::Index index, const Property::Value& propertyValue )
{ }
virtual void OnSizeSet(const Vector3& targetSize)
{ }
{ }
virtual bool OnHoverEvent(const HoverEvent& event)
{ return false; }
- virtual bool OnKeyEvent(const KeyEvent& event)
- { return false; }
virtual bool OnWheelEvent(const WheelEvent& event)
{ return false; }
virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
+++ /dev/null
-/*
- * Copyright (c) 2014 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 <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali-test-suite-utils.h>
-
-using namespace Dali;
-
-void utc_dali_gesture_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_gesture_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-namespace
-{
-
-// TestGesture Struct (Gesture constructor is protected)
-struct TestGesture : public Gesture
-{
-public:
- TestGesture(Gesture::Type type, Gesture::State state)
- : Gesture(type, state) {}
-
- virtual ~TestGesture() {}
-};
-
-} // anon namespace
-
-int UtcDaliGestureConstructor(void)
-{
- TestApplication application; // Reset all test adapter return codes
-
- TestGesture pan(Gesture::Pan, Gesture::Started);
- DALI_TEST_EQUALS(Gesture::Pan, pan.type, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, pan.state, TEST_LOCATION);
-
- TestGesture pinch(Gesture::Pinch, Gesture::Clear);
- DALI_TEST_EQUALS(Gesture::Pinch, pinch.type, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Clear, pinch.state, TEST_LOCATION);
-
- // Test copy constructor
- TestGesture pan2(pan);
- DALI_TEST_EQUALS(Gesture::Pan, pan2.type, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, pan2.state, TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliGestureAssignment(void)
-{
- // Test Assignment operator
- TestGesture pan(Gesture::Pan, Gesture::Finished);
- DALI_TEST_EQUALS(Gesture::Pan, pan.type, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Finished, pan.state, TEST_LOCATION);
-
- TestGesture test(Gesture::Pinch, Gesture::Started);
- DALI_TEST_EQUALS(Gesture::Pinch, test.type, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, test.state, TEST_LOCATION);
-
- test = pan;
- DALI_TEST_EQUALS(Gesture::Pan, test.type, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Finished, test.state, TEST_LOCATION);
- END_TEST;
-}
#include <dali/public-api/dali-core.h>
#include <dali/integration-api/events/hover-event-integ.h>
#include <dali/integration-api/render-task-list-integ.h>
+#include <dali/devel-api/events/hover-event-devel.h>
#include <dali-test-suite-utils.h>
using namespace Dali;
END_TEST;
}
+
+int UtcDaliHoverEventCreate(void)
+{
+ TestApplication application;
+
+ Dali::HoverEvent hoverEvent = DevelHoverEvent::New( 100 );
+ DALI_TEST_CHECK( hoverEvent );
+
+ // Emit a started signal
+ DALI_TEST_EQUALS( 100, hoverEvent.GetTime(), TEST_LOCATION );
+ DALI_TEST_EQUALS( 0, hoverEvent.GetPointCount(), TEST_LOCATION );
+
+ END_TEST;
+}
+
+++ /dev/null
-/*
- * Copyright (c) 2014 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 <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali-test-suite-utils.h>
-
-using namespace Dali;
-
-void utc_dali_long_press_gesture_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_long_press_gesture_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-
-// Positive test case for a method
-int UtcDaliLongPressGestureConstructor(void)
-{
- TestApplication application; // Reset all test adapter return codes
-
- LongPressGesture gesture( Gesture::Started );
- DALI_TEST_EQUALS(1u, gesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::LongPress, gesture.type, TEST_LOCATION);
-
- // Test Copy constructor
- gesture.numberOfTouches = 5u;
-
- LongPressGesture gesture2(gesture);
- DALI_TEST_EQUALS(5u, gesture2.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::LongPress, gesture2.type, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, gesture2.state, TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliLongPressGestureAssignment(void)
-{
- // Test Assignment operator
- LongPressGesture gesture( Gesture::Started );
- DALI_TEST_EQUALS(1u, gesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::LongPress, gesture.type, TEST_LOCATION);
-
- gesture.numberOfTouches = 5u;
-
- LongPressGesture gesture2( Gesture::Finished );
- DALI_TEST_EQUALS(Gesture::Finished, gesture2.state, TEST_LOCATION);
- gesture2 = gesture;
- DALI_TEST_EQUALS(5u, gesture2.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::LongPress, gesture2.type, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, gesture2.state, TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliLongPressGestureDynamicAllocation(void)
-{
- LongPressGesture* gesture = new LongPressGesture( Gesture::Started );
- DALI_TEST_EQUALS(1u, gesture->numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::LongPress, gesture->type, TEST_LOCATION);
- delete gesture;
-
- END_TEST;
-}
SignalData()
: functorCalled( false ),
voidFunctorCalled( false ),
- receivedGesture( Gesture::Clear ),
+ receivedGesture(),
pressedActor()
{}
functorCalled = false;
voidFunctorCalled = false;
- receivedGesture.numberOfTouches = 0u;
- receivedGesture.screenPoint = Vector2(0.0f, 0.0f);
- receivedGesture.localPoint = Vector2(0.0f, 0.0f);
+ receivedGesture.Reset();
pressedActor.Reset();
}
// Functor that removes the gestured actor from stage
struct UnstageActorFunctor : public GestureReceivedFunctor
{
- UnstageActorFunctor( SignalData& data, Gesture::State& stateToUnstage, Integration::Scene scene )
+ UnstageActorFunctor( SignalData& data, GestureState& stateToUnstage, Integration::Scene scene )
: GestureReceivedFunctor( data ),
stateToUnstage( stateToUnstage ),
scene( scene )
{
GestureReceivedFunctor::operator()( actor, longPress );
- if ( longPress.state == stateToUnstage )
+ if ( longPress.GetState() == stateToUnstage )
{
scene.Remove( actor );
}
}
- Gesture::State& stateToUnstage;
+ GestureState& stateToUnstage;
Integration::Scene scene;
};
detector.Attach(actor);
TouchEventFunctor touchFunctor;
- actor.TouchSignal().Connect(&application, touchFunctor);
+ actor.TouchedSignal().Connect(&application, touchFunctor);
Integration::TouchEvent touchEvent(1);
Integration::Point point;
// Do a long press inside actor's area
TestGenerateLongPress( application, 50.0f, 50.0f );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.localPoint, 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
TestEndLongPress( application, 50.0f, 50.0f);
END_TEST;
}
// Start long press within the actor's area
TestGenerateLongPress( application, 20.0f, 20.0f );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(20.0f, 20.0f), data.receivedGesture.localPoint, 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(20.0f, 20.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
TestEndLongPress( application, 20.0f, 20.0f);
// repeat the long press within the actor's area - we should still receive the signal
data.Reset();
TestGenerateLongPress( application, 50.0f, 50.0f );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.localPoint, 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
TestEndLongPress( application, 50.0f, 50.0f);
// Detach actor
TestGenerateLongPress( application, 5.0f, 5.0f );
TestEndLongPress( application, 5.0f, 5.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.screenPoint, 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION);
// Rotate actor again and render
actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS) );
TestGenerateLongPress( application, 5.0f, 5.0f );
TestEndLongPress( application, 5.0f, 5.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.screenPoint, 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION);
// Rotate actor again and render
actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::YAXIS) );
TestEndLongPress( application, 50.0f, 50.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, parent == data.pressedActor, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.screenPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.GetScreenPoint(), 0.01f, TEST_LOCATION);
// Attach child and generate same touch points
// (Also proves that you can detach and then re-attach another actor)
TestEndLongPress( application, 51.0f, 51.0f);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, child == data.pressedActor, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(51.0f, 51.0f), data.receivedGesture.screenPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(51.0f, 51.0f), data.receivedGesture.GetScreenPoint(), 0.01f, TEST_LOCATION);
END_TEST;
}
application.SendNotification();
application.Render();
- // Emit Started event, we should not receive the long press.
+ // Emit STARTED event, we should not receive the long press.
TestTriggerLongPress( application );
TestEndLongPress( application, 50.0f, 10.0f );
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Detach actor
detector.Detach(actor);
- // Emit Finished, no signal
+ // Emit FINISHED, no signal
TestEndLongPress( application, 50.0f, 10.0f );
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
application.Render();
// State to remove actor in.
- Gesture::State stateToUnstage( Gesture::Started );
+ GestureState stateToUnstage( GestureState::STARTED );
// Attach actor to detector
SignalData data;
application.SendNotification();
application.Render();
- // Change state to Gesture::Continuing to remove
- stateToUnstage = Gesture::Finished;
+ // Change state to GestureState::CONTINUING to remove
+ stateToUnstage = GestureState::FINISHED;
// Emit signals
TestGenerateLongPress( application, 50.0f, 10.0f );
application.Render();
// State to remove actor in.
- Gesture::State stateToUnstage( Gesture::Started );
+ GestureState stateToUnstage( GestureState::STARTED );
// Attach actor to detector
SignalData data;
detector.Attach(dummyActor);
detector.DetectedSignal().Connect( &application, functor );
- // Here we are testing a Started actor which is removed in the Started callback, but then added back
+ // Here we are testing a STARTED actor which is removed in the STARTED callback, but then added back
// before we get a finished state. As we were removed from the stage, even if we're at the same
// position, we should still not be signalled.
bool consume = false;
TouchEventFunctorConsumeSetter touchFunctor(consume);
- actor.TouchSignal().Connect(&application,touchFunctor);
+ actor.TouchedSignal().Connect(&application,touchFunctor);
// Render and notify
application.SendNotification();
&application,
[&detector, &functorCalled](Actor actor, const LongPressGesture& gesture)
{
- if( gesture.state == Gesture::Finished )
+ if( gesture.GetState() == GestureState::FINISHED )
{
detector.Detach(actor);
functorCalled = true;
#include <dali/integration-api/render-task-list-integ.h>
#include <dali-test-suite-utils.h>
-
using namespace Dali;
///////////////////////////////////////////////////////////////////////////////
SignalData()
: functorCalled(false),
voidFunctorCalled(false),
- receivedGesture(Gesture::Started)
+ receivedGesture()
{}
void Reset()
functorCalled = false;
voidFunctorCalled = false;
- receivedGesture.state = Gesture::Started;
+ receivedGesture.Reset();
pressedActor.Reset();
}
* 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
+ * See the License for the specific language governing permissions an
+ * d
* limitations under the License.
*
*/
#include <stdlib.h>
#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/devel-api/events/pan-gesture-devel.h>
using namespace Dali;
test_return_value = TET_PASS;
}
-
-
-int UtcDaliPanGestureConstructor(void)
+int UtcDaliPanGestureConstructorP(void)
{
TestApplication application; // Reset all test adapter return codes
- PanGesture gesture;
- DALI_TEST_EQUALS(Gesture::Clear, gesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, gesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pan, gesture.type, TEST_LOCATION);
+ PanGesture gesture = DevelPanGesture::New( GestureState::CLEAR );
+
+ DALI_TEST_EQUALS(GestureState::CLEAR, gesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::PAN, gesture.GetType(), TEST_LOCATION);
+
+ PanGesture gesture2 = DevelPanGesture::New( GestureState::STARTED );
+ DALI_TEST_EQUALS(GestureState::STARTED, gesture2.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, gesture2.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::PAN, gesture2.GetType(), TEST_LOCATION);
- PanGesture gesture2(Gesture::Started);
- DALI_TEST_EQUALS(Gesture::Started, gesture2.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, gesture2.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pan, gesture2.type, TEST_LOCATION);
+ PanGesture gesture3 = DevelPanGesture::New( GestureState::CONTINUING );
+ DALI_TEST_EQUALS(GestureState::CONTINUING, gesture3.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, gesture3.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::PAN, gesture3.GetType(), TEST_LOCATION);
- PanGesture gesture3(Gesture::Continuing);
- DALI_TEST_EQUALS(Gesture::Continuing, gesture3.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, gesture3.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pan, gesture3.type, TEST_LOCATION);
+ PanGesture gesture4 = DevelPanGesture::New( GestureState::FINISHED );
- PanGesture gesture4(Gesture::Finished);
- DALI_TEST_EQUALS(Gesture::Finished, gesture4.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, gesture4.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pan, gesture4.type, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::FINISHED, gesture4.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, gesture4.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::PAN, gesture4.GetType(), TEST_LOCATION);
// Test copy constructor
- gesture4.numberOfTouches = 3u;
+ DevelPanGesture::SetNumberOfTouches( gesture4, 3u );
PanGesture pan(gesture4);
- DALI_TEST_EQUALS(Gesture::Finished, pan.state, TEST_LOCATION);
- DALI_TEST_EQUALS(3u, pan.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pan, pan.type, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::FINISHED, pan.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(3u, pan.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::PAN, pan.GetType(), TEST_LOCATION);
+
+ // Test move constructor
+ const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
+ PanGesture gesture5( std::move( gesture ) );
+ DALI_TEST_CHECK(!gesture);
+ DALI_TEST_EQUALS(GestureType::PAN, gesture5.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture5.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
+
END_TEST;
}
-int UtcDaliPanGestureAssignment(void)
+int UtcDaliPanGestureAssignmentP(void)
{
// Test Assignment operator
- PanGesture gesture(Gesture::Started);
- DALI_TEST_EQUALS(Gesture::Started, gesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, gesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pan, gesture.type, TEST_LOCATION);
+ PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
+ DALI_TEST_EQUALS(GestureState::STARTED, gesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::PAN, gesture.GetType(), TEST_LOCATION);
- PanGesture gesture2(Gesture::Continuing);
- DALI_TEST_EQUALS(Gesture::Continuing, gesture2.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, gesture2.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pan, gesture2.type, TEST_LOCATION);
+ PanGesture gesture2 = DevelPanGesture::New( GestureState::CONTINUING );
- gesture2.numberOfTouches = 3u;
+ DALI_TEST_EQUALS(GestureState::CONTINUING, gesture2.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, gesture2.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::PAN, gesture2.GetType(), TEST_LOCATION);
+
+ DevelPanGesture::SetNumberOfTouches( gesture2, 3u );
gesture = gesture2;
- DALI_TEST_EQUALS(Gesture::Continuing, gesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(3u, gesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pan, gesture.type, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CONTINUING, gesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(3u, gesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureType::PAN, gesture.GetType(), TEST_LOCATION);
+
+ // Move assignment
+ const auto refCount = gesture.GetObjectPtr()->ReferenceCount();
+ PanGesture gesture3;
+ DALI_TEST_EQUALS(gesture3, Gesture(), TEST_LOCATION);
+ gesture3 = std::move(gesture);
+ DALI_TEST_CHECK(!gesture);
+ DALI_TEST_EQUALS(GestureType::PAN, gesture3.GetType(), TEST_LOCATION);
+ DALI_TEST_EQUALS(gesture3.GetBaseObject().ReferenceCount(), refCount, TEST_LOCATION);
+
END_TEST;
}
-int UtcDaliPanGestureGetSpeed(void)
+int UtcDaliPanGestureGetSpeedP(void)
{
- PanGesture gesture(Gesture::Started);
+ PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
DALI_TEST_EQUALS(0.0f, gesture.GetSpeed(), TEST_LOCATION);
- gesture.velocity = Vector2(3.0f, -4.0f);
+ DevelPanGesture::SetVelocity( gesture, Vector2( 3.0f, -4.0f ) );
DALI_TEST_EQUALS(5.0f, gesture.GetSpeed(), TEST_LOCATION);
END_TEST;
}
-int UtcDaliPanGestureGetDistance(void)
+int UtcDaliPanGestureGetDistanceP(void)
{
- PanGesture gesture(Gesture::Started);
+ PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
DALI_TEST_EQUALS(0.0f, gesture.GetDistance(), TEST_LOCATION);
- gesture.displacement = Vector2(-30.0f, -40.0f);
+ DevelPanGesture::SetDisplacement( gesture, Vector2( -30.0f, -40.0f ) );
DALI_TEST_EQUALS(50.0f, gesture.GetDistance(), TEST_LOCATION);
END_TEST;
}
-int UtcDaliPanGestureGetScreenSpeed(void)
+int UtcDaliPanGestureGetScreenSpeedP(void)
{
- PanGesture gesture(Gesture::Started);
+ PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
DALI_TEST_EQUALS(0.0f, gesture.GetScreenSpeed(), TEST_LOCATION);
- gesture.screenVelocity = Vector2(3.0f, -4.0f);
+ DevelPanGesture::SetScreenVelocity( gesture, Vector2( 3.0f, -4.0f ) );
DALI_TEST_EQUALS(5.0f, gesture.GetScreenSpeed(), TEST_LOCATION);
END_TEST;
}
-int UtcDaliPanGestureGetScreenDistance(void)
+int UtcDaliPanGestureGetScreenDistanceP(void)
{
- PanGesture gesture(Gesture::Started);
+ PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
DALI_TEST_EQUALS(0.0f, gesture.GetScreenDistance(), TEST_LOCATION);
- gesture.screenDisplacement = Vector2(-30.0f, -40.0f);
+ DevelPanGesture::SetScreenDisplacement( gesture, Vector2( -30.0f, -40.0f ) );
DALI_TEST_EQUALS(50.0f, gesture.GetScreenDistance(), TEST_LOCATION);
END_TEST;
}
-int UtcDaliPanGestureDynamicAllocation(void)
-{
- PanGesture* gesture = new PanGesture( Gesture::Started );
- DALI_TEST_EQUALS(Gesture::Started, gesture->state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, gesture->numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pan, gesture->type, TEST_LOCATION);
- delete gesture;
-
- END_TEST;
-}
-
-int UtcDaliPanGestureDetectorRegisterProperty(void)
+int UtcDaliPanGestureDetectorRegisterPropertyP(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliPanGestureSetGetTimeP(void)
+{
+ PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
+ DALI_TEST_EQUALS(0, gesture.GetTime(), TEST_LOCATION);
+
+ DevelPanGesture::SetTime( gesture, 123123 );
+
+ DALI_TEST_EQUALS(123123, gesture.GetTime(), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliPanGestureSetGetVelocityP(void)
+{
+ PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
+ DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetVelocity(), TEST_LOCATION);
+
+ DevelPanGesture::SetVelocity( gesture, Vector2(123.0f, 321.0f) );
+
+ DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetVelocity(), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliPanGestureSetGetDisplacementP(void)
+{
+ PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
+ DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetDisplacement(), TEST_LOCATION);
+
+ DevelPanGesture::SetDisplacement( gesture, Vector2(123.0f, 321.0f) );
+
+ DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetDisplacement(), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliPanGestureSetGetPositionP(void)
+{
+ PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
+ DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetPosition(), TEST_LOCATION);
+
+ DevelPanGesture::SetPosition( gesture, Vector2(123.0f, 321.0f) );
+
+ DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetPosition(), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliPanGestureSetGetScreenVelocityP(void)
+{
+ PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
+ DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetScreenVelocity(), TEST_LOCATION);
+
+ DevelPanGesture::SetScreenVelocity( gesture, Vector2(123.0f, 321.0f) );
+
+ DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetScreenVelocity(), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliPanGestureSetGetScreenDisplacementP(void)
+{
+ PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
+ DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetScreenDisplacement(), TEST_LOCATION);
+
+ DevelPanGesture::SetScreenDisplacement( gesture, Vector2(123.0f, 321.0f) );
+
+ DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetScreenDisplacement(), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliPanGestureSetGetScreenPositionP(void)
+{
+ PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
+ DALI_TEST_EQUALS(Vector2::ZERO, gesture.GetScreenPosition(), TEST_LOCATION);
+
+ DevelPanGesture::SetScreenPosition( gesture, Vector2(123.0f, 321.0f) );
+
+ DALI_TEST_EQUALS(Vector2(123.0f, 321.0f), gesture.GetScreenPosition(), TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliPanGestureSetGetNumberOfTouchesP(void)
+{
+ PanGesture gesture = DevelPanGesture::New( GestureState::STARTED );
+ DALI_TEST_EQUALS(1u, gesture.GetNumberOfTouches(), TEST_LOCATION);
+
+ DevelPanGesture::SetNumberOfTouches( gesture, 3123 );
+
+ DALI_TEST_EQUALS(3123, gesture.GetNumberOfTouches(), TEST_LOCATION);
+ END_TEST;
+}
#include <dali/integration-api/input-options.h>
#include <dali-test-suite-utils.h>
#include <test-touch-event-utils.h>
+#include <dali/devel-api/events/pan-gesture-devel.h>
using namespace Dali;
SignalData()
: functorCalled(false),
voidFunctorCalled(false),
- receivedGesture(Gesture::Clear)
+ receivedGesture()
{}
void Reset()
functorCalled = false;
voidFunctorCalled = false;
- receivedGesture.state = Gesture::Clear;
- receivedGesture.velocity = Vector2(0.0f, 0.0f);
- receivedGesture.displacement = Vector2(0.0f, 0.0f);
- receivedGesture.position = Vector2(0.0f, 0.0f);
- receivedGesture.screenPosition = Vector2(0.0f, 0.0f);
- receivedGesture.numberOfTouches = 0;
+ receivedGesture.Reset();
pannedActor.Reset();
}
// Functor that removes the gestured actor from stage
struct UnstageActorFunctor : public GestureReceivedFunctor
{
- UnstageActorFunctor( SignalData& data, Gesture::State& stateToUnstage, Integration::Scene scene )
+ UnstageActorFunctor( SignalData& data, GestureState& stateToUnstage, Integration::Scene scene )
: GestureReceivedFunctor( data ),
stateToUnstage( stateToUnstage ),
scene( scene )
{
GestureReceivedFunctor::operator()( actor, pan );
- if ( pan.state == stateToUnstage )
+ if ( pan.GetState() == stateToUnstage )
{
scene.Remove( actor );
}
}
- Gesture::State& stateToUnstage;
+ GestureState& stateToUnstage;
Integration::Scene scene;
};
// Generate a PanGesture
PanGesture GeneratePan( unsigned int time,
- Gesture::State state,
+ GestureState state,
Vector2 screenPosition,
Vector2 localPosition,
Vector2 screenDisplacement = Vector2::ONE,
Vector2 localVelocity = Vector2::ONE,
unsigned int numberOfTouches = 1 )
{
- PanGesture pan( state );
+ Dali::PanGesture pan = DevelPanGesture::New( state );
- pan.time = time;
+ DevelPanGesture::SetTime( pan, time );
- pan.screenPosition = screenPosition;
- pan.position = localPosition;
+ DevelPanGesture::SetScreenPosition( pan, screenPosition );
+ DevelPanGesture::SetPosition( pan, localPosition );
- pan.screenDisplacement = screenDisplacement;
- pan.displacement = localDisplacement;
+ DevelPanGesture::SetScreenDisplacement( pan, screenDisplacement );
+ DevelPanGesture::SetDisplacement( pan, localDisplacement );
- pan.screenVelocity = screenVelocity;
- pan.velocity = localVelocity;
+ DevelPanGesture::SetScreenVelocity( pan, screenVelocity );
+ DevelPanGesture::SetVelocity( pan, localVelocity );
- pan.numberOfTouches = numberOfTouches;
+ DevelPanGesture::SetNumberOfTouches( pan, numberOfTouches );
return pan;
}
TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(16.0f, 0.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(0.5f, 0.0f), data.receivedGesture.velocity, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(16.0f, 0.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(0.5f, 0.0f), data.receivedGesture.GetVelocity(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(16.0f, data.receivedGesture.GetDistance(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(0.5f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(0.0f, -16.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(0.0f, -1.0f), data.receivedGesture.velocity, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(0.0f, -16.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(0.0f, -1.0f), data.receivedGesture.GetVelocity(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(16.0f, data.receivedGesture.GetDistance(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(1.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(320.0f, 0.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(20.0f, 0.0f), data.receivedGesture.velocity, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(320.0f, 0.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(20.0f, 0.0f), data.receivedGesture.GetVelocity(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(320.0f, data.receivedGesture.GetDistance(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(20.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
TestEndPan( application, Vector2(314.0f, 4.0f), time );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Finished, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(-32.0f, 0.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(-2.0f, 0.0f), data.receivedGesture.velocity, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(-32.0f, 0.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(-2.0f, 0.0f), data.receivedGesture.GetVelocity(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(32.0f, data.receivedGesture.GetDistance(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(2.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
END_TEST;
TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(16.0f, 0.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(0.5f, 0.0f), data.receivedGesture.velocity, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(16.0f, 0.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(0.5f, 0.0f), data.receivedGesture.GetVelocity(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(16.0f, data.receivedGesture.GetDistance(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(0.5f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(0.0f, -16.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(0.0f, -1.0f), data.receivedGesture.velocity, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(0.0f, -16.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(0.0f, -1.0f), data.receivedGesture.GetVelocity(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(16.0f, data.receivedGesture.GetDistance(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(1.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
TestEndPan( application, Vector2(10.0f, 4.0f), time );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Finished, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(-16.0f, 0.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(-1.0f, 0.0f), data.receivedGesture.velocity, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(-16.0f, 0.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(-1.0f, 0.0f), data.receivedGesture.GetVelocity(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(16.0f, data.receivedGesture.GetDistance(), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(1.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
END_TEST;
TestEndPan( application, Vector2(25.0f, 28.0f), time );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(16.0f, 2.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION); // Actor relative
+ DALI_TEST_EQUALS(Vector2(16.0f, 2.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); // Actor relative
// Rotate actor again and render a couple of times
actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS) );
TestEndPan( application, Vector2(25.0f, 28.0f), time );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(2.0f, -16.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION); // Actor relative
+ DALI_TEST_EQUALS(Vector2(2.0f, -16.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); // Actor relative
// Rotate actor again and render a couple of times
actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(270.0f), Vector3::ZAXIS) );
TestEndPan( application, Vector2(25.0f, 28.0f), time );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(-16.0f, -2.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION); // Actor relative
+ DALI_TEST_EQUALS(Vector2(-16.0f, -2.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); // Actor relative
END_TEST;
}
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, parent == data.pannedActor, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(-2.0f, 16.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION); // Actor relative
+ DALI_TEST_EQUALS(Vector2(-2.0f, 16.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); // Actor relative
// Attach child and generate same touch points to yield a different displacement
// (Also proves that you can detach and then re-attach another actor)
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, child == data.pannedActor, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(16.0f, 2.0f), data.receivedGesture.displacement, 0.01f, TEST_LOCATION); // Actor relative
+ DALI_TEST_EQUALS(Vector2(16.0f, 2.0f), data.receivedGesture.GetDisplacement(), 0.01f, TEST_LOCATION); // Actor relative
END_TEST;
}
application.SendNotification();
application.Render();
- // Emit Started event, we should not receive the pan.
+ // Emit STARTED event, we should not receive the pan.
TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
TestEndPan( application, Vector2( 26.0f, 20.0f ), time );
time += TestGetFrameInterval();
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
- // LongPress possible in empty area.
+ // LONG_PRESS possible in empty area.
TestStartLongPress( application, 10.0f, 20.0f, time );
time += TestGetFrameInterval();
application.SendNotification();
application.Render();
- // Emit Started event, we should be receiving the pan now.
+ // Emit STARTED event, we should be receiving the pan now.
TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
TestEndPan( application, Vector2( 26.0f, 20.0f ), time );
time += TestGetFrameInterval();
application.Render();
// State to remove actor in.
- Gesture::State stateToUnstage( Gesture::Started );
+ GestureState stateToUnstage( GestureState::STARTED );
// Attach actor to detector
SignalData data;
application.SendNotification();
application.Render();
- // Change state to Gesture::Continuing to remove
- stateToUnstage = Gesture::Continuing;
+ // Change state to GestureState::CONTINUING to remove
+ stateToUnstage = GestureState::CONTINUING;
// Emit signals
TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
application.SendNotification();
application.Render();
- // Change state to Gesture::Finished to remove
- stateToUnstage = Gesture::Finished;
+ // Change state to GestureState::FINISHED to remove
+ stateToUnstage = GestureState::FINISHED;
// Emit signals
TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
application.Render();
// State to remove actor in.
- Gesture::State stateToUnstage( Gesture::Started );
+ GestureState stateToUnstage( GestureState::STARTED );
// Attach actor to detector
SignalData data;
detector.Attach(dummyActor);
detector.DetectedSignal().Connect( &application, functor );
- // Here we are testing a Started actor which is removed in the Started callback, but then added back
+ // Here we are testing a STARTED actor which is removed in the STARTED callback, but then added back
// before we get a continuing state. As we were removed from the stage, even if we're at the same
// position, we should still not be signalled.
Vector2 localDisplacement( 0.5f, 0.5f );
Vector2 localVelocity( 1.5f, 2.5f );
- PanGestureDetector::SetPanGestureProperties( GeneratePan( 1u, Gesture::Started, screenPosition, localPosition, screenDisplacement, localDisplacement, screenVelocity, localVelocity ) );
+ PanGestureDetector::SetPanGestureProperties( GeneratePan( 1u, GestureState::STARTED, screenPosition, localPosition, screenDisplacement, localDisplacement, screenVelocity, localVelocity ) );
DALI_TEST_EQUALS( renderController.WasCalled( TestRenderController::RequestUpdateFunc ), true, TEST_LOCATION );
// Render and notify
Vector2 screenPosition( 100.0f, 20.0f );
Vector2 localPosition( 110.0f, 110.0f );
- PanGestureDetector::SetPanGestureProperties( GeneratePan( 1u, Gesture::Started, screenPosition, localPosition ) );
+ PanGestureDetector::SetPanGestureProperties( GeneratePan( 1u, GestureState::STARTED, screenPosition, localPosition ) );
// Render and notify
application.SendNotification();
TestEndPan( application, Vector2(26.0f, 20.0f), 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_CHECK( !std::isinf( data.receivedGesture.velocity.x ) );
- DALI_TEST_CHECK( !std::isinf( data.receivedGesture.velocity.y ) );
- DALI_TEST_CHECK( !std::isinf( data.receivedGesture.screenVelocity.x ) );
- DALI_TEST_CHECK( !std::isinf( data.receivedGesture.screenVelocity.y ) );
+ DALI_TEST_CHECK( !std::isinf( data.receivedGesture.GetVelocity().x ) );
+ DALI_TEST_CHECK( !std::isinf( data.receivedGesture.GetVelocity().y ) );
+ DALI_TEST_CHECK( !std::isinf( data.receivedGesture.GetScreenVelocity().x ) );
+ DALI_TEST_CHECK( !std::isinf( data.receivedGesture.GetScreenVelocity().y ) );
data.Reset();
data.Reset();
bool consume = false;
TouchEventFunctorConsumeSetter touchFunctor(consume);
- actor.TouchSignal().Connect(&application,touchFunctor);
+ actor.TouchedSignal().Connect(&application,touchFunctor);
// Render and notify
application.SendNotification();
TestStartPan( application, Vector2( 10.0f, 20.0f ), Vector2( 26.0f, 20.0f ), time );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
data.Reset();
// Continue the gesture within the actor's area, but now the touch consumes thus cancelling the gesture
time += TestGetFrameInterval();
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Cancelled, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CANCELLED, data.receivedGesture.GetState(), TEST_LOCATION);
END_TEST;
}
&application,
[&detector, &functorCalled](Actor actor, const PanGesture& pan)
{
- if( pan.state == Gesture::Finished )
+ if( pan.GetState() == GestureState::FINISHED )
{
detector.Detach(actor);
functorCalled = true;
#include <dali/integration-api/render-task-list-integ.h>
#include <dali-test-suite-utils.h>
-
using namespace Dali;
///////////////////////////////////////////////////////////////////////////////
functorCalled = false;
voidFunctorCalled = false;
- receivedGesture.state = Gesture::Started;
+ receivedGesture.Reset();
pannedActor.Reset();
}
application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), 151 ) );
application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 60.0f ), 152 ) );
- application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 60.0f ), 153 ) ); // Exercise default case in Started case. Not sure if realistic
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 60.0f ), 153 ) ); // Exercise default case in STARTED case. Not sure if realistic
application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 65.0f ), 154 ) );
application.SendNotification();
+++ /dev/null
-/*
- * Copyright (c) 2014 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 <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali-test-suite-utils.h>
-
-using namespace Dali;
-
-void utc_dali_pinch_gesture_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_pinch_gesture_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-// Positive test case for a method
-int UtcDaliPinchGestureConstructor(void)
-{
- TestApplication application; // Reset all test adapter return codes
-
- PinchGesture gesture(Gesture::Started);
- DALI_TEST_EQUALS(Gesture::Started, gesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture.scale, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture.speed, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pinch, gesture.type, TEST_LOCATION);
-
- PinchGesture gesture2(Gesture::Continuing);
- DALI_TEST_EQUALS(Gesture::Continuing, gesture2.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture2.scale, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture2.speed, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pinch, gesture2.type, TEST_LOCATION);
-
- PinchGesture gesture3(Gesture::Finished);
- DALI_TEST_EQUALS(Gesture::Finished, gesture3.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture3.scale, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture3.speed, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pinch, gesture3.type, TEST_LOCATION);
-
- // Test copy constructor
- gesture3.scale = 3.0f;
- gesture3.speed = 5.0f;
-
- PinchGesture pinch(gesture3);
- DALI_TEST_EQUALS(Gesture::Finished, pinch.state, TEST_LOCATION);
- DALI_TEST_EQUALS(3.0f, pinch.scale, TEST_LOCATION);
- DALI_TEST_EQUALS(5.0f, pinch.speed, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pinch, pinch.type, TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliPinchGestureAssignment(void)
-{
- // Test Assignment operator
- PinchGesture gesture(Gesture::Started);
- DALI_TEST_EQUALS(Gesture::Started, gesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture.scale, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture.speed, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pinch, gesture.type, TEST_LOCATION);
-
- PinchGesture gesture2(Gesture::Continuing);
- DALI_TEST_EQUALS(Gesture::Continuing, gesture2.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture2.scale, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture2.speed, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pinch, gesture2.type, TEST_LOCATION);
-
- gesture2.scale = 3.0f;
- gesture2.speed = 5.0f;
-
- gesture = gesture2;
- DALI_TEST_EQUALS(Gesture::Continuing, gesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(3.0f, gesture.scale, TEST_LOCATION);
- DALI_TEST_EQUALS(5.0f, gesture.speed, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pinch, gesture.type, TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliPinchGestureDynamicAllocation(void)
-{
- PinchGesture* gesture = new PinchGesture( Gesture::Started );
- DALI_TEST_EQUALS(Gesture::Started, gesture->state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture->scale, TEST_LOCATION);
- DALI_TEST_EQUALS(0.0f, gesture->speed, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Pinch, gesture->type, TEST_LOCATION);
- delete gesture;
-
- END_TEST;
-}
SignalData()
: functorCalled(false),
voidFunctorCalled(false),
- receivedGesture(Gesture::Started)
+ receivedGesture()
{}
void Reset()
functorCalled = false;
voidFunctorCalled = false;
- receivedGesture.state = Gesture::Started;
- receivedGesture.scale = 0.0f;
- receivedGesture.speed = 0.0f;
- receivedGesture.screenCenterPoint = Vector2(0.0f, 0.0f);
- receivedGesture.localCenterPoint = Vector2(0.0f, 0.0f);
+ receivedGesture.Reset();
pinchedActor.Reset();
}
// Functor that removes the gestured actor from stage
struct UnstageActorFunctor : public GestureReceivedFunctor
{
- UnstageActorFunctor( SignalData& data, Gesture::State& stateToUnstage, Integration::Scene scene )
+ UnstageActorFunctor( SignalData& data, GestureState& stateToUnstage, Integration::Scene scene )
: GestureReceivedFunctor( data ),
stateToUnstage( stateToUnstage ),
scene( scene )
{
GestureReceivedFunctor::operator()( actor, pinch );
- if ( pinch.state == stateToUnstage )
+ if ( pinch.GetState() == stateToUnstage )
{
scene.Remove( actor );
}
}
- Gesture::State& stateToUnstage;
+ GestureState& stateToUnstage;
Integration::Scene scene;
};
TestStartPinch( application, Vector2( 5.0f, 20.0f ), Vector2( 35.0f, 20.0f ),
Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.666f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(66.666f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.666f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(66.666f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Continue the pan within the actor's area - we should still receive the signal
data.Reset();
TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
Vector2( 17.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 400 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.2666f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(80.0f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(21.0f, 20.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.2666f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(80.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(21.0f, 20.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(21.0f, 20.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
- // Pan Gesture leaves actor's area - we should still receive the signal
+ // Pinch Gesture leaves actor's area - we should still receive the signal
data.Reset();
TestContinuePinch( application, Vector2( 17.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
Vector2( 300.0f, 10.0f ), Vector2( 340.0f, 10.0f ), 1000 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(1.333f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(213.333f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(320.0f, 10.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1.333f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(213.333f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(320.0f, 10.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(320.0f, 10.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Gesture ends - we would receive a finished state
data.Reset();
TestEndPinch( application, Vector2( 300.0f, 10.0f ), Vector2( 340.0f, 10.0f ),
Vector2( 305.0f, 10.0f ), Vector2( 315.0f, 10.0f ), 1500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Finished, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.333f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(600.0f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(310.0f, 10.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.333f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(600.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(310.0f, 10.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(310.0f, 10.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
END_TEST;
}
TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.555f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(106.667f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.555f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(106.667f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Continue the pinch within the actor's area - we should still receive the signal
data.Reset();
TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.277f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(66.666f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.277f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(66.666f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Gesture ends within actor's area - we would receive a finished state
data.Reset();
TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Finished, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.055f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(160.0f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.055f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(160.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
END_TEST;
}
TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
// Continue the pinch within the actor's area - we should still receive the signal
TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
// Gesture ends within actor's area
data.Reset();
TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Finished, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION);
// Detach actor
detector.DetachAll();
TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
// Continue the pinch within the actor's area - we should still receive the signal
data.Reset();
TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
// Detach actor during the pinch, we should not receive the next event
detector.DetachAll();
TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
// Continue the pinch within the actor's area - we should still receive the signal
data.Reset();
TestContinuePinch( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
// Remove the actor from stage and reset the data
application.GetScene().Remove(actor);
TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(0.055f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(160.0f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(0.055f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(160.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(70.0f, 30.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Rotate actor again and render and notify
actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS) );
TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 3000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(0.055f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(160.0f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(0.055f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(160.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(30.0f, 30.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Rotate actor again and render and notify
actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(270.0f), Vector3::ZAXIS) );
TestEndPinch( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 5000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(0.055f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(160.0f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(0.055f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(160.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(30.0f, 70.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
END_TEST;
}
Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, parent == data.pinchedActor, TEST_LOCATION);
- DALI_TEST_EQUALS(0.055f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(160.0f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(0.055f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(160.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
// Attach child and generate same touch points to yield same results
// (Also proves that you can detach and then re-attach another actor)
Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 3000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, child == data.pinchedActor, TEST_LOCATION);
- DALI_TEST_EQUALS(0.055f, data.receivedGesture.scale, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(160.0f, data.receivedGesture.speed, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(0.055f, data.receivedGesture.GetScale(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(160.0f, data.receivedGesture.GetSpeed(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(20.0f, 20.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(20.0f, 80.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
END_TEST;
}
application.Render();
// State to remove actor in.
- Gesture::State stateToUnstage( Gesture::Started );
+ GestureState stateToUnstage( GestureState::STARTED );
// Attach actor to detector
SignalData data;
application.SendNotification();
application.Render();
- // Change state to Gesture::Continuing to remove
- stateToUnstage = Gesture::Continuing;
+ // Change state to GestureState::CONTINUING to remove
+ stateToUnstage = GestureState::CONTINUING;
// Emit signals
TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
application.SendNotification();
application.Render();
- // Change state to Gesture::Continuing to remove
- stateToUnstage = Gesture::Finished;
+ // Change state to GestureState::CONTINUING to remove
+ stateToUnstage = GestureState::FINISHED;
// Emit signals
TestStartPinch( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
application.Render();
// State to remove actor in.
- Gesture::State stateToUnstage( Gesture::Started );
+ GestureState stateToUnstage( GestureState::STARTED );
// Attach actor to detector
SignalData data;
detector.Attach(dummyActor);
detector.DetectedSignal().Connect( &application, functor );
- // Here we are testing a Started actor which is removed in the Started callback, but then added back
+ // Here we are testing a STARTED actor which is removed in the STARTED callback, but then added back
// before we get a continuing state. As we were removed from the stage, even if we're at the same
// position, we should still not be signalled.
bool consume = false;
TouchEventFunctorConsumeSetter touchFunctor(consume);
- actor.TouchSignal().Connect(&application,touchFunctor);
+ actor.TouchedSignal().Connect(&application,touchFunctor);
// Render and notify
application.SendNotification();
Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
data.Reset();
// Continue the gesture within the actor's area, but now the touch consumes thus cancelling the gesture
Vector2( 5.0f, 5.0f ), Vector2( 35.0f, 35.0f ), 200 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Cancelled, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CANCELLED, data.receivedGesture.GetState(), TEST_LOCATION);
data.Reset();
// Start another pinch, we should not even get the callback this time
&application,
[&detector, &functorCalled](Actor actor, const PinchGesture& gesture)
{
- if( gesture.state == Gesture::Finished )
+ if( gesture.GetState() == GestureState::FINISHED )
{
detector.Detach(actor);
functorCalled = true;
SignalData()
: functorCalled(false),
voidFunctorCalled(false),
- receivedGesture(Gesture::Started)
+ receivedGesture()
{}
void Reset()
functorCalled = false;
voidFunctorCalled = false;
- receivedGesture.state = Gesture::Started;
+ receivedGesture.Reset();
pinchedActor.Reset();
}
application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 90.0f, 90.0f ), 160 ) );
- DALI_TEST_EQUALS( Gesture::Started, data.receivedGesture.state, TEST_LOCATION );
+ DALI_TEST_EQUALS( GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 90.0f, 90.0f ), 160 ) );
- DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 170 ) );
application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 180 ) );
application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 190 ) );
application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 200 ) );
- // > Test : not enough touch events to make the gesture state "Continuing"
- DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.state, TEST_LOCATION);
+ // > Test : not enough touch events to make the gesture state "CONTINUING"
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 210 ) );
application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 220 ) );
- // > Test : 6 touch events after start make the gesture state "Continuing"
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
+ // > Test : 6 touch events after start make the gesture state "CONTINUING"
+ DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
END_TEST;
}
PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X,
GreaterThanCondition(100.0f));
- notification.SetNotifyMode(PropertyNotification::NotifyOnChanged);
+ notification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED);
PropertyNotification::NotifyMode notifyMode = notification.GetNotifyMode();
- DALI_TEST_EQUALS( notifyMode, PropertyNotification::NotifyOnChanged, TEST_LOCATION );
+ DALI_TEST_EQUALS( notifyMode, PropertyNotification::NOTIFY_ON_CHANGED, TEST_LOCATION );
END_TEST;
}
PropertyNotification notification = actor.AddPropertyNotification(Actor::Property::POSITION_X,
GreaterThanCondition(100.0f));
- notification.SetNotifyMode(PropertyNotification::NotifyOnChanged);
+ notification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED);
gCallBackCalled = false;
notification.NotifySignal().Connect( &TestCallback );
Actor actor = Actor::New();
PropertyNotification notification = actor.AddPropertyNotification( Actor::Property::SIZE, StepCondition( 1.0f, 1.0f ) );
- notification.SetNotifyMode(PropertyNotification::NotifyOnChanged);
+ notification.SetNotifyMode(PropertyNotification::NOTIFY_ON_CHANGED);
gCallBackCalled = false;
notification.NotifySignal().Connect( &TestCallback );
+++ /dev/null
-/*
- * 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.
- * 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 <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali-test-suite-utils.h>
-
-using namespace Dali;
-
-void utc_dali_rotation_gesture_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_rotation_gesture_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-// Positive test case for a method
-int UtcDaliRotationGestureConstructor(void)
-{
- TestApplication application; // Reset all test adapter return codes
-
- 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(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(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(Gesture::Rotation, gesture3.type, TEST_LOCATION);
-
- // Test copy constructor
- gesture3.rotation = 3.0f;
-
- 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(Gesture::Rotation, rotation.type, TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliRotationGestureAssignment(void)
-{
- // Test Assignment operator
- 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(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(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(Gesture::Rotation, gesture.type, TEST_LOCATION);
- END_TEST;
-}
-
-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(Gesture::Rotation, gesture->type, TEST_LOCATION);
- delete gesture;
-
- END_TEST;
-}
SignalData()
: functorCalled(false),
voidFunctorCalled(false),
- receivedGesture(Gesture::Started)
+ receivedGesture()
{}
void Reset()
functorCalled = false;
voidFunctorCalled = false;
- receivedGesture.state = Gesture::Started;
- receivedGesture.rotation = 0.0f;
- receivedGesture.screenCenterPoint = Vector2(0.0f, 0.0f);
- receivedGesture.localCenterPoint = Vector2(0.0f, 0.0f);
+ receivedGesture.Reset();
rotatedActor.Reset();
}
// Functor that removes the gestured actor from stage
struct UnstageActorFunctor : public GestureReceivedFunctor
{
- UnstageActorFunctor( SignalData& data, Gesture::State& stateToUnstage, Integration::Scene scene )
+ UnstageActorFunctor( SignalData& data, GestureState& stateToUnstage, Integration::Scene scene )
: GestureReceivedFunctor( data ),
stateToUnstage( stateToUnstage ),
scene( scene )
{
GestureReceivedFunctor::operator()( actor, rotation );
- if ( rotation.state == stateToUnstage )
+ if ( rotation.GetState() == stateToUnstage )
{
scene.Remove( actor );
}
}
- Gesture::State& stateToUnstage;
+ GestureState& stateToUnstage;
Integration::Scene scene;
};
detector.Attach(actor);
detector.DetectedSignal().Connect(&application, functor);
- // Start pan within the actor's area
+ // Start rotation within the actor's area
TestStartRotation( application, Vector2( 5.0f, 5.0f ), Vector2( 20.0f, 20.0f ),
Vector2( 5.0f, 5.0f ), Vector2( 20.0f, 30.0f ), 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.244f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(12.5f, 17.5f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.244f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(12.5f, 17.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(12.48f, 17.5f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
- // Continue the pan within the actor's area - we should still receive the signal
+ // Continue the rotation within the actor's area - we should still receive the signal
data.Reset();
TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
Vector2( 17.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 400 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(-0.785398f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(21.0f, 20.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(-0.785398f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(21.0f, 20.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(21.0f, 20.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
- // Pan Gesture leaves actor's area - we should still receive the signal
+ // Rotation Gesture leaves actor's area - we should still receive the signal
data.Reset();
TestContinueRotation( application, Vector2( 17.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
Vector2( 300.0f, 10.0f ), Vector2( 340.0f, 10.0f ), 1000 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(-0.785398f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(320.0f, 10.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(-0.785398f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(320.0f, 10.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(320.0f, 10.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Gesture ends - we would receive a finished state
data.Reset();
TestEndRotation( application, Vector2( 300.0f, 10.0f ), Vector2( 340.0f, 10.0f ),
Vector2( 305.0f, 10.0f ), Vector2( 315.0f, 10.0f ), 1500);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Finished, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(-0.785398f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(310.0f, 10.0f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(-0.785398f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(310.0f, 10.0f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(310.0f, 10.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
END_TEST;
}
TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
Vector2( 10.0f, 20.0f ), Vector2( 31.0f, 29.0f ), 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(0.404892f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(20.5f, 24.5f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(0.404892f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(20.5f, 24.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(20.5f, 24.5f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Continue the rotation within the actor's area - we should still receive the signal
data.Reset();
TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
Vector2( 15.0f, 20.0f ), Vector2( 29.0f, 15.0f ), 500 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(-0.343024f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(22.0f, 17.5f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(-0.343024f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(22.0f, 17.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(22.0f, 17.5f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Gesture ends within actor's area - we would receive a finished state
data.Reset();
TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
Vector2( 19.0f, 20.0f ), Vector2( 29.0f, 15.0f ), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Finished, data.receivedGesture.state, TEST_LOCATION);
- DALI_TEST_EQUALS(-0.463648f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(24.0f, 17.5f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION);
+ DALI_TEST_EQUALS(-0.463648f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(24.0f, 17.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(24.0f, 17.5f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
END_TEST;
}
TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
// Continue the rotation within the actor's area - we should still receive the signal
TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
// Gesture ends within actor's area
data.Reset();
TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
Vector2( 19.0f, 20.0f ), Vector2( 21.0f, 20.0f ), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Finished, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::FINISHED, data.receivedGesture.GetState(), TEST_LOCATION);
// Detach actor
detector.DetachAll();
TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
// Continue the rotation within the actor's area - we should still receive the signal
data.Reset();
TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
// Detach actor during the rotation, we should not receive the next event
detector.DetachAll();
TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
// Continue the rotation within the actor's area - we should still receive the signal
data.Reset();
TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
// Remove the actor from stage and reset the data
application.GetScene().Remove(actor);
TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
Vector2( 19.0f, 20.0f ), Vector2( 27.0f, 15.0f ), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(-0.558599f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(23.0f, 17.5f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(-0.558599f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(23.0f, 17.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(67.5f, 27.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Rotate actor again and render and notify
actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS) );
TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
Vector2( 19.0f, 20.0f ), Vector2( 27.0f, 15.0f ), 3000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(-0.558599f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(23.0f, 17.5f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(-0.558599f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(23.0f, 17.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(27.0f, 32.5f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Rotate actor again and render and notify
actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(270.0f), Vector3::ZAXIS) );
TestEndRotation( application, Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ),
Vector2( 19.0f, 20.0f ), Vector2( 27.0f, 15.0f ), 5000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(-0.558599f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(23.0f, 17.5f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(-0.558599f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(23.0f, 17.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(32.5f, 73.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
END_TEST;
}
Vector2( 19.0f, 20.0f ), Vector2( 29.0f, 25.0f ), 1000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, parent == data.rotatedActor, TEST_LOCATION);
- DALI_TEST_EQUALS(0.463648f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(24.0f, 22.5f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(0.463648f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(24.0f, 22.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(24.0f, 22.5f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
// Attach child and generate same touch points to yield same results
// (Also proves that you can detach and then re-attach another actor)
Vector2( 19.0f, 20.0f ), Vector2( 29.0f, 35.0f ), 3000);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, child == data.rotatedActor, TEST_LOCATION);
- DALI_TEST_EQUALS(0.982794f, data.receivedGesture.rotation.radian, 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(24.0f, 27.5f), data.receivedGesture.screenCenterPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(0.982794f, data.receivedGesture.GetRotation().radian, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(24.0f, 27.5f), data.receivedGesture.GetScreenCenterPoint(), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(27.5f, 76.0f), data.receivedGesture.GetLocalCenterPoint(), 0.01f, TEST_LOCATION);
END_TEST;
}
Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- // Pan continues within actor's area
+ // Rotation continues within actor's area
data.Reset();
TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
application.Render();
// State to remove actor in.
- Gesture::State stateToUnstage( Gesture::Started );
+ GestureState stateToUnstage( GestureState::STARTED );
// Attach actor to detector
SignalData data;
application.SendNotification();
application.Render();
- // Change state to Gesture::Continuing to remove
- stateToUnstage = Gesture::Continuing;
+ // Change state to GestureState::CONTINUING to remove
+ stateToUnstage = GestureState::CONTINUING;
// Emit signals
TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
application.SendNotification();
application.Render();
- // Change state to Gesture::Continuing to remove
- stateToUnstage = Gesture::Finished;
+ // Change state to GestureState::CONTINUING to remove
+ stateToUnstage = GestureState::FINISHED;
// Emit signals
TestStartRotation( application, Vector2( 2.0f, 20.0f ), Vector2( 38.0f, 20.0f ),
application.Render();
// State to remove actor in.
- Gesture::State stateToUnstage( Gesture::Started );
+ GestureState stateToUnstage( GestureState::STARTED );
// Attach actor to detector
SignalData data;
detector.Attach(dummyActor);
detector.DetectedSignal().Connect( &application, functor );
- // Here we are testing a Started actor which is removed in the Started callback, but then added back
+ // Here we are testing a STARTED actor which is removed in the STARTED callback, but then added back
// before we get a continuing state. As we were removed from the stage, even if we're at the same
// position, we should still not be signalled.
bool consume = false;
TouchEventFunctorConsumeSetter touchFunctor(consume);
- actor.TouchSignal().Connect(&application,touchFunctor);
+ actor.TouchedSignal().Connect(&application,touchFunctor);
// Render and notify
application.SendNotification();
Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ), 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
data.Reset();
// Continue the gesture within the actor's area, but now the touch consumes thus cancelling the gesture
TestContinueRotation( application, Vector2( 10.0f, 20.0f ), Vector2( 30.0f, 20.0f ),
Vector2( 15.0f, 20.0f ), Vector2( 25.0f, 20.0f ), 500 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Cancelled, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::CANCELLED, data.receivedGesture.GetState(), TEST_LOCATION);
data.Reset();
// Start another rotation, we should not even get the callback this time
&application,
[&detector, &functorCalled](Actor actor, const RotationGesture& gesture)
{
- if( gesture.state == Gesture::Finished )
+ if( gesture.GetState() == GestureState::FINISHED )
{
detector.Detach(actor);
functorCalled = true;
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali-test-suite-utils.h>
-
using namespace Dali;
void utc_dali_rotation_gesture_recognizer_startup(void)
SignalData()
: functorCalled(false),
voidFunctorCalled(false),
- receivedGesture(Gesture::Started)
+ receivedGesture()
{}
void Reset()
functorCalled = false;
voidFunctorCalled = false;
- receivedGesture.state = Gesture::Started;
- receivedGesture.rotation = 0.0f;
- receivedGesture.screenCenterPoint = Vector2(0.0f, 0.0f);
- receivedGesture.localCenterPoint = Vector2(0.0f, 0.0f);
+ receivedGesture.Reset();
rotatedActor.Reset();
}
SignalData& signalData;
};
+Integration::TouchEvent GenerateSingleTouch( PointState::Type state, const Vector2& screenPosition, uint32_t time )
+{
+ Integration::TouchEvent touchEvent;
+ Integration::Point point;
+ point.SetState( state );
+ point.SetScreenPosition( screenPosition );
+ point.SetDeviceClass( Device::Class::TOUCH );
+ point.SetDeviceSubclass( Device::Subclass::NONE );
+ touchEvent.points.push_back( point );
+ touchEvent.time = time;
+ return touchEvent;
+}
+
Integration::TouchEvent GenerateDoubleTouch( PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time )
{
Integration::TouchEvent touchEvent;
} // anon namespace
///////////////////////////////////////////////////////////////////////////////
+int UtcDaliRotationGestureRecognizerRealistic(void)
+{
+ TestApplication application;
+
+ RotationGestureDetector detector = RotationGestureDetector::New();
+
+ Actor actor = Actor::New();
+ actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
+ actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ application.GetScene().Add( actor );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ detector.Attach(actor);
+
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ detector.DetectedSignal().Connect(&application, functor);
+
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 100 ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 20.0f ), 105 ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 110 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 25.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 115 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 30.0f ), PointState::MOTION, Vector2( 20.0f, 85.0f ), 120 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 35.0f ), PointState::MOTION, Vector2( 20.0f, 80.0f ), 125 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 40.0f ), PointState::MOTION, Vector2( 20.0f, 75.0f ), 130 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 45.0f ), PointState::MOTION, Vector2( 20.0f, 70.0f ), 135 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 50.0f ), PointState::MOTION, Vector2( 20.0f, 65.0f ), 140 ) );
+ application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 55.0f ), PointState::MOTION, Vector2( 20.0f, 60.0f ), 145 ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::UP, Vector2( 20.0f, 56.0f ), 155 ) );
+
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliRotationGestureRecognizerBasicInterrupted(void)
+{
+ TestApplication application;
+
+ RotationGestureDetector detector = RotationGestureDetector::New();
+
+ Actor actor = Actor::New();
+ actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
+ actor.SetProperty( Actor::Property::ANCHOR_POINT,AnchorPoint::TOP_LEFT);
+ application.GetScene().Add( actor );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ detector.Attach(actor);
+
+ SignalData data;
+ GestureReceivedFunctor functor(data);
+ detector.DetectedSignal().Connect(&application, functor);
+
+ // application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), 150 ) );
+ // application.ProcessEvent( GenerateSingleTouch( PointState::MOTION, Vector2( 20.0f, 25.0f ), 151 ) );
+ application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 20.0f, 30.0f ), 152 ) );
+
+ application.SendNotification();
+
+ DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+
+ END_TEST;
+}
int UtcDaliRotationGestureRecognizerMinimumTouchEvents(void)
{
application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 90.0f, 90.0f ), 160 ) );
- DALI_TEST_EQUALS( Gesture::Started, data.receivedGesture.state, TEST_LOCATION );
+ DALI_TEST_EQUALS( GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
application.ProcessEvent( GenerateDoubleTouch( PointState::DOWN, Vector2( 20.0f, 20.0f ), PointState::DOWN, Vector2( 20.0f, 90.0f ), 150 ) );
application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 90.0f, 90.0f ), 160 ) );
- DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.state, TEST_LOCATION);
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 170 ) );
application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 180 ) );
application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 190 ) );
application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 200 ) );
- // > Test : not enough touch events to make the gesture state "Continuing"
- DALI_TEST_EQUALS(Gesture::Started, data.receivedGesture.state, TEST_LOCATION);
+ // > Test : not enough touch events to make the gesture state "CONTINUING"
+ DALI_TEST_EQUALS(GestureState::STARTED, data.receivedGesture.GetState(), TEST_LOCATION);
application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 210 ) );
application.ProcessEvent( GenerateDoubleTouch( PointState::MOTION, Vector2( 20.0f, 20.0f ), PointState::MOTION, Vector2( 20.0f, 90.0f ), 220 ) );
- // > Test : 6 touch events after start make the gesture state "Continuing"
- DALI_TEST_EQUALS(Gesture::Continuing, data.receivedGesture.state, TEST_LOCATION);
+ // > Test : 6 touch events after start make the gesture state "CONTINUING"
+ DALI_TEST_EQUALS(GestureState::CONTINUING, data.receivedGesture.GetState(), TEST_LOCATION);
END_TEST;
}
TouchedSignalData data;
data.createNewScene = true;
TouchFunctor functor( data );
- scene.TouchSignal().Connect( &application, functor );
+ scene.TouchedSignal().Connect( &application, functor );
// Render and notify.
application.SendNotification();
END_TEST;
}
-int UtcDaliSceneTouchSignalP(void)
+int UtcDaliSceneTouchedSignalP(void)
{
TestApplication application;
Dali::Integration::Scene scene = application.GetScene();
TouchedSignalData data;
TouchFunctor functor( data );
- scene.TouchSignal().Connect( &application, functor );
+ scene.TouchedSignal().Connect( &application, functor );
// Render and notify.
application.SendNotification();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- actor.TouchSignal().Connect( &DummyTouchCallback );
+ actor.TouchedSignal().Connect( &DummyTouchCallback );
scene.Add( actor );
// Render and notify.
END_TEST;
}
-int UtcDaliSceneTouchSignalN(void)
+int UtcDaliSceneTouchedSignalN(void)
{
TestApplication application;
Dali::Integration::Scene scene = application.GetScene();
TouchedSignalData data;
TouchFunctor functor( data );
- scene.TouchSignal().Connect( &application, functor );
+ scene.TouchedSignal().Connect( &application, functor );
// Render and notify.
application.SendNotification();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- actor.TouchSignal().Connect( &DummyTouchCallback );
+ actor.TouchedSignal().Connect( &DummyTouchCallback );
scene.Add( actor );
// Render and notify.
DALI_TEST_CHECK( !handle.WheelEventSignal().GetConnectionCount() );
DALI_TEST_CHECK( !handle.OffSceneSignal().GetConnectionCount() );
DALI_TEST_CHECK( !handle.OnSceneSignal().GetConnectionCount() );
- DALI_TEST_CHECK( !handle.TouchSignal().GetConnectionCount() );
+ DALI_TEST_CHECK( !handle.TouchedSignal().GetConnectionCount() );
}
END_TEST;
}
};
// Stores data that is populated in the touched signal callback and will be read by the TET cases
-struct TouchSignalData
+struct TouchedSignalData
{
- TouchSignalData()
+ TouchedSignalData()
: functorCalled(false)
{}
// Functor that sets the data when touched signal is received
struct TouchFunctor
{
- TouchFunctor( TouchSignalData& data ) : signalData( data ) { }
+ TouchFunctor( TouchedSignalData& data ) : signalData( data ) { }
void operator()( const TouchEvent& touch )
{
signalData.functorCalled = true;
}
- TouchSignalData& signalData;
+ TouchedSignalData& signalData;
};
// Stores data that is populated in the wheel-event callback and will be read by the TET cases
Stage stage = Stage::GetCurrent();
- DALI_TEST_EQUALS( Stage::DEFAULT_BACKGROUND_COLOR, stage.GetBackgroundColor(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DEFAULT_BACKGROUND_COLOR, stage.GetBackgroundColor(), TEST_LOCATION );
END_TEST;
}
TestApplication application;
Stage stage = Stage::GetCurrent();
- TouchSignalData data;
+ TouchedSignalData data;
TouchFunctor functor( data );
- stage.TouchSignal().Connect( &application, functor );
+ stage.TouchedSignal().Connect( &application, functor );
// Render and notify.
application.SendNotification();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- actor.TouchSignal().Connect( &DummyTouchCallback );
+ actor.TouchedSignal().Connect( &DummyTouchCallback );
stage.Add( actor );
// Render and notify.
TestApplication application;
Stage stage = Stage::GetCurrent();
- TouchSignalData data;
+ TouchedSignalData data;
TouchFunctor functor( data );
- stage.TouchSignal().Connect( &application, functor );
+ stage.TouchedSignal().Connect( &application, functor );
// Render and notify.
application.SendNotification();
actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- actor.TouchSignal().Connect( &DummyTouchCallback );
+ actor.TouchedSignal().Connect( &DummyTouchCallback );
stage.Add( actor );
// Render and notify.
END_TEST;
}
-
-int UtcDaliStageTouchSignalP(void)
-{
- TestApplication application;
- Stage stage = Stage::GetCurrent();
-
- TouchSignalData data;
- TouchFunctor functor( data );
- stage.TouchSignal().Connect( &application, functor );
-
- // Render and notify.
- application.SendNotification();
- application.Render();
-
- // Basic test: No actors, single touch (down then up).
- {
- GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
-
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) );
- data.Reset();
-
- GenerateTouch( application, PointState::UP, Vector2( 10.0f, 10.0f ) );
-
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) );
- data.Reset();
- }
-
- // Add an actor to the scene.
- Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- actor.TouchSignal().Connect( &DummyTouchCallback );
- stage.Add( actor );
-
- // Render and notify.
- application.SendNotification();
- application.Render();
-
- // Actor on scene, single touch, down in actor, motion, then up outside actor.
- {
- GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
-
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetHitActor(0) == actor );
- data.Reset();
-
- GenerateTouch( application, PointState::MOTION, Vector2( 150.0f, 10.0f ) ); // Some motion
-
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- data.Reset();
-
- GenerateTouch( application, PointState::UP, Vector2( 150.0f, 10.0f ) ); // Some motion
-
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) );
- data.Reset();
- }
-
- // Multiple touch. Should only receive a touch on first down and last up.
- {
- Integration::TouchEvent touchEvent;
- Integration::Point point;
-
- // 1st point
- point.SetState( PointState::DOWN );
- point.SetScreenPosition( Vector2( 10.0f, 10.0f ) );
- touchEvent.points.push_back( point );
- application.ProcessEvent( touchEvent );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION );
- data.Reset();
-
- // 2nd point
- touchEvent.points[0].SetState( PointState::STATIONARY );
- point.SetDeviceId( 1 );
- point.SetScreenPosition( Vector2( 50.0f, 50.0f ) );
- touchEvent.points.push_back( point );
- application.ProcessEvent( touchEvent );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- data.Reset();
-
- // Primary point is up
- touchEvent.points[0].SetState( PointState::UP );
- touchEvent.points[1].SetState( PointState::STATIONARY );
- application.ProcessEvent( touchEvent );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- data.Reset();
-
- // Remove 1st point now, 2nd point is now in motion
- touchEvent.points.erase( touchEvent.points.begin() );
- touchEvent.points[0].SetState( PointState::MOTION );
- touchEvent.points[0].SetScreenPosition( Vector2( 150.0f, 50.0f ) );
- application.ProcessEvent( touchEvent );
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- data.Reset();
-
- // Final point Up
- touchEvent.points[0].SetState( PointState::UP );
- application.ProcessEvent( touchEvent );
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION );
- data.Reset();
- }
- END_TEST;
-}
-
-int UtcDaliStageTouchSignalN(void)
-{
- TestApplication application;
- Stage stage = Stage::GetCurrent();
-
- TouchSignalData data;
- TouchFunctor functor( data );
- stage.TouchSignal().Connect( &application, functor );
-
- TouchSignalData data2;
- TouchFunctor functor2( data2 );
- GetImplementation( stage ).ConnectSignal( &application, "touch", functor2 );
-
- // Render and notify.
- application.SendNotification();
- application.Render();
-
- // Confirm functor not called before there has been any touch event.
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- DALI_TEST_EQUALS( false, data2.functorCalled, TEST_LOCATION );
-
- // No actors, single touch, down, motion then up.
- {
- GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
-
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0));
-
- DALI_TEST_EQUALS( true, data2.functorCalled, TEST_LOCATION );
-
- data.Reset();
- data2.Reset();
-
- // Confirm there is no signal when the touchpoint is only moved.
- GenerateTouch( application, PointState::MOTION, Vector2( 1200.0f, 10.0f ) ); // Some motion
-
- DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
- data.Reset();
-
- // Confirm a following up event generates a signal.
- GenerateTouch( application, PointState::UP, Vector2( 1200.0f, 10.0f ) );
-
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0));
- data.Reset();
- }
-
- // Add an actor to the scene.
- Actor actor = Actor::New();
- actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) );
- actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
- actor.TouchSignal().Connect( &DummyTouchCallback );
- stage.Add( actor );
-
- // Render and notify.
- application.SendNotification();
- application.Render();
-
- // Actor on scene. Interrupted before down and interrupted after down.
- {
- GenerateTouch( application, PointState::INTERRUPTED, Vector2( 10.0f, 10.0f ) );
-
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetState(0) == PointState::INTERRUPTED );
- data.Reset();
-
- GenerateTouch( application, PointState::DOWN, Vector2( 10.0f, 10.0f ) );
-
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetHitActor(0) == actor );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetState(0) == PointState::DOWN );
- data.Reset();
-
- GenerateTouch( application, PointState::INTERRUPTED, Vector2( 10.0f, 10.0f ) );
-
- DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetPointCount() != 0u );
- DALI_TEST_CHECK( !data.receivedTouchEvent.GetHitActor(0) );
- DALI_TEST_CHECK( data.receivedTouchEvent.GetState(0) == PointState::INTERRUPTED );
-
- DALI_TEST_EQUALS( data.receivedTouchEvent.GetPointCount(), 1u, TEST_LOCATION );
-
- // Check that getting info about a non-existent point returns an empty handle
- Actor actor = data.receivedTouchEvent.GetHitActor( 1 );
- DALI_TEST_CHECK( !actor );
-
- data.Reset();
- }
-
- END_TEST;
-}
-
int UtcDaliStageSignalWheelEventP(void)
{
TestApplication application;
+++ /dev/null
-/*
- * Copyright (c) 2014 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 <iostream>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali-test-suite-utils.h>
-
-using namespace Dali;
-
-void utc_dali_tap_gesture_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_tap_gesture_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-
-// Positive test case for a method
-int UtcDaliTapGestureConstructor(void)
-{
- TestApplication application; // Reset all test adapter return codes
-
- TapGesture gesture;
- DALI_TEST_EQUALS(1u, gesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, gesture.numberOfTaps, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Tap, gesture.type, TEST_LOCATION);
-
- // Test Copy constructor
- gesture.numberOfTouches = 5u;
- gesture.numberOfTaps = 2u;
-
- TapGesture gesture2(gesture);
- DALI_TEST_EQUALS(5u, gesture2.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(2u, gesture2.numberOfTaps, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Tap, gesture2.type, TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliTapGestureAssignment(void)
-{
- // Test Assignment operator
- TapGesture gesture;
- DALI_TEST_EQUALS(1u, gesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, gesture.numberOfTaps, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Tap, gesture.type, TEST_LOCATION);
-
- gesture.numberOfTouches = 5u;
- gesture.numberOfTaps = 2u;
-
- TapGesture gesture2;
- gesture2 = gesture;
- DALI_TEST_EQUALS(5u, gesture2.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(2u, gesture2.numberOfTaps, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Tap, gesture2.type, TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliTapGestureDynamicAllocation(void)
-{
- TapGesture* gesture = new TapGesture;
- DALI_TEST_EQUALS(1u, gesture->numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, gesture->numberOfTaps, TEST_LOCATION);
- DALI_TEST_EQUALS(Gesture::Tap, gesture->type, TEST_LOCATION);
- delete gesture;
-
- END_TEST;
-}
functorCalled = false;
voidFunctorCalled = false;
- receivedGesture.numberOfTaps = 0u;
- receivedGesture.numberOfTouches = 0u;
- receivedGesture.screenPoint = Vector2(0.0f, 0.0f);
- receivedGesture.localPoint = Vector2(0.0f, 0.0f);
+ receivedGesture.Reset();
tappedActor.Reset();
}
detector.Attach(actor);
TouchEventFunctor touchFunctor;
- actor.TouchSignal().Connect( &application, touchFunctor );
+ actor.TouchedSignal().Connect( &application, touchFunctor );
Integration::TouchEvent touchEvent(1);
Integration::Point point;
// Do a tap inside actor's area
TestGenerateTap( application, 50.0f, 50.0f, 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTaps, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.localPoint, 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
END_TEST;
}
// Start tap within the actor's area
TestGenerateTap( application, 20.0f, 20.0f, 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTaps, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(20.0f, 20.0f), data.receivedGesture.localPoint, 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(20.0f, 20.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
// repeat the tap within the actor's area - we should still receive the signal
data.Reset();
TestGenerateTap( application, 50.0f, 50.0f, 700 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTaps, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.localPoint, 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(50.0f, 50.0f), data.receivedGesture.GetLocalPoint(), 0.1, TEST_LOCATION);
// Detach actor
detector.DetachAll();
// Do tap, only check finished value
TestGenerateTap( application, 5.0f, 5.0f, 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTaps, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.screenPoint, 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION);
// Rotate actor again and render
actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(180.0f), Vector3::ZAXIS) );
data.Reset();
TestGenerateTap( application, 5.0f, 5.0f, 700 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTaps, TEST_LOCATION);
- DALI_TEST_EQUALS(1u, data.receivedGesture.numberOfTouches, TEST_LOCATION);
- DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.screenPoint, 0.1, TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTaps(), TEST_LOCATION);
+ DALI_TEST_EQUALS(1u, data.receivedGesture.GetNumberOfTouches(), TEST_LOCATION);
+ DALI_TEST_EQUALS( Vector2(5.0f, 5.0f), data.receivedGesture.GetScreenPoint(), 0.1, TEST_LOCATION);
// Rotate actor again and render
actor.SetProperty( Actor::Property::ORIENTATION, Quaternion(Dali::Degree(90.0f), Vector3::YAXIS) );
parent.Add(child);
TouchEventFunctor touchFunctor;
- child.TouchSignal().Connect(&application, touchFunctor);
+ child.TouchedSignal().Connect(&application, touchFunctor);
// Render and notify
application.SendNotification();
TestGenerateTap( application, 50.0f, 50.0f, 100 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, parent == data.tappedActor, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.screenPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(50.0f, 50.0f), data.receivedGesture.GetScreenPoint(), 0.01f, TEST_LOCATION);
// Attach child and generate same touch points
// (Also proves that you can detach and then re-attach another actor)
TestGenerateTap( application, 51.0f, 51.0f, 700 );
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, child == data.tappedActor, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector2(51.0f, 51.0f), data.receivedGesture.screenPoint, 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector2(51.0f, 51.0f), data.receivedGesture.GetScreenPoint(), 0.01f, TEST_LOCATION);
END_TEST;
}
DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(true, first == data.tappedActor, TEST_LOCATION);
- // Pan changes to double-touch - we shouldn't receive event
+ // Tap changes to double-touch - we shouldn't receive event
data.Reset();
TestGenerateTwoPointTap( application, 50.0f, 10.0f, 60.0f, 20.0f, 2000 );
application.SendNotification();
application.Render();
- // Emit Started event, we should not receive the tap.
+ // Emit STARTED event, we should not receive the tap.
TestEndPan( application, Vector2(50.0f, 10.0f), 120 );
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
application.SendNotification();
application.Render();
- // Emit Started event, we should not receive the tap.
+ // Emit STARTED event, we should not receive the tap.
TestEndPan( application, Vector2(50.0f, 10.0f), 720 );
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
// Emit a possible - Down press, as emitted by long press function
TestStartLongPress( application, 50.0f, 10.0f, 100 );
- // Detach actor and send a Started state, no signal.
+ // Detach actor and send a STARTED state, no signal.
detector.DetachAll();
TestEndPan( application, Vector2(50.0f, 10.0f), 120 );
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
application.Render();
actor.Reset();
- // Send a Started state, no signal - Up motion as provided by end pan function
+ // Send a STARTED state, no signal - Up motion as provided by end pan function
TestEndPan( application, Vector2(50.0f, 10.0f), 120 );
DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
END_TEST;
bool consume = false;
TouchEventFunctorConsumeSetter touchFunctor(consume);
- actor.TouchSignal().Connect(&application,touchFunctor);
+ actor.TouchedSignal().Connect(&application,touchFunctor);
// Render and notify
application.SendNotification();
functorCalled = false;
voidFunctorCalled = false;
- receivedGesture.state = Gesture::Started;
+ receivedGesture.Reset();
tappedActor.Reset();
}
--- /dev/null
+/*
+ * Copyright (c) 2014 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 <iostream>
+#include <stdlib.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali/integration-api/events/touch-integ.h>
+#include <dali-test-suite-utils.h>
+
+void utc_dali_touch_event_startup(void)
+{
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_touch_event_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
+namespace
+{
+TouchPoint GenerateTouchPoint()
+{
+ return TouchPoint(1, PointState::STARTED, 100.0f, 200.0f);
+}
+}
+
+int UtcDaliTouchEventConstructorP(void)
+{
+ TouchEvent touchEvent;
+ DALI_TEST_CHECK( !touchEvent );
+ END_TEST;
+}
+
+int UtcDaliTouchEventCopyConstructorP(void)
+{
+ TouchEvent touchEvent = Integration::NewTouchEvent(123u, GenerateTouchPoint());
+ DALI_TEST_CHECK( touchEvent );
+
+ const auto refCount = touchEvent.GetBaseObject().ReferenceCount();
+
+ TouchEvent touchEvent2( touchEvent );
+ DALI_TEST_CHECK( touchEvent );
+ DALI_TEST_CHECK( touchEvent2 );
+ DALI_TEST_EQUALS( touchEvent, touchEvent2, TEST_LOCATION );
+ DALI_TEST_EQUALS( refCount + 1, touchEvent.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTouchEventMoveConstructorP(void)
+{
+ TouchEvent touchEvent = Integration::NewTouchEvent(123u, GenerateTouchPoint());
+ DALI_TEST_CHECK( touchEvent );
+
+ const auto refCount = touchEvent.GetBaseObject().ReferenceCount();
+
+ TouchEvent touchEvent2( std::move(touchEvent) );
+ DALI_TEST_CHECK( !touchEvent );
+ DALI_TEST_CHECK( touchEvent2 );
+ DALI_TEST_EQUALS( refCount, touchEvent2.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTouchEventCopyAssignmentP(void)
+{
+ TouchEvent touchEvent = Integration::NewTouchEvent(123u, GenerateTouchPoint());
+ DALI_TEST_CHECK( touchEvent );
+
+ const auto refCount = touchEvent.GetBaseObject().ReferenceCount();
+
+ TouchEvent touchEvent2;
+ DALI_TEST_CHECK( !touchEvent2 );
+
+ touchEvent2 = touchEvent;
+ DALI_TEST_CHECK( touchEvent );
+ DALI_TEST_CHECK( touchEvent2 );
+ DALI_TEST_EQUALS( touchEvent, touchEvent2, TEST_LOCATION );
+ DALI_TEST_EQUALS( refCount + 1, touchEvent.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliTouchEventMoveAssignmentP(void)
+{
+ TouchEvent touchEvent = Integration::NewTouchEvent(123u, GenerateTouchPoint());
+ DALI_TEST_CHECK( touchEvent );
+
+ const auto refCount = touchEvent.GetBaseObject().ReferenceCount();
+
+ TouchEvent touchEvent2;
+ DALI_TEST_CHECK( !touchEvent2 );
+
+ touchEvent2 = std::move(touchEvent);
+ DALI_TEST_CHECK( !touchEvent );
+ DALI_TEST_CHECK( touchEvent2 );
+ DALI_TEST_EQUALS( refCount, touchEvent2.GetBaseObject().ReferenceCount(), TEST_LOCATION );
+
+ END_TEST;
+}
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::MOTION, 101.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::MOTION, 101.0f, 101.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
time++;
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
// Up event, no time diff, no movement
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::UP, 102.0f, 102.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::MOTION, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchHover, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), PointState::STARTED, TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchHover, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::MOTION, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchHover, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), PointState::STARTED, TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchHover, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::MOTION, 103.0f, 103.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchHover, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::DOWN, 103.0f, 103.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchBoth, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_BOTH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
END_TEST;
}
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
time++;
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::UP, 102.0f, 102.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
END_TEST;
}
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
END_TEST;
}
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 2, PointState::UP, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
time++;
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 2, PointState::MOTION, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchHover, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_HOVER, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.points[0].GetState(), PointState::STARTED, TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::MOTION, 102.0f, 102.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 2, PointState::DOWN, 200.0f, 200.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[1].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), PointState::STATIONARY, TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::MOTION, 101.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 2, PointState::MOTION, 200.0f, 200.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
time++;
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 2, PointState::MOTION, 201.0f, 201.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[1].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), PointState::STATIONARY, TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::UP, 101.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 2u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 2, PointState::MOTION, 202.0f, 202.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 2, PointState::UP, 202.0f, 202.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( pointCount, PointState::DOWN, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time++, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time++, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), pointCount, TEST_LOCATION );
}
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( pointCount, PointState::UP, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time++, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time++, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), pointCount, TEST_LOCATION );
}
END_TEST;
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
END_TEST;
}
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::DOWN, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetDeviceId(), point.GetDeviceId(), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::INTERRUPTED, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchBoth, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_BOTH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
END_TEST;
}
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( pointCount, PointState::DOWN, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchTouch, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_TOUCH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), pointCount, TEST_LOCATION );
}
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::INTERRUPTED, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchBoth, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_BOTH, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.GetPointCount(), 1u, TEST_LOCATION );
DALI_TEST_EQUALS( touchEvent.points[0].GetState(), point.GetState(), TEST_LOCATION );
DALI_TEST_EQUALS( hoverEvent.GetPointCount(), 1u, TEST_LOCATION );
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::UP, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
END_TEST;
}
Integration::HoverEvent hoverEvent;
Integration::Point point = GeneratePoint( 1, PointState::STATIONARY, 100.0f, 100.0f );
- DALI_TEST_EQUALS( Integration::TouchEventCombiner::DispatchNone, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
+ DALI_TEST_EQUALS( Integration::TouchEventCombiner::DISPATCH_NONE, combiner.GetNextTouchEvent( point, time, touchEvent, hoverEvent ), TEST_LOCATION );
}
END_TEST;
}
// Connect to actor's touch signal
SignalData data;
TouchEventFunctor functor( data );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
Vector2 screenCoordinates( 10.0f, 10.0f );
Vector2 localCoordinates;
// Connect to actor's touched signal
HandleData handleData;
TouchEventHandleFunctor functor( handleData );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
Vector2 screenCoordinates( 10.0f, 10.0f );
Vector2 localCoordinates;
// Connect to actor's touched signal
OutOfBoundsData data;
OutOfBoundsFunctor functor( data, true );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
Vector2 screenCoordinates( 10.0f, 10.0f );
Vector2 localCoordinates;
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
Vector2 screenCoordinates( sceneSize.x * 0.5f, sceneSize.y * 0.5f );
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Emit a down signal
application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data, false );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Connect to root actor's touched signal
SignalData rootData;
TouchEventFunctor rootFunctor( rootData ); // Consumes signal
- rootActor.TouchSignal().Connect( &application, rootFunctor );
+ rootActor.TouchedSignal().Connect( &application, rootFunctor );
Vector2 screenCoordinates( 10.0f, 10.0f );
Vector2 actorCoordinates, rootCoordinates;
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data, false );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Connect to root actor's touched signal
SignalData rootData;
TouchEventFunctor rootFunctor( rootData ); // Consumes signal
- rootActor.TouchSignal().Connect( &application, rootFunctor );
+ rootActor.TouchedSignal().Connect( &application, rootFunctor );
// Emit a down signal
application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Set actor to require leave events
actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data, false );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Connect to root actor's touched signal
SignalData rootData;
TouchEventFunctor rootFunctor( rootData ); // Consumes signal
- rootActor.TouchSignal().Connect( &application, rootFunctor );
+ rootActor.TouchedSignal().Connect( &application, rootFunctor );
// Set actor to require leave events
actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Emit a down signal
application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data, false );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Connect to root actor's touched signal
SignalData rootData;
TouchEventFunctor rootFunctor( rootData ); // Consumes signal
- rootActor.TouchSignal().Connect( &application, rootFunctor );
+ rootActor.TouchedSignal().Connect( &application, rootFunctor );
// Emit a down signal
application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
application.Render();
// Connect to layer1 and actor1
- layer1.TouchSignal().Connect( &application, functor );
- actor1.TouchSignal().Connect( &application, functor );
+ layer1.TouchedSignal().Connect( &application, functor );
+ actor1.TouchedSignal().Connect( &application, functor );
// Hit in hittable area, actor1 should be hit
application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
application.Render();
// Connect to layer2 and actor2
- layer2.TouchSignal().Connect( &application, functor );
- actor2.TouchSignal().Connect( &application, functor );
+ layer2.TouchedSignal().Connect( &application, functor );
+ actor2.TouchedSignal().Connect( &application, functor );
// Emit an event, should hit layer2
application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Emit a down signal
application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
// Connect to layer's touched signal
SignalData data;
TouchEventFunctor functor( data );
- actor.TouchSignal().Connect( &application, functor );
- layer.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
+ layer.TouchedSignal().Connect( &application, functor );
// Emit a down signal
application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Emit a down signal
application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
// Connect to layer's touched signal
SignalData data;
TouchEventFunctor functor( data );
- parent.TouchSignal().Connect( &application, functor );
- actor.TouchSignal().Connect( &application, functor );
+ parent.TouchedSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Emit a down signal
application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
// Connect to actor's touched signal
SignalData data;
RemoveActorFunctor functor( data );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Register for leave events
actor.SetProperty( Actor::Property::LEAVE_REQUIRED, true );
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data, false );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Emit a down signal
application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Emit a down signal
application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Add a layer to overlap the actor
Layer layer = Layer::New();
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Emit a down and motion
application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
// Connect to actor's touch signal.
SignalData data;
TouchEventFunctor functor( data );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Emit an event within clipped area - no hit.
application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
data.Reset();
- clippingChild.TouchSignal().Connect( &application, functor );
+ clippingChild.TouchedSignal().Connect( &application, functor );
// Emit an event inside part of the child which is within the clipped area, we should have a hit.
application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 30.0f, 30.0f ) ) );
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Emit a down signal
application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Emit a down signal
application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data, false /* Do not consume */ );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Connect to parent's touched signal
SignalData parentData;
TouchEventFunctor parentFunctor( parentData );
- parent.TouchSignal().Connect( &application, parentFunctor );
+ parent.TouchedSignal().Connect( &application, parentFunctor );
// Emit a down signal
application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
// Parent is now consumer, connect again to the touched signal of the actor so that it becomes the consumer
SignalData secondData;
TouchEventFunctor secondFunctor( secondData /* Consume */ );
- actor.TouchSignal().Connect( &application, secondFunctor );
+ actor.TouchedSignal().Connect( &application, secondFunctor );
// Unparent the actor
actor.Unparent();
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data, false /* Do not consume */ );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Connect to parent's touched signal
SignalData parentData;
TouchEventFunctor parentFunctor( parentData, false /* Do not consume */ );
- parent.TouchSignal().Connect( &application, parentFunctor );
+ parent.TouchedSignal().Connect( &application, parentFunctor );
// Connect to root's touched signal and consume
SignalData rootData;
TouchEventFunctor rootFunctor( rootData );
- rootActor.TouchSignal().Connect( &application, rootFunctor );
+ rootActor.TouchedSignal().Connect( &application, rootFunctor );
// Emit a down signal
application.ProcessEvent( GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) ) );
// Root is now consumer, connect to the touched signal of the parent so that it becomes the consumer
SignalData secondData;
TouchEventFunctor secondFunctor( secondData /* Consume */ );
- parent.TouchSignal().Connect( &application, secondFunctor );
+ parent.TouchedSignal().Connect( &application, secondFunctor );
// Emit an interrupted signal, all three should STILL be called
application.ProcessEvent( GenerateSingleTouch( PointState::INTERRUPTED, Vector2( 10.0f, 10.0f ) ) );
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Emit a down signal with an angle
Integration::TouchEvent touchEvent = GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) );
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Emit a down signal with an angle
Integration::TouchEvent touchEvent = GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) );
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Emit a down signal with an angle
Integration::TouchEvent touchEvent = GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) );
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Emit a down signal with an angle
Integration::TouchEvent touchEvent = GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) );
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Emit a down signal with an angle
// Connect to actor's touched signal
HandleData handleData;
TouchEventHandleFunctor functor( handleData );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
Vector2 screenCoordinates( 10.0f, 10.0f );
Vector2 localCoordinates;
// Connect to actor's touched signal
HandleData handleData;
TouchEventHandleFunctor functor( handleData );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Emit a down signal with MouseButton
Integration::TouchEvent touchEvent = GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) );
// Connect to actor's touched signal
HandleData handleData;
TouchEventHandleFunctor functor( handleData );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Emit a down signal with MouseButton
Integration::TouchEvent touchEvent = GenerateSingleTouch( PointState::DOWN, Vector2( 10.0f, 10.0f ) );
// Connect to actor's touched signal
SignalData data;
TouchEventFunctor functor( data );
- actor.TouchSignal().Connect( &application, functor );
+ actor.TouchedSignal().Connect( &application, functor );
// Emit a down signal
application.ProcessEvent( GenerateSingleTouch( PointState::STARTED, Vector2( 10.0f, 10.0f ) ) );
int UtcDaliTouchEventIntegNewTouchEvent(void)
{
uint32_t timestamp = 92858u;
- TouchPoint tp(1, TouchPoint::State::Started, 34.4f, 123.89f, 5.0f, 7.0f);
+ TouchPoint tp(1, PointState::STARTED, 34.4f, 123.89f, 5.0f, 7.0f);
Dali::TouchEvent touchEvent = Integration::NewTouchEvent(timestamp, tp);
DALI_TEST_EQUALS(touchEvent.GetPointCount(), 1u, TEST_LOCATION);
- DALI_TEST_EQUALS(touchEvent.GetState(0), PointState::Type::STARTED, TEST_LOCATION );
+ DALI_TEST_EQUALS(touchEvent.GetState(0), PointState::STARTED, TEST_LOCATION );
DALI_TEST_EQUALS(touchEvent.GetLocalPosition(0), Vector2(5.0f, 7.0f), TEST_LOCATION );
DALI_TEST_EQUALS(touchEvent.GetScreenPosition(0), Vector2(34.4f, 123.89f), TEST_LOCATION );
SignalData()
: functorCalled( false ),
voidFunctorCalled( false ),
- receivedGesture( Gesture::Clear ),
+ receivedGesture( ),
pressedActor()
{}
functorCalled = false;
voidFunctorCalled = false;
- receivedGesture.numberOfTouches = 0u;
- receivedGesture.screenPoint = Vector2(0.0f, 0.0f);
- receivedGesture.localPoint = Vector2(0.0f, 0.0f);
+ receivedGesture.Reset();
pressedActor.Reset();
}
typedef Signal< void ()> SignalType;
typedef Signal< void (float)> SignalTypeFloat;
- MyTestCustomActor() : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS ) )
+ MyTestCustomActor() : CustomActorImpl( ActorFlags() )
{ }
virtual ~MyTestCustomActor()
virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
{
}
- virtual bool OnHoverEvent(const HoverEvent& event)
- {
- return true;
- }
- virtual bool OnWheelEvent(const WheelEvent& event)
- {
- return true;
- }
- virtual bool OnKeyEvent(const KeyEvent& event)
- {
- return true;
- }
virtual void OnKeyInputFocusGained()
{
}
typedef Signal< void ()> SignalType;
typedef Signal< void (float)> SignalTypeFloat;
- MyTestCustomActor() : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS ) )
+ MyTestCustomActor() : CustomActorImpl( ActorFlags() )
{ }
virtual ~MyTestCustomActor()
virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
{
}
- virtual bool OnHoverEvent(const HoverEvent& event)
- {
- return true;
- }
- virtual bool OnWheelEvent(const WheelEvent& event)
- {
- return true;
- }
- virtual bool OnKeyEvent(const KeyEvent& event)
- {
- return true;
- }
virtual void OnKeyInputFocusGained()
{
}
using Internal::Core;
-const Vector4 Stage::DEFAULT_BACKGROUND_COLOR(0.0f, 0.0f, 0.0f, 1.0f);
-const Vector4 Stage::DEBUG_BACKGROUND_COLOR(0.2f, 0.5f, 0.2f, 1.0f);
-
Stage::Stage()
{
}
return GetImplementation(*this).EventProcessingFinishedSignal();
}
-Stage::TouchSignalType& Stage::TouchSignal()
+Stage::TouchEventSignalType& Stage::TouchedSignal()
{
- return GetImplementation( *this ).TouchSignal();
+ return GetImplementation( *this ).TouchedSignal();
}
Stage::WheelEventSignalType& Stage::WheelEventSignal()
* |-------------------------|--------------------------------------|
* | keyEvent | @ref KeyEventSignal() |
* | eventProcessingFinished | @ref EventProcessingFinishedSignal() |
- * | touch | @ref TouchSignal() |
+ * | touched | @ref TouchedSignal() |
* | wheelEvent | @ref WheelEventSignal() |
* | contextLost | @ref ContextLostSignal() |
* | contextRegained | @ref ContextRegainedSignal() |
* | sceneCreated | @ref SceneCreatedSignal() |
- * @SINCE_1_0.0
*/
class DALI_CORE_API Stage : public BaseHandle
{
public:
- typedef Signal< void (const KeyEvent&) > KeyEventSignalType; ///< Key event signal type @SINCE_1_0.0
- typedef Signal< void () > EventProcessingFinishedSignalType; ///< Event Processing finished signal type @SINCE_1_0.0
- typedef Signal< void (const TouchEvent&) > TouchSignalType; ///< Touch signal type @SINCE_1_1.37
- typedef Signal< void (const WheelEvent&) > WheelEventSignalType; ///< Wheel signal type @SINCE_1_0.0
- typedef Signal< void () > ContextStatusSignal; ///< Context status signal type @SINCE_1_0.0
- typedef Signal< void () > SceneCreatedSignalType; ///< Scene created signal type @SINCE_1_0.0
-
- static const Vector4 DEFAULT_BACKGROUND_COLOR; ///< Default black background.
- static const Vector4 DEBUG_BACKGROUND_COLOR; ///< Green background, useful when debugging.
+ typedef Signal< void (const KeyEvent&) > KeyEventSignalType; ///< Key event signal type
+ typedef Signal< void () > EventProcessingFinishedSignalType; ///< Event Processing finished signal type
+ typedef Signal< void (const TouchEvent&) > TouchEventSignalType; ///< Touch signal type
+ typedef Signal< void (const WheelEvent&) > WheelEventSignalType; ///< Wheel signal type
+ typedef Signal< void () > ContextStatusSignal; ///< Context status signal type
+ typedef Signal< void () > SceneCreatedSignalType; ///< Scene created signal type
/**
* @brief Allows the creation of an empty stage handle.
* The x component will be the width of the Stage in pixels.
* The y component will be the height of the Stage in pixels.
* The z component will be the distance between far and near planes.
- * @SINCE_1_0.0
* @return The size of the Stage as a Vector
*/
Vector2 GetSize() const;
* @code
* void YourCallbackName(const KeyEvent& event);
* @endcode
- * @SINCE_1_0.0
* @return The signal to connect to
*/
KeyEventSignalType& KeyEventSignal();
* @return The touch signal to connect to
* @note Motion events are not emitted.
*/
- TouchSignalType& TouchSignal();
+ TouchEventSignalType& TouchedSignal();
/**
* @brief This signal is emitted when wheel event is received.
--- /dev/null
+/*\r
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+// INTERNAL INCLUDES\r
+#include <dali/devel-api/events/hover-event-devel.h>\r
+#include <dali/internal/event/events/hover-event-impl.h>\r
+\r
+namespace Dali\r
+{\r
+\r
+namespace DevelHoverEvent\r
+{\r
+\r
+HoverEvent New( uint32_t time )\r
+{\r
+ return HoverEvent( new Internal::HoverEvent( time ) );\r
+}\r
+\r
+} // namespace DevelHoverEvent\r
+\r
+} // namespace Dali\r
+\r
--- /dev/null
+#ifndef DALI_HOVER_EVENT_DEVEL_H\r
+#define DALI_HOVER_EVENT_DEVEL_H\r
+\r
+/*\r
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ */\r
+\r
+// INTERNAL INCLUDES\r
+#include <dali/public-api/events/hover-event.h>\r
+\r
+namespace Dali\r
+{\r
+\r
+namespace DevelHoverEvent\r
+{\r
+\r
+/**\r
+ * @brief Creates an initialized HoverEvent.\r
+ *\r
+ * @SINCE_1_9.28\r
+ * @param[in] time The time the event occurred.\r
+ * @return A handle to a newly allocated Dali resource\r
+ */\r
+DALI_CORE_API HoverEvent New( uint32_t time );\r
+\r
+\r
+} // namespace DevelHoverEvent\r
+\r
+} // namespace Dali\r
+\r
+#endif // DALI_HOVER_EVENT_DEVEL_H\r
--- /dev/null
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/devel-api/events/pan-gesture-devel.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/event/events/pan-gesture/pan-gesture-impl.h>
+
+
+namespace Dali
+{
+
+namespace DevelPanGesture
+{
+
+Dali::PanGesture New( GestureState state )
+{
+ return PanGesture( new Internal::PanGesture( state ) );
+}
+
+void SetTime( Dali::PanGesture& gesture, uint32_t time )
+{
+ GetImplementation( gesture ).SetTime( time );
+}
+
+void SetVelocity( Dali::PanGesture& gesture, const Vector2& velocity)
+{
+ GetImplementation( gesture ).SetVelocity( velocity );
+}
+
+void SetDisplacement( Dali::PanGesture& gesture, const Vector2& displacement)
+{
+ GetImplementation( gesture ).SetDisplacement( displacement );
+}
+
+void SetPosition( Dali::PanGesture& gesture, const Vector2& position)
+{
+ GetImplementation( gesture ).SetPosition( position );
+}
+
+void SetScreenVelocity( Dali::PanGesture& gesture, const Vector2& screenVelocity)
+{
+ GetImplementation( gesture ).SetScreenVelocity( screenVelocity );
+}
+
+void SetScreenDisplacement( Dali::PanGesture& gesture, const Vector2& screenDisplacement)
+{
+ GetImplementation( gesture ).SetScreenDisplacement( screenDisplacement );
+}
+
+void SetScreenPosition( Dali::PanGesture& gesture, const Vector2& screenPosition)
+{
+ GetImplementation( gesture ).SetScreenPosition( screenPosition );
+}
+
+void SetNumberOfTouches( Dali::PanGesture& gesture, uint32_t numberOfTouches )
+{
+ GetImplementation( gesture ).SetNumberOfTouches( numberOfTouches );
+}
+
+} // namespace DevelPanGesture
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_PAN_GESTURE_DEVEL_H
+#define DALI_PAN_GESTURE_DEVEL_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/events/pan-gesture.h>
+
+namespace Dali
+{
+
+namespace DevelPanGesture
+{
+
+/**
+ * @brief Create a PanGeture for internal.
+ * @param[in] state The state of the PanGesture
+ */
+DALI_CORE_API Dali::PanGesture New(GestureState state);
+
+/**
+ * @brief Set the time the gesture took place.
+ * @param[in] gesture The PanGesture to set
+ * @param[in] time The time the gesture took place
+ */
+DALI_CORE_API void SetTime(Dali::PanGesture& gesture, uint32_t time);
+
+/**
+ * @brief Set the velocity at which the user is moving their fingers.
+ * @param[in] gesture The PanGesture to set
+ * @param[in] velocity The Vector2 in local coordinates to set
+ */
+DALI_CORE_API void SetVelocity(Dali::PanGesture& gesture, const Vector2& velocity);
+
+/**
+ * @brief Set the displacement.
+ * @param[in] gesture The PanGesture to set
+ * @param[in] displacement The Vector2 in local coordinates to set
+ */
+DALI_CORE_API void SetDisplacement(Dali::PanGesture& gesture, const Vector2& displacement);
+
+/**
+ * @brief Set the current touch position of the primary touch point in local actor coordinates.
+ * @param[in] gesture The PanGesture to set.
+ * @param[in] position The current touch position to set.
+ */
+DALI_CORE_API void SetPosition(Dali::PanGesture& gesture, const Vector2& position);
+
+/**
+ * @brief Set the velocity at which the user is moving their fingers.
+ * @param[in] gesture The PanGesture to set
+ * @param[in] screenVelocity The Vector2 in screen coordinates to set
+ */
+DALI_CORE_API void SetScreenVelocity(Dali::PanGesture& gesture, const Vector2& screenVelocity);
+
+/**
+ * @brief Set the screen displacement.
+ * @param[in] gesture The PanGesture to set
+ * @param[in] screenDisplacement The Vector2 in screen coordinates to set
+ */
+DALI_CORE_API void SetScreenDisplacement(Dali::PanGesture& gesture, const Vector2& screenDisplacement);
+
+/**
+ * @brief Set the current touch position of the primary touch point in screen coordinates.
+ * @param[in] gesture The PanGesture to set.
+ * @param[in] screenPosition The Vector2 in screen coordinates to set.
+ */
+DALI_CORE_API void SetScreenPosition(Dali::PanGesture& gesture, const Vector2& screenPosition);
+
+/**
+ * @brief Set the total number of fingers touching the screen in a pan gesture.
+ * @param[in] gesture The PanGesture to set
+ * @param[in] numberOfTouches The total number of fingers touching the screen to set
+ */
+DALI_CORE_API void SetNumberOfTouches(Dali::PanGesture& gesture, uint32_t numberOfTouches);
+
+} // namespace DevelPanGesture
+
+} // namespace Dali
+
+#endif // DALI_PAN_GESTURE_DEVEL_H
/*
- * Copyright (c) 2018 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.
*/
// CLASS HEADER
-#include <dali/public-api/events/touch-point.h>
+#include <dali/devel-api/events/touch-point.h>
namespace Dali
{
-TouchPoint::TouchPoint(int32_t id, State state, float screenX, float screenY)
+TouchPoint::TouchPoint(int32_t id, PointState::Type state, float screenX, float screenY)
: deviceId(id),
state(state),
local(screenX, screenY),
{
}
-TouchPoint::TouchPoint(int32_t id, State state, float screenX, float screenY, float localX, float localY)
+TouchPoint::TouchPoint(int32_t id, PointState::Type state, float screenX, float screenY, float localX, float localY)
: deviceId(id),
state(state),
local(localX, localY),
#define DALI_TOUCH_POINT_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.
// INTERNAL INCLUDES
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/events/point-state.h>
#include <dali/public-api/math/vector2.h>
namespace Dali
*/
struct DALI_CORE_API TouchPoint
{
- // Enumerations
-
- /**
- * @brief Enumeration for Touch state.
- * @SINCE_1_0.0
- */
- enum State
- {
- Started, /**< Touch or hover started */
- Finished, /**< Touch or hover finished */
- Down = Started, /**< Screen touched */
- Up = Finished, /**< Touch stopped */
- Motion, /**< Finger dragged or hovered */
- Leave, /**< Leave the boundary of an actor */
- Stationary, /**< No change from last event. Useful when a multi-point event occurs where
- all points are sent but indicates that this particular point has not changed
- since the last time */
- Interrupted, /**< A system event has occurred which has interrupted the touch or hover event sequence. */
- Last /**< Number of states. */
- };
-
// Construction & Destruction
/**
* @brief Constructor.
*
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @param[in] id The touch device ID
* @param[in] state The state
* @param[in] screenX The X co-ordinate relative to the screen's origin
* @param[in] screenY The Y co-ordinate relative to the screen's origin
*/
- TouchPoint(int32_t id, State state, float screenX, float screenY);
+ TouchPoint(int32_t id, PointState::Type state, float screenX, float screenY);
/**
* @brief Constructor.
*
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @param[in] id The touch device ID
* @param[in] state The state
* @param[in] screenX The X co-ordinate relative to the screen's origin
* @param[in] localX The X co-ordinate relative to the top-left (0.0, 0.0, 0.5) of the actor
* @param[in] localY The Y co-ordinate relative to the top-left (0.0, 0.0, 0.5) of the actor
*/
- TouchPoint(int32_t id, State state, float screenX, float screenY, float localX, float localY);
+ TouchPoint(int32_t id, PointState::Type state, float screenX, float screenY, float localX, float localY);
/**
* @brief Destructor.
/**
* @brief State of the point.
*
- * @see State
+ * @see Dali::PointState::Type
*/
- State state;
+ PointState::Type state;
/**
* @brief The actor that was underneath the touch point.
${devel_api_src_dir}/common/stage-devel.cpp
${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/hover-event-devel.cpp
${devel_api_src_dir}/events/key-event-devel.cpp
+ ${devel_api_src_dir}/events/long-press-gesture-detector-devel.cpp
+ ${devel_api_src_dir}/events/pan-gesture-devel.cpp
+ ${devel_api_src_dir}/events/touch-point.cpp
${devel_api_src_dir}/events/wheel-event-devel.cpp
${devel_api_src_dir}/images/distance-field.cpp
${devel_api_src_dir}/images/pixel-data-devel.cpp
SET( devel_api_core_events_header_files
${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/hover-event-devel.h
${devel_api_src_dir}/events/key-event-devel.h
+ ${devel_api_src_dir}/events/long-press-gesture-detector-devel.h
+ ${devel_api_src_dir}/events/pan-gesture-devel.h
+ ${devel_api_src_dir}/events/touch-point.h
${devel_api_src_dir}/events/wheel-event-devel.h
)
/*
- * Copyright (c) 2017 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.
{
Point::Point()
-: mTouchPoint( 0, TouchPoint::Started, 0.0f, 0.0f ),
+: mTouchPoint( 0, PointState::STARTED, 0.0f, 0.0f ),
mEllipseRadius(),
mAngle( 0.0f ),
mDeviceClass( Device::Class::NONE ),
void Point::SetState( PointState::Type state )
{
- mTouchPoint.state = static_cast< TouchPoint::State >( state );
+ mTouchPoint.state = static_cast< PointState::Type >( state );
}
void Point::SetScreenPosition( const Vector2& screenPosition )
#define DALI_INTEGRATION_POINT_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.
#include <dali/public-api/events/point-state.h>
#include <dali/public-api/math/degree.h>
#include <dali/public-api/math/vector2.h>
-#include <dali/public-api/events/touch-point.h>
+#include <dali/devel-api/events/touch-point.h>
#include <dali/public-api/events/device.h>
#include <dali/public-api/events/mouse-button.h>
TouchEventCombiner::EventDispatchType TouchEventCombiner::GetNextTouchEvent( const Point& point, uint32_t time, TouchEvent& touchEvent, HoverEvent& hoverEvent )
{
- TouchEventCombiner::EventDispatchType dispatchEvent( TouchEventCombiner::DispatchNone );
+ TouchEventCombiner::EventDispatchType dispatchEvent( TouchEventCombiner::DISPATCH_NONE );
const PointState::Type state = point.GetState();
const int deviceId = point.GetDeviceId();
{
mPressedPoints.push_back( PointInfo( point, time ) );
touchEvent.AddPoint( point );
- dispatchEvent = TouchEventCombiner::DispatchTouch; // Only dispatch touch event if just added to container
+ dispatchEvent = TouchEventCombiner::DISPATCH_TOUCH; // Only dispatch touch event if just added to container
// Check whether hover event was dispatched previously
if ( !mHoveredPoints.empty() )
if ( match != mHoveredPoints.end() )
{
mHoveredPoints.erase( match );
- dispatchEvent = TouchEventCombiner::DispatchBoth; // We should only dispatch hover events if the point was actually hovered in this window
+ dispatchEvent = TouchEventCombiner::DISPATCH_BOTH; // We should only dispatch hover events if the point was actually hovered in this window
}
}
}
if ( match != mPressedPoints.end() )
{
mPressedPoints.erase( match );
- dispatchEvent = TouchEventCombiner::DispatchTouch; // We should only dispatch touch events if the point was actually pressed in this window
+ dispatchEvent = TouchEventCombiner::DISPATCH_TOUCH; // We should only dispatch touch events if the point was actually pressed in this window
// Iterate through already stored touch points for HoverEvent and delete them
for ( PointInfoContainer::iterator iter = mHoveredPoints.begin(), endIter = mHoveredPoints.end(); iter != endIter; ++iter )
PointInfo matchedPoint( point, time );
std::swap( *match, matchedPoint );
- dispatchEvent = TouchEventCombiner::DispatchTouch; // Dispatch touch event
+ dispatchEvent = TouchEventCombiner::DISPATCH_TOUCH; // Dispatch touch event
}
else if(!ignore)
{
std::swap( *match, matchedPoint );
}
- if(dispatchEvent == TouchEventCombiner::DispatchTouch)
+ if(dispatchEvent == TouchEventCombiner::DISPATCH_TOUCH)
{
- dispatchEvent = TouchEventCombiner::DispatchBoth;
+ dispatchEvent = TouchEventCombiner::DISPATCH_BOTH;
}
else
{
- dispatchEvent = TouchEventCombiner::DispatchHover;
+ dispatchEvent = TouchEventCombiner::DISPATCH_HOVER;
}
}
}
// We should still tell core about the interruption.
touchEvent.AddPoint( point );
hoverEvent.AddPoint( point );
- dispatchEvent = TouchEventCombiner::DispatchBoth;
+ dispatchEvent = TouchEventCombiner::DISPATCH_BOTH;
break;
}
enum EventDispatchType
{
- DispatchTouch, ///< The touch event should be dispatched.
- DispatchHover, ///< The hover event should be dispatched.
- DispatchBoth, ///< Both touch event and hover event should be dispatched.
- DispatchNone ///< Neither touch event nor hover event should be dispatched.
+ DISPATCH_TOUCH, ///< The touch event should be dispatched.
+ DISPATCH_HOVER, ///< The hover event should be dispatched.
+ DISPATCH_BOTH, ///< Both touch event and hover event should be dispatched.
+ DISPATCH_NONE ///< Neither touch event nor hover event should be dispatched.
};
/**
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/events/touch-event.h>
-#include <dali/public-api/events/touch-point.h>
+#include <dali/devel-api/events/touch-point.h>
namespace Dali
{
return GetImplementation(*this).KeyEventGeneratedSignal();
}
-Scene::TouchSignalType& Scene::TouchSignal()
+Scene::TouchEventSignalType& Scene::TouchedSignal()
{
- return GetImplementation(*this).TouchSignal();
+ return GetImplementation(*this).TouchedSignal();
}
Scene::WheelEventSignalType& Scene::WheelEventSignal()
typedef Signal< void () > EventProcessingFinishedSignalType; ///< Event Processing finished signal type
typedef Signal< void (const Dali::KeyEvent&) > KeyEventSignalType; ///< Key event signal type
typedef Signal< bool (const Dali::KeyEvent&) > KeyEventGeneratedSignalType; ///< key event generated signal type
- typedef Signal< void (const Dali::TouchEvent&) > TouchSignalType; ///< Touch signal type
- typedef Signal< void (const Dali::WheelEvent&) > WheelEventSignalType; ///< Touched signal type
+ typedef Signal< void (const Dali::TouchEvent&) > TouchEventSignalType; ///< Touch signal type
+ typedef Signal< void (const Dali::WheelEvent&) > WheelEventSignalType; ///< WheelEvent signal type
using FrameCallbackContainer = std::vector< std::pair< std::unique_ptr< CallbackBase >, int32_t > >;
* @return The touch signal to connect to
* @note Motion events are not emitted.
*/
- TouchSignalType& TouchSignal();
+ TouchEventSignalType& TouchedSignal();
/**
* @brief This signal is emitted when wheel event is received.
const char* const SIGNAL_ON_SCENE = "onScene";
const char* const SIGNAL_OFF_SCENE = "offScene";
const char* const SIGNAL_ON_RELAYOUT = "onRelayout";
-const char* const SIGNAL_TOUCH = "touch";
+const char* const SIGNAL_TOUCHED = "touched";
const char* const SIGNAL_VISIBILITY_CHANGED = "visibilityChanged";
const char* const SIGNAL_LAYOUT_DIRECTION_CHANGED = "layoutDirectionChanged";
const char* const SIGNAL_CHILD_ADDED = "childAdded";
SignalConnectorType signalConnector4( mType, SIGNAL_ON_SCENE, &Actor::DoConnectSignal );
SignalConnectorType signalConnector5( mType, SIGNAL_OFF_SCENE, &Actor::DoConnectSignal );
SignalConnectorType signalConnector6( mType, SIGNAL_ON_RELAYOUT, &Actor::DoConnectSignal );
-SignalConnectorType signalConnector7( mType, SIGNAL_TOUCH, &Actor::DoConnectSignal );
+SignalConnectorType signalConnector7( mType, SIGNAL_TOUCHED, &Actor::DoConnectSignal );
SignalConnectorType signalConnector8( mType, SIGNAL_VISIBILITY_CHANGED, &Actor::DoConnectSignal );
SignalConnectorType signalConnector9( mType, SIGNAL_LAYOUT_DIRECTION_CHANGED, &Actor::DoConnectSignal );
SignalConnectorType signalConnector10( mType, SIGNAL_CHILD_ADDED, &Actor::DoConnectSignal );
bool Actor::GetTouchRequired() const
{
- return !mTouchSignal.Empty() || mDerivedRequiresTouch;
+ return !mTouchedSignal.Empty();
}
bool Actor::GetHoverRequired() const
{
- return !mHoveredSignal.Empty() || mDerivedRequiresHover;
+ return !mHoveredSignal.Empty();
}
bool Actor::GetWheelEventRequired() const
{
- return !mWheelEventSignal.Empty() || mDerivedRequiresWheelEvent;
+ return !mWheelEventSignal.Empty();
}
bool Actor::IsHittable() const
return *mGestureData;
}
-bool Actor::IsGestureRequred( Gesture::Type type ) const
+bool Actor::IsGestureRequired( GestureType::Value type ) const
{
- return mGestureData && mGestureData->IsGestureRequred( type );
+ return mGestureData && mGestureData->IsGestureRequired( type );
}
bool Actor::EmitTouchEventSignal( const Dali::TouchEvent& touch )
{
bool consumed = false;
- if( !mTouchSignal.Empty() )
+ if( !mTouchedSignal.Empty() )
{
Dali::Actor handle( this );
- consumed = mTouchSignal.Emit( handle, touch );
+ consumed = mTouchedSignal.Emit( handle, touch );
}
return consumed;
consumed = mHoveredSignal.Emit( handle, event );
}
- if( !consumed )
- {
- // Notification for derived classes
- consumed = OnHoverEvent( event );
- }
-
return consumed;
}
consumed = mWheelEventSignal.Emit( handle, event );
}
- if( !consumed )
- {
- // Notification for derived classes
- consumed = OnWheelEvent( event );
- }
-
return consumed;
}
}
}
-Dali::Actor::TouchEventSignalType& Actor::TouchSignal()
+Dali::Actor::TouchEventSignalType& Actor::TouchedSignal()
{
- return mTouchSignal;
+ return mTouchedSignal;
}
Dali::Actor::HoverSignalType& Actor::HoveredSignal()
{
actor->OnRelayoutSignal().Connect( tracker, functor );
}
- else if( 0 == signalName.compare( SIGNAL_TOUCH ) )
+ else if( 0 == signalName.compare( SIGNAL_TOUCHED ) )
{
- actor->TouchSignal().Connect( tracker, functor );
+ actor->TouchedSignal().Connect( tracker, functor );
}
else if( 0 == signalName.compare( SIGNAL_VISIBILITY_CHANGED ) )
{
mAnchorPoint( NULL ),
mRelayoutData( NULL ),
mGestureData( NULL ),
- mTouchSignal(),
+ mTouchedSignal(),
mHoveredSignal(),
mWheelEventSignal(),
mOnSceneSignal(),
mSensitive( true ),
mLeaveRequired( false ),
mKeyboardFocusable( false ),
- mDerivedRequiresTouch( false ),
- mDerivedRequiresHover( false ),
- mDerivedRequiresWheelEvent( false ),
mOnSceneSignalled( false ),
mInsideOnSizeSet( false ),
mInheritPosition( true ),
* @param[in] type The gesture type.
* @return True if the gesture is required, false otherwise.
*/
- bool IsGestureRequred( Gesture::Type type ) const;
+ bool IsGestureRequired( GestureType::Value type ) const;
// Signals
void EmitChildRemovedSignal( Actor& child );
/**
- * @copydoc Dali::Actor::TouchEventSignal()
+ * @copydoc Dali::Actor::TouchedSignal()
*/
- Dali::Actor::TouchEventSignalType& TouchSignal();
+ Dali::Actor::TouchEventSignalType& TouchedSignal();
/**
* @copydoc Dali::Actor::HoveredSignal()
}
/**
- * For use in derived classes.
- * This is only called if mDerivedRequiresHover is true, and the hover-signal was not consumed.
- * @param[in] event The hover event.
- * @return True if the event should be consumed.
- */
- virtual bool OnHoverEvent( const HoverEvent& event )
- {
- return false;
- }
-
- /**
- * For use in derived classes.
- * This is only called if the wheel signal was not consumed.
- * @param[in] event The wheel event.
- * @return True if the event should be consumed.
- */
- virtual bool OnWheelEvent( const WheelEvent& event )
- {
- return false;
- }
-
- /**
* @brief Retrieves the cached event side value of a default property.
* @param[in] index The index of the property
* @param[out] value Is set with the cached value of the property if found.
ActorGestureData* mGestureData; ///< Optional Gesture data. Only created when actor requires gestures
// Signals
- Dali::Actor::TouchEventSignalType mTouchSignal;
+ Dali::Actor::TouchEventSignalType mTouchedSignal;
Dali::Actor::HoverSignalType mHoveredSignal;
Dali::Actor::WheelEventSignalType mWheelEventSignal;
Dali::Actor::OnSceneSignalType mOnSceneSignal;
bool mSensitive : 1; ///< Whether the actor emits touch event signals
bool mLeaveRequired : 1; ///< Whether a touch event signal is emitted when the a touch leaves the actor's bounds
bool mKeyboardFocusable : 1; ///< Whether the actor should be focusable by keyboard navigation
- bool mDerivedRequiresTouch : 1; ///< Whether the derived actor type requires touch event signals
- bool mDerivedRequiresHover : 1; ///< Whether the derived actor type requires hover event signals
- bool mDerivedRequiresWheelEvent : 1; ///< Whether the derived actor type requires wheel event signals
bool mOnSceneSignalled : 1; ///< Set to true before OnSceneConnection signal is emitted, and false before OnSceneDisconnection
bool mInsideOnSizeSet : 1; ///< Whether we are inside OnSizeSet
bool mInheritPosition : 1; ///< Cached: Whether the parent's position should be inherited.
: Actor( Actor::BASIC, node ),
mImpl( &extension )
{
- mDerivedRequiresTouch = extension.RequiresTouchEvents();
- mDerivedRequiresHover = extension.RequiresHoverEvents();
- mDerivedRequiresWheelEvent = extension.RequiresWheelEvents();
SetRelayoutEnabled( extension.IsRelayoutEnabled() );
}
/**
* @copydoc Internal::Actor::OnPropertySet
*/
- virtual void OnPropertySet( Property::Index index, Property::Value propertyValue )
+ virtual void OnPropertySet( Property::Index index, const Property::Value& propertyValue )
{
mImpl->OnPropertySet(index, propertyValue);
}
}
/**
- * @copydoc Internal::Actor::OnHoverEvent
- */
- virtual bool OnHoverEvent(const HoverEvent& event)
- {
- return mImpl->OnHoverEvent(event);
- }
-
- /**
- * @copydoc Internal::Actor::OnKeyEvent
- */
- virtual bool OnKeyEvent(const KeyEvent& event)
- {
- return mImpl->OnKeyEvent(event);
- }
-
- /**
- * @copydoc Internal::Actor::OnWheelEvent
- */
- virtual bool OnWheelEvent(const WheelEvent& event)
- {
- return mImpl->OnWheelEvent(event);
- }
-
- /**
* @copydoc Internal::Actor::OnRelayout
*/
virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
constraint.AddSource( Dali::Source(source.object, source.propertyIndex ) );
constraint.SetTag( static_cast<uint32_t>( reinterpret_cast<uintptr_t>( this ) ) ); // taking 32bits of this as tag
- constraint.SetRemoveAction( Dali::Constraint::Discard );
+ constraint.SetRemoveAction( Dali::Constraint::DISCARD );
constraint.Apply();
//Start observing the object
constraint.AddSource( Dali::Source(source.object, source.propertyIndex ) );
constraint.SetTag( static_cast<uint32_t>( reinterpret_cast<uintptr_t>( this ) ) ); // taking 32bits of this as tag
- constraint.SetRemoveAction( Dali::Constraint::Discard );
+ constraint.SetRemoveAction( Dali::Constraint::DISCARD );
constraint.Apply();
}
else if( propertyType == Dali::Property::ROTATION )
constraint.AddSource( Dali::Source(source.object, source.propertyIndex ) );
constraint.SetTag( static_cast<uint32_t>( reinterpret_cast<uintptr_t>( this ) ) ); // taking 32bits of this as tag
- constraint.SetRemoveAction( Dali::Constraint::Discard );
+ constraint.SetRemoveAction( Dali::Constraint::DISCARD );
constraint.Apply();
}
* @param [in] index The index of the property.
* @param [in] propertyValue The value of the property.
*/
- virtual void OnPropertySet( Property::Index index, Property::Value propertyValue ) {}
+ virtual void OnPropertySet( Property::Index index, const Property::Value& propertyValue ) {}
/**
* Retrieves the TypeInfo for this object. Only retrieves it from the type-registry once and then stores a pointer
mPropertyType( Property::NONE ),
mComponentIndex( componentIndex ),
mCondition( condition ),
- mNotifyMode( Dali::PropertyNotification::NotifyOnTrue ),
+ mNotifyMode( Dali::PropertyNotification::NOTIFY_ON_TRUE ),
mNotifyResult( false ),
mCompare( false )
{
// found one with the matching SceneGraph::PropertyNotification?
if( (*iter)->CompareSceneObject( propertyNotification ) )
{
- // allow application to access the value that triggered this emit incase of NotifyOnChanged mode
+ // allow application to access the value that triggered this emit incase of NOTIFY_ON_CHANGED mode
(*iter)->SetNotifyResult(validity);
// yes..emit signal
(*iter)->EmitSignalNotify();
#include <dali/internal/update/nodes/node.h>
#include <dali/internal/update/manager/update-manager.h>
#include <dali/internal/update/common/scene-graph-scene.h>
+#include <dali/public-api/common/constants.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/internal/event/rendering/frame-buffer-impl.h>
namespace Internal
{
-namespace
-{
-
-const Vector4 DEFAULT_BACKGROUND_COLOR(0.0f, 0.0f, 0.0f, 1.0f); // Default background color
-
-} //Unnamed namespace
-
ScenePtr Scene::New( Size size )
{
ScenePtr scene = new Scene;
void Scene::EmitTouchedSignal( const Dali::TouchEvent& touch )
{
Dali::Integration::Scene handle( this );
- if ( !mTouchSignal.Empty() )
+ if ( !mTouchedSignal.Empty() )
{
- mTouchSignal.Emit( touch );
+ mTouchedSignal.Emit( touch );
}
}
return mEventProcessingFinishedSignal;
}
-Integration::Scene::TouchSignalType& Scene::TouchSignal()
+Integration::Scene::TouchEventSignalType& Scene::TouchedSignal()
{
- return mTouchSignal;
+ return mTouchedSignal;
}
Integration::Scene::WheelEventSignalType& Scene::WheelEventSignal()
Integration::Scene::EventProcessingFinishedSignalType& EventProcessingFinishedSignal();
/**
- * @copydoc Integration::Scene::TouchSignal()
+ * @copydoc Integration::Scene::TouchedSignal()
*/
- Integration::Scene::TouchSignalType& TouchSignal();
+ Integration::Scene::TouchEventSignalType& TouchedSignal();
/**
* @copydoc Integration::Scene::sWheelEventSignal()
Integration::Scene::EventProcessingFinishedSignalType mEventProcessingFinishedSignal;
// The touch signal
- Integration::Scene::TouchSignalType mTouchSignal;
+ Integration::Scene::TouchEventSignalType mTouchedSignal;
// The wheel event signal
Integration::Scene::WheelEventSignalType mWheelEventSignal;
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/public-api/rendering/frame-buffer.h>
+#include <dali/public-api/common/constants.h>
using Dali::Internal::SceneGraph::Node;
const char* const SIGNAL_KEY_EVENT = "keyEvent";
const char* const SIGNAL_KEY_EVENT_GENERATED = "keyEventGenerated";
const char* const SIGNAL_EVENT_PROCESSING_FINISHED = "eventProcessingFinished";
-const char* const SIGNAL_TOUCH = "touch";
+const char* const SIGNAL_TOUCHED = "touched";
const char* const SIGNAL_WHEEL_EVENT = "wheelEvent";
const char* const SIGNAL_CONTEXT_LOST = "contextLost";
const char* const SIGNAL_CONTEXT_REGAINED = "contextRegained";
SignalConnectorType signalConnector6( mType, SIGNAL_CONTEXT_REGAINED, &Stage::DoConnectSignal );
SignalConnectorType signalConnector7( mType, SIGNAL_SCENE_CREATED, &Stage::DoConnectSignal );
SignalConnectorType signalConnector8( mType, SIGNAL_KEY_EVENT_GENERATED, &Stage::DoConnectSignal );
-SignalConnectorType signalConnector9( mType, SIGNAL_TOUCH, &Stage::DoConnectSignal );
+SignalConnectorType signalConnector9( mType, SIGNAL_TOUCHED, &Stage::DoConnectSignal );
} // unnamed namespace
void Stage::Initialize( Scene& scene )
{
mScene = &scene;
- mScene->SetBackgroundColor( Dali::Stage::DEFAULT_BACKGROUND_COLOR );
+ mScene->SetBackgroundColor( Dali::DEFAULT_BACKGROUND_COLOR );
mScene->EventProcessingFinishedSignal().Connect( this, &Stage::OnEventProcessingFinished );
mScene->KeyEventSignal().Connect( this, &Stage::OnKeyEvent );
- mScene->TouchSignal().Connect( this, &Stage::OnTouchEvent );
+ mScene->TouchedSignal().Connect( this, &Stage::OnTouchEvent );
mScene->WheelEventSignal().Connect( this, &Stage::OnWheelEvent );
}
{
stage->EventProcessingFinishedSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_TOUCH ) )
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_TOUCHED ) )
{
- stage->TouchSignal().Connect( tracker, functor );
+ stage->TouchedSignal().Connect( tracker, functor );
}
else if( 0 == strcmp( signalName.c_str(), SIGNAL_WHEEL_EVENT ) )
{
void Stage::OnTouchEvent( const Dali::TouchEvent& touch )
{
- mTouchSignal.Emit( touch );
+ EmitTouchedSignal( touch );
}
void Stage::OnWheelEvent( const Dali::WheelEvent& event )
void Stage::EmitEventProcessingFinishedSignal()
{
- mEventProcessingFinishedSignal.Emit();
+ mEventProcessingFinishedSignal.Emit();
}
void Stage::EmitTouchedSignal( const Dali::TouchEvent& touch )
{
- mTouchSignal.Emit( touch );
+ mTouchedSignal.Emit( touch );
}
void Stage::EmitWheelEventSignal( const WheelEvent& event )
return mEventProcessingFinishedSignal;
}
-Dali::Stage::TouchSignalType& Stage::TouchSignal()
+Dali::Stage::TouchEventSignalType& Stage::TouchedSignal()
{
- return mTouchSignal;
+ return mTouchedSignal;
}
Dali::Stage::WheelEventSignalType& Stage::WheelEventSignal()
mKeyEventSignal(),
mKeyEventGeneratedSignal(),
mEventProcessingFinishedSignal(),
- mTouchSignal(),
+ mTouchedSignal(),
mWheelEventSignal(),
mContextLostSignal(),
mContextRegainedSignal(),
void OnKeyEvent( const Dali::KeyEvent& event );
/**
- * Callback for Internal::Scene TouchSignal signal
+ * Callback for Internal::Scene TouchedSignal signal
*/
void OnTouchEvent( const Dali::TouchEvent& touch );
Dali::Stage::EventProcessingFinishedSignalType& EventProcessingFinishedSignal();
/**
- * @copydoc Dali::Stage::TouchSignal()
+ * @copydoc Dali::Stage::TouchedSignal()
*/
- Dali::Stage::TouchSignalType& TouchSignal();
+ Dali::Stage::TouchEventSignalType& TouchedSignal();
/**
* @copydoc Dali::Stage::WheelEventSignal()
Dali::Stage::EventProcessingFinishedSignalType mEventProcessingFinishedSignal;
// The touched signal
- Dali::Stage::TouchSignalType mTouchSignal;
+ Dali::Stage::TouchEventSignalType mTouchedSignal;
// The wheel event signal
Dali::Stage::WheelEventSignalType mWheelEventSignal;
{
ActorGestureData::ActorGestureData()
-: gesturesRequired( Gesture::Type( 0 ) ),
+: gesturesRequired( GestureType::Value( 0 ) ),
panDetectors( nullptr ),
pinchDetectors( nullptr ),
longPressDetectors( nullptr ),
void ActorGestureData::AddGestureDetector( GestureDetector& detector )
{
- const Gesture::Type type( detector.GetType() );
+ const GestureType::Value type( detector.GetType() );
GestureDetectorContainer*& containerPtr( GetContainerPtr( type ) );
if ( NULL == containerPtr )
}
containerPtr->push_back( &detector );
- gesturesRequired = Gesture::Type( gesturesRequired | type );
+ gesturesRequired = GestureType::Value( gesturesRequired | type );
}
void ActorGestureData::RemoveGestureDetector( GestureDetector& detector )
{
- const Gesture::Type type( detector.GetType() );
+ const GestureType::Value type( detector.GetType() );
GestureDetectorContainer*& containerPtr( GetContainerPtr( type ) );
DALI_ASSERT_DEBUG( containerPtr && "Container had not been created" );
if ( container.empty() )
{
- gesturesRequired = Gesture::Type( gesturesRequired & ~type );
+ gesturesRequired = GestureType::Value( gesturesRequired & ~type );
delete containerPtr;
containerPtr = NULL;
}
}
-GestureDetectorContainer& ActorGestureData::GetGestureDetectorContainer( Gesture::Type type )
+GestureDetectorContainer& ActorGestureData::GetGestureDetectorContainer( GestureType::Value type )
{
return *GetContainerPtr( type );
}
-GestureDetectorContainer*& ActorGestureData::GetContainerPtr( Gesture::Type type )
+GestureDetectorContainer*& ActorGestureData::GetContainerPtr( GestureType::Value type )
{
switch ( type )
{
- case Gesture::Pan:
+ case GestureType::PAN:
{
return panDetectors;
}
- case Gesture::Pinch:
+ case GestureType::PINCH:
{
return pinchDetectors;
}
- case Gesture::LongPress:
+ case GestureType::LONG_PRESS:
{
return longPressDetectors;
}
- case Gesture::Tap:
+ case GestureType::TAP:
{
return tapDetectors;
}
- case Gesture::Rotation:
+ case GestureType::ROTATION:
{
return rotationDetectors;
}
* @param[in] type The gesture type.
* @return true if the gesture is required, false otherwise.
*/
- inline bool IsGestureRequred( Gesture::Type type ) const
+ inline bool IsGestureRequired( GestureType::Value type ) const
{
return type & gesturesRequired;
}
* @param[in] type The container type required
* @pre Ensure IsGestureRequired() is used to check if the container is actually available.
*/
- GestureDetectorContainer& GetGestureDetectorContainer( Gesture::Type type );
+ GestureDetectorContainer& GetGestureDetectorContainer( GestureType::Value type );
private:
* Helper to retrieve the appropriate container type.
* @param[in] type The container type required.
*/
- inline GestureDetectorContainer*& GetContainerPtr( Gesture::Type type );
+ inline GestureDetectorContainer*& GetContainerPtr( GestureType::Value type );
private:
- Gesture::Type gesturesRequired; ///< Stores which gestures are required
+ GestureType::Value gesturesRequired; ///< Stores which gestures are required
GestureDetectorContainer* panDetectors; ///< Pointer to a container of pan-detectors
GestureDetectorContainer* pinchDetectors; ///< Pointer to a container of pinch-detectors
namespace Internal
{
-GestureDetector::GestureDetector( Gesture::Type type, const SceneGraph::PropertyOwner* sceneObject )
+GestureDetector::GestureDetector( GestureType::Value type, const SceneGraph::PropertyOwner* sceneObject )
: Object( sceneObject ),
mType( type ),
mGestureEventProcessor( ThreadLocalStorage::Get().GetGestureEventProcessor() )
* Retrieves the type of GestureDetector
* @return The GestureDetector Type
*/
- Gesture::Type GetType() const
+ GestureType::Value GetType() const
{
return mType;
}
* @param pointer to the scene object, nullptr if none
* by default GestureDetectors don't have our own scene object
*/
- GestureDetector( Gesture::Type type, const SceneGraph::PropertyOwner* sceneObject = nullptr );
+ GestureDetector( GestureType::Value type, const SceneGraph::PropertyOwner* sceneObject = nullptr );
/**
* A reference counted object may only be deleted by calling Unreference()
protected:
- Gesture::Type mType; ///< The gesture detector will detect this type of gesture.
+ GestureType::Value 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.
#include <dali/internal/event/common/stage-impl.h>
#include <dali/internal/event/events/pinch-gesture/pinch-gesture-detector-impl.h>
#include <dali/internal/update/gestures/scene-graph-pan-gesture.h>
-#include <dali/public-api/events/pan-gesture.h>
+#include <dali/internal/event/events/pan-gesture/pan-gesture-impl.h>
#include <dali/integration-api/debug.h>
{
switch (gestureDetector->GetType())
{
- case Gesture::LongPress:
+ case GestureType::LONG_PRESS:
{
LongPressGestureDetector* longPress = static_cast<LongPressGestureDetector*>(gestureDetector);
mLongPressGestureProcessor.AddGestureDetector(longPress, scene);
break;
}
- case Gesture::Pan:
+ case GestureType::PAN:
{
PanGestureDetector* pan = static_cast<PanGestureDetector*>(gestureDetector);
mPanGestureProcessor.AddGestureDetector(pan, scene, envOptionMinimumPanDistance, envOptionMinimumPanEvents);
break;
}
- case Gesture::Pinch:
+ case GestureType::PINCH:
{
PinchGestureDetector* pinch = static_cast<PinchGestureDetector*>(gestureDetector);
mPinchGestureProcessor.AddGestureDetector(pinch, scene);
break;
}
- case Gesture::Tap:
+ case GestureType::TAP:
{
TapGestureDetector* tap = static_cast<TapGestureDetector*>(gestureDetector);
mTapGestureProcessor.AddGestureDetector(tap, scene);
break;
}
- case Gesture::Rotation:
+ case GestureType::ROTATION:
{
RotationGestureDetector* rotation = static_cast<RotationGestureDetector*>(gestureDetector);
mRotationGestureProcessor.AddGestureDetector(rotation, scene);
{
switch (gestureDetector->GetType())
{
- case Gesture::LongPress:
+ case GestureType::LONG_PRESS:
{
LongPressGestureDetector* longPress = static_cast<LongPressGestureDetector*>(gestureDetector);
mLongPressGestureProcessor.RemoveGestureDetector(longPress);
break;
}
- case Gesture::Pan:
+ case GestureType::PAN:
{
PanGestureDetector* pan = static_cast<PanGestureDetector*>(gestureDetector);
mPanGestureProcessor.RemoveGestureDetector(pan);
break;
}
- case Gesture::Pinch:
+ case GestureType::PINCH:
{
PinchGestureDetector* pinch = static_cast<PinchGestureDetector*>(gestureDetector);
mPinchGestureProcessor.RemoveGestureDetector(pinch);
break;
}
- case Gesture::Tap:
+ case GestureType::TAP:
{
TapGestureDetector* tap = static_cast<TapGestureDetector*>(gestureDetector);
mTapGestureProcessor.RemoveGestureDetector(tap);
break;
}
- case Gesture::Rotation:
+ case GestureType::ROTATION:
{
RotationGestureDetector* rotation = static_cast<RotationGestureDetector*>(gestureDetector);
mRotationGestureProcessor.RemoveGestureDetector(rotation);
{
switch (gestureDetector->GetType())
{
- case Gesture::LongPress:
+ case GestureType::LONG_PRESS:
{
LongPressGestureDetector* longPress = static_cast<LongPressGestureDetector*>(gestureDetector);
mLongPressGestureProcessor.GestureDetectorUpdated(longPress);
break;
}
- case Gesture::Pan:
+ case GestureType::PAN:
{
PanGestureDetector* pan = static_cast<PanGestureDetector*>(gestureDetector);
mPanGestureProcessor.GestureDetectorUpdated(pan);
break;
}
- case Gesture::Pinch:
+ case GestureType::PINCH:
{
PinchGestureDetector* pinch = static_cast<PinchGestureDetector*>(gestureDetector);
mPinchGestureProcessor.GestureDetectorUpdated(pinch);
break;
}
- case Gesture::Tap:
+ case GestureType::TAP:
{
TapGestureDetector* tap = static_cast<TapGestureDetector*>(gestureDetector);
mTapGestureProcessor.GestureDetectorUpdated(tap);
break;
}
- case Gesture::Rotation:
+ case GestureType::ROTATION:
{
// Nothing to do
break;
}
}
-void GestureEventProcessor::SetGestureProperties( const Gesture& gesture )
+void GestureEventProcessor::SetGestureProperties( const Dali::Gesture& gesture )
{
- DALI_ASSERT_DEBUG( gesture.type == Gesture::Pan && "Only PanGesture has a scene object\n" );
+ DALI_ASSERT_DEBUG( gesture.GetType() == GestureType::PAN && "Only PanGesture has a scene object\n" );
- const PanGesture& pan = static_cast< const PanGesture& >( gesture );
+ const Dali::PanGesture& pan = static_cast< const Dali::PanGesture& >( gesture );
if( mPanGestureProcessor.SetPanGestureProperties( pan ) )
{
// We may not be updating so we need to ask the render controller for an update.
#define DALI_INTERNAL_GESTURE_EVENT_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.
// INTERNAL INCLUDES
#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/events/gesture.h>
#include <dali/internal/event/events/gesture-detector-impl.h>
#include <dali/internal/event/events/long-press-gesture/long-press-gesture-processor.h>
#include <dali/internal/event/events/pan-gesture/pan-gesture-processor.h>
namespace Dali
{
-struct Gesture;
-
namespace Integration
{
* @param[in] gesture The gesture whose values will be used in the Update object.
* @note If we are in the middle of processing the gesture being set, then this call is ignored.
*/
- void SetGestureProperties( const Gesture& gesture );
+ void SetGestureProperties( const Dali::Gesture& gesture );
public: // Called by Core
{
}
-GestureEvent::GestureEvent( Gesture::Type gesture, Gesture::State gestureState )
+GestureEvent::GestureEvent( GestureType::Value gesture, GestureState gestureState )
: gestureType( gesture ),
state( gestureState ),
time( 0 )
*/
// INTERNAL INCLUDES
-#include <dali/public-api/events/gesture.h>
#include <dali/integration-api/events/event.h>
+#include <dali/internal/event/events/gesture-impl.h>
namespace Dali
{
/**
* Gesture Type.
*/
- Gesture::Type gestureType;
+ GestureType::Value gestureType;
/**
* The state of the gesture.
*/
- Gesture::State state;
+ GestureState state;
/**
* The time the gesture took place.
* @param[in] gesture The type of gesture event.
* @param[in] gestureState The state of the gesture event.
*/
- GestureEvent( Gesture::Type gesture, Gesture::State gestureState);
+ GestureEvent( GestureType::Value gesture, GestureState gestureState);
};
} // namespace Internal
--- /dev/null
+#ifndef DALI_INTERNAL_GESTURE_H
+#define DALI_INTERNAL_GESTURE_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/events/gesture.h>
+#include <dali/integration-api/events/event.h>
+#include <dali/public-api/object/base-object.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+class Gesture;
+typedef IntrusivePtr<Gesture> GesturePtr;
+
+/**
+ * This is the abstract base structure for any gestures that the adaptor detects and wishes to send
+ * to the Core.
+ */
+class Gesture : public BaseObject
+{
+public:
+
+ /**
+ * @brief Get the gesture type.
+ *
+ * @return The gesture type.
+ */
+ inline GestureType::Value GetType() const
+ {
+ return mGestureType;
+ }
+
+ /**
+ * @brief Set the state of the gesture.
+ * @param[in] state The state of the gesture to set
+ */
+ inline void SetState( GestureState state )
+ {
+ mState = state;
+ }
+
+ /**
+ * @brief Get the state of the gesture.
+ *
+ * @return The state of the gesture.
+ */
+ inline GestureState GetState() const
+ {
+ return mState;
+ }
+
+ /**
+ * @brief Set The time the gesture took place.
+ * @param[in] time The time the gesture took place. to set
+ */
+ inline void SetTime( uint32_t time )
+ {
+ mTime = time;
+ }
+
+ /**
+ * @brief Get the time the gesture took place.
+ *
+ * @return The time the gesture took place.
+ */
+ inline uint32_t GetTime() const
+ {
+ return mTime;
+ }
+
+ Gesture(const Gesture&) = delete; ///< Deleted copy constructor
+ Gesture(Gesture&&) = delete; ///< Deleted move constructor
+ Gesture& operator=(const Gesture&) = delete; ///< Deleted copy assignment operator
+ Gesture& operator=(Gesture&&) = delete; ///< Deleted move assignment operator
+
+protected:
+
+ /**
+ * This constructor is only used by derived classes.
+ * @param[in] gestureType The type of gesture event.
+ * @param[in] gestureState The state of the gesture event.
+ */
+ Gesture(GestureType::Value gestureType, GestureState gestureState)
+ : mGestureType( gestureType ),
+ mState( gestureState )
+ {
+ }
+
+ /**
+ * @brief Virtual destructor.
+ *
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~Gesture() = default;
+
+private:
+ GestureType::Value mGestureType;
+ GestureState mState;
+ uint32_t mTime{0u};
+};
+
+} // namespace Internal
+
+/**
+ * Helper methods for public API.
+ */
+inline Internal::Gesture& GetImplementation(Dali::Gesture& gesture)
+{
+ DALI_ASSERT_ALWAYS( gesture && "gesture handle is empty" );
+
+ BaseObject& handle = gesture.GetBaseObject();
+
+ return static_cast<Internal::Gesture&>(handle);
+}
+
+inline const Internal::Gesture& GetImplementation(const Dali::Gesture& gesture)
+{
+ DALI_ASSERT_ALWAYS( gesture && "gesture handle is empty" );
+
+ const BaseObject& handle = gesture.GetBaseObject();
+
+ return static_cast<const Internal::Gesture&>(handle);
+}
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_GESTURE_H
*/
struct GestureHitTestCheck : public HitTestAlgorithm::HitTestInterface
{
- GestureHitTestCheck( Gesture::Type type )
+ GestureHitTestCheck( GestureType::Value type )
: mType( type )
{
}
virtual bool IsActorHittable( Actor* actor )
{
- return actor->IsGestureRequred( mType ) && // Does the Application or derived actor type require the gesture?
- actor->IsHittable(); // Is actor sensitive, visible and on the scene?
+ return actor->IsGestureRequired( mType ) && // Does the Application or derived actor type require the gesture?
+ actor->IsHittable(); // Is actor sensitive, visible and on the scene?
}
virtual bool DescendActorHierarchy( Actor* actor )
return layer->IsTouchConsumed();
}
- Gesture::Type mType;
+ GestureType::Value mType;
};
} // unnamed namespace
-GestureProcessor::GestureProcessor( Gesture::Type type )
+GestureProcessor::GestureProcessor( GestureType::Value type )
: mGestureRecognizer(),
mNeedsUpdate( false ),
mType( type ),
while ( actor )
{
// We may be checking a parent so ensure the parent requires this gesture (and do not unintentionally create the gesture data for the parent)
- if ( actor->IsGestureRequred( mType ) )
+ if ( actor->IsGestureRequired( mType ) )
{
// Retrieve the actor's detectors and check if they satisfy current gesture
const GestureDetectorContainer& connectedDetectors( actor->GetGestureData().GetGestureDetectorContainer( mType ) );
/**
* Protected constructor. Cannot create an instance of GestureProcessor
*/
- GestureProcessor( Gesture::Type type );
+ GestureProcessor( GestureType::Value type );
/**
* Virtual protected destructor.
private: // Data
- Gesture::Type mType; ///< Type of GestureProcessor
+ GestureType::Value 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
};
* Returns the type of gesture detector.
* @return Type of gesture detector.
*/
- Gesture::Type GetType() const { return mType; }
+ GestureType::Value GetType() const { return mType; }
/**
* Called when we get a touch event.
* @param[in] screenSize The size of the screen.
* @param[in] detectorType The type of gesture detector.
*/
- GestureRecognizer( Vector2 screenSize, Gesture::Type detectorType )
+ GestureRecognizer( Vector2 screenSize, GestureType::Value detectorType )
: mScreenSize( screenSize ),
mType( detectorType ),
mScene( nullptr )
* Use this constructor with the screen size is not used in the dereived class.
* @param[in] detectorType The type of gesture detector.
*/
- GestureRecognizer( Gesture::Type detectorType )
+ GestureRecognizer( GestureType::Value detectorType )
: GestureRecognizer( Vector2::ZERO, detectorType )
{
}
protected:
Vector2 mScreenSize;
- Gesture::Type mType;
+ GestureType::Value mType;
Scene* mScene;
};
* Default Constructor
* @param[in] typeRequired The gesture type required
*/
- GestureRequest( Gesture::Type typeRequired )
+ GestureRequest( GestureType::Value typeRequired )
: type( typeRequired )
{
}
// Data Members
- Gesture::Type type; ///< The type of gesture required.
+ GestureType::Value type; ///< The type of gesture required.
};
/**
* Default Constructor
*/
PanGestureRequest()
- : GestureRequest(Gesture::Pan),
+ : GestureRequest(GestureType::PAN),
minTouches(1),
maxTouches(1)
{
* Default Constructor
*/
TapGestureRequest()
- : GestureRequest(Gesture::Tap),
+ : GestureRequest(GestureType::TAP),
minTaps(1),
maxTaps(1),
minTouches(1),
* Default Constructor
*/
LongPressGestureRequest()
- : GestureRequest(Gesture::LongPress),
+ : GestureRequest(GestureType::LONG_PRESS),
minTouches(1),
maxTouches(1)
{
return hoverEvent;
}
-HoverEvent::~HoverEvent()
-{
-}
-
unsigned long HoverEvent::GetTime() const
{
return mTime;
// INTERNAL INCLUDES
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/events/hover-event.h>
-#include <dali/public-api/events/touch-point.h>
+#include <dali/devel-api/events/touch-point.h>
#include <dali/public-api/object/base-object.h>
#include <dali/integration-api/events/point.h>
*/
static HoverEventPtr Clone( const HoverEvent& rhs );
- /**
- * @brief Destructor
- */
- ~HoverEvent();
-
// Getters
/**
private:
+ /**
+ * @brief Destructor
+ *
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~HoverEvent() = default;
+
// Not copyable or movable
HoverEvent( const HoverEvent& rhs ) = delete; ///< Deleted copy constructor
#if defined(DEBUG_ENABLED)
Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_HOVER_PROCESSOR" );
-const char * TOUCH_POINT_STATE[TouchPoint::Last] =
+const char * TOUCH_POINT_STATE[PointState::INTERRUPTED + 1] =
{
- "Started",
- "Finished",
- "Motion",
- "Leave",
- "Stationary",
- "Interrupted",
+ "STARTED",
+ "FINISHED",
+ "MOTION",
+ "LEAVE",
+ "STATIONARY",
+ "INTERRUPTED",
};
#endif // defined(DEBUG_ENABLED)
DALI_LOG_TRACE_METHOD( gLogFilter );
DALI_ASSERT_ALWAYS( !event.points.empty() && "Empty HoverEvent sent from Integration\n" );
- TouchPoint::State state = static_cast< TouchPoint::State >( event.points[0].GetState() );
+ PointState::Type state = static_cast< PointState::Type >( event.points[0].GetState() );
PRINT_HIERARCHY(gLogFilter);
// 1) Check if it is an interrupted event - we should inform our last primary hit actor about this
// and emit the stage signal as well.
- if ( state == TouchPoint::Interrupted )
+ if ( state == PointState::INTERRUPTED )
{
Dali::Actor consumingActor;
Integration::Point currentPoint( event.points[0] );
}
}
- // 5) If our primary point is an Finished event, then the primary point (in multi-touch) will change next
+ // 5) If our primary point is a FINISHED event, then the primary point (in multi-touch) will change next
// time so set our last primary actor to NULL. Do the same to the last consumed actor as well.
if ( primaryPointState == PointState::FINISHED )
}
}
- // 6) Emit an interrupted event to the hover-started actor if it hasn't consumed the Finished.
+ // 6) Emit an interrupted event to the hover-started actor if it hasn't consumed the FINISHED.
if ( hoverEvent->GetPointCount() == 1 ) // Only want the first hover started
{
{
}
-KeyEvent::~KeyEvent()
-{
-}
-
KeyEventPtr KeyEvent::New( const std::string& keyName,
const std::string& logicalKey,
const std::string& keyString,
const Device::Subclass::Type deviceSubclass );
/**
- * @brief Destructor.
- */
- ~KeyEvent();
-
- /**
* Create a new KeyEvent.
*
* @param[in] keyName The name of the key pressed or command from the IMF, if later then the some following parameters will be needed.
private:
+ /**
+ * @brief Destructor.
+ *
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~KeyEvent() = default;
+
// Not copyable or movable
KeyEvent( const KeyEvent& rhs ) = delete; ///< Deleted copy constructor
/*
- * 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.
#include <cstring> // for strcmp
// INTERNAL INCLUDES
-#include <dali/public-api/events/long-press-gesture.h>
+
#include <dali/public-api/object/type-registry.h>
#include <dali/internal/event/events/gesture-event-processor.h>
}
LongPressGestureDetector::LongPressGestureDetector()
-: GestureDetector(Gesture::LongPress),
+: GestureDetector(GestureType::LONG_PRESS),
mMinimumTouchesRequired(DEFAULT_TOUCHES_REQUIRED),
mMaximumTouchesRequired(DEFAULT_TOUCHES_REQUIRED)
{
}
LongPressGestureDetector::LongPressGestureDetector(unsigned int minTouches, unsigned int maxTouches)
-: GestureDetector(Gesture::LongPress),
+: GestureDetector(GestureType::LONG_PRESS),
mMinimumTouchesRequired(minTouches),
mMaximumTouchesRequired(maxTouches)
{
return mMaximumTouchesRequired;
}
-void LongPressGestureDetector::EmitLongPressGestureSignal(Dali::Actor pressedActor, const LongPressGesture& longPress)
+void LongPressGestureDetector::EmitLongPressGestureSignal(Dali::Actor pressedActor, const Dali::LongPressGesture& longPress)
{
// Guard against destruction during signal emission
Dali::LongPressGestureDetector handle( this );
#define DALI_INTERNAL_LONG_PRESS_GESTURE_DETECTOR_IMPL_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.
namespace Dali
{
-struct LongPressGesture;
-
namespace Internal
{
* @param[in] pressedActor The pressed actor.
* @param[in] longPress The long press
*/
- void EmitLongPressGestureSignal(Dali::Actor pressedActor, const LongPressGesture& longPress);
+ void EmitLongPressGestureSignal(Dali::Actor pressedActor, const Dali::LongPressGesture& longPress);
public: // Signals
/*
- * 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.
namespace Internal
{
-LongPressGestureEvent::LongPressGestureEvent( Gesture::State state )
-: GestureEvent( Gesture::LongPress, state ),
+LongPressGestureEvent::LongPressGestureEvent( GestureState state )
+: GestureEvent( GestureType::LONG_PRESS, state ),
numberOfTouches(1)
{
}
* send it to the Core.
*
* This gesture can be in four states:
- * - Possible: When the user first puts their finger down - Core needs to hit test the down point.
- * - Started: When the long-press gesture is actually detected.
- * - Finished: When the user finally lifts all touches.
- * - Cancelled: If, after a down event, no long press is detected, or a system interruption.
+ * - POSSIBLE: When the user first puts their finger down - Core needs to hit test the down point.
+ * - STARTED: When the long-press gesture is actually detected.
+ * - FINISHED: When the user finally lifts all touches.
+ * - CANCELLED: If, after a down event, no long press is detected, or a system interruption.
*/
struct LongPressGestureEvent : public GestureEvent
{
/**
* Default Constructor
- * @param[in] state Started, when we detect a long press.
- * Finished, when all touches are finished.
+ * @param[in] state STARTED, when we detect a long press.
+ * FINISHED, when all touches are finished.
*/
- LongPressGestureEvent( Gesture::State state );
+ LongPressGestureEvent( GestureState state );
/**
* Virtual destructor
--- /dev/null
+#ifndef DALI_INTERNAL_LONG_PRESS_GESTURE_H
+#define DALI_INTERNAL_LONG_PRESS_GESTURE_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/event/events/gesture-impl.h>
+#include <dali/public-api/events/long-press-gesture.h>
+#include <dali/public-api/math/vector2.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+class LongPressGesture;
+typedef IntrusivePtr< LongPressGesture > LongPressGesturePtr;
+
+/**
+ * @copydoc Dali::LongPressGesture
+ */
+class LongPressGesture final : public Gesture
+{
+public:
+
+ /**
+ * Default Constructor
+ * @param[in] state STARTED, when we detect a long press.
+ * FINISHED, when all touches are finished.
+ */
+ LongPressGesture( GestureState state )
+ : Gesture( GestureType::LONG_PRESS, state )
+ {
+ }
+
+ LongPressGesture(const LongPressGesture&) = delete; ///< Deleted copy constructor
+ LongPressGesture(LongPressGesture&&) = delete; ///< Deleted move constructor
+ LongPressGesture& operator=(const LongPressGesture&) = delete; ///< Deleted copy assignment operator
+ LongPressGesture& operator=(LongPressGesture&&) = delete; ///< Deleted move assignment operator
+
+ /**
+ * @brief Set the number of touch points.
+ * @param[in] numberOfTouches The number of touch points to set.
+ */
+ inline void SetNumberOfTouches( uint32_t numberOfTouches )
+ {
+ mNumberOfTouches = numberOfTouches;
+ }
+
+ /**
+ * @copydoc Dali::LongPressGesture::GetNumberOfTouches()
+ */
+ inline uint32_t GetNumberOfTouches() const
+ {
+ return mNumberOfTouches;
+ }
+
+ /**
+ * @brief Set This is the point, in screen coordinates.
+ * @param[in] screenPoint The point in screen coordinates to set.
+ */
+ inline void SetScreenPoint( const Vector2& screenPoint )
+ {
+ mScreenPoint = screenPoint;
+ }
+
+ /**
+ * @copydoc Dali::LongPressGesture::GetScreenPoint()
+ */
+ inline const Vector2& GetScreenPoint() const
+ {
+ return mScreenPoint;
+ }
+
+ /**
+ * @brief Set This is the point, in local actor coordinates.
+ * @param[in] localPoint The point in local actor coordinates to set.
+ */
+ inline void SetLocalPoint( const Vector2& localPoint )
+ {
+ mLocalPoint = localPoint;
+ }
+
+ /**
+ * @copydoc Dali::LongPressGesture::GetLocalPoint()
+ */
+ inline const Vector2& GetLocalPoint() const
+ {
+ return mLocalPoint;
+ }
+
+private:
+
+ /**
+ * @brief Virtual destructor
+ *
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~LongPressGesture() = default;
+
+private:
+ Vector2 mScreenPoint;
+ Vector2 mLocalPoint;
+ uint32_t mNumberOfTouches{1u};
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::LongPressGesture& GetImplementation( Dali::LongPressGesture& longPressGesture )
+{
+ DALI_ASSERT_ALWAYS( longPressGesture && "longPressGesture handle is empty" );
+
+ BaseObject& object = longPressGesture.GetBaseObject();
+
+ return static_cast< Internal::LongPressGesture& >( object );
+}
+
+inline const Internal::LongPressGesture& GetImplementation( const Dali::LongPressGesture& longPressGesture )
+{
+ DALI_ASSERT_ALWAYS( longPressGesture && "longPressGesture handle is empty" );
+
+ const BaseObject& object = longPressGesture.GetBaseObject();
+
+ return static_cast< const Internal::LongPressGesture& >( object );
+}
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_LONG_PRESS_GESTURE_H
// INTERNAL INCLUDES
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/events/long-press-gesture.h>
+#include <dali/internal/event/events/long-press-gesture/long-press-gesture-impl.h>
#include <dali/internal/event/events/long-press-gesture/long-press-gesture-event.h>
#include <dali/integration-api/debug.h>
#include <dali/internal/event/actors/actor-impl.h>
const LongPressGestureEvent& longPressEvent,
Vector2 localPoint)
{
- LongPressGesture longPress(longPressEvent.state);
- longPress.time = longPressEvent.time;
- longPress.numberOfTouches = longPressEvent.numberOfTouches;
- longPress.screenPoint = longPressEvent.point;
- longPress.localPoint = localPoint;
+ Internal::LongPressGesturePtr longPress( new Internal::LongPressGesture(longPressEvent.state ) );
+ longPress->SetTime( longPressEvent.time );
+ longPress->SetNumberOfTouches( longPressEvent.numberOfTouches );
+ longPress->SetScreenPoint( longPressEvent.point );
+ longPress->SetLocalPoint( localPoint );
Dali::Actor actorHandle( actor );
const GestureDetectorContainer::const_iterator endIter = gestureDetectors.end();
for ( GestureDetectorContainer::const_iterator iter = gestureDetectors.begin(); iter != endIter; ++iter )
{
- static_cast< LongPressGestureDetector* >( *iter )->EmitLongPressGestureSignal( actorHandle, longPress );
+ static_cast< LongPressGestureDetector* >( *iter )->EmitLongPressGestureSignal( actorHandle, Dali::LongPressGesture( longPress.Get() ) );
}
}
} // unnamed namespace
LongPressGestureProcessor::LongPressGestureProcessor()
-: GestureProcessor( Gesture::LongPress ),
+: GestureProcessor( GestureType::LONG_PRESS ),
mLongPressGestureDetectors(),
mCurrentEmitters(),
mCurrentRenderTask(),
{
switch ( longPressEvent.state )
{
- case Gesture::Possible:
+ case GestureState::POSSIBLE:
{
mCurrentEmitters.clear();
ResetActor();
break;
}
- case Gesture::Started:
+ case GestureState::STARTED:
{
Actor* currentGesturedActor = GetCurrentGesturedActor();
if ( currentGesturedActor )
break;
}
- case Gesture::Finished:
+ case GestureState::FINISHED:
{
// The gesture should only be sent to the gesture detector which first received it so that it
// can be told when the gesture ends as well.
break;
}
- case Gesture::Cancelled:
+ case GestureState::CANCELLED:
{
mCurrentEmitters.clear();
ResetActor();
break;
}
- case Gesture::Continuing:
+ case GestureState::CONTINUING:
{
- DALI_ABORT( "Incorrect state received from Integration layer: Continuing\n" );
+ DALI_ABORT( "Incorrect state received from Integration layer: CONTINUING\n" );
break;
}
- case Gesture::Clear:
+ case GestureState::CLEAR:
{
- DALI_ABORT( "Incorrect state received from Integration layer: Clear\n" );
+ DALI_ABORT( "Incorrect state received from Integration layer: CLEAR\n" );
break;
}
}
// EXTERNAL INCLUDES
#include <cmath>
-#include <dali/public-api/events/touch-point.h>
+#include <dali/devel-api/events/touch-point.h>
#include <dali/public-api/math/vector2.h>
#include <dali/internal/event/common/thread-local-storage.h>
} // unnamed namespace
LongPressGestureRecognizer::LongPressGestureRecognizer(Observer& observer, Vector2 screenSize, const LongPressGestureRequest& request, uint32_t minimumHoldingTime )
-: GestureRecognizer( screenSize, Gesture::LongPress ),
+: GestureRecognizer( screenSize, GestureType::LONG_PRESS ),
mObserver( observer ),
- mState( Clear ),
+ mState( CLEAR ),
mMinimumTouchesRequired( request.minTouches ),
mMaximumTouchesRequired( request.maxTouches ),
mTouchTime( 0 ),
switch (mState)
{
- // Clear: Wait till one point touches the screen before starting timer.
- case Clear:
+ // CLEAR: Wait till one point touches the screen before starting timer.
+ case CLEAR:
{
const Integration::Point& point = event.points[0];
}
mTimerId = platformAbstraction.StartTimer( mMinimumHoldingTime, MakeCallback( this, &LongPressGestureRecognizer::TimerCallback ) );
- // A long press gesture may be possible, tell Core about this and change state to Touched.
- mState = Touched;
- EmitGesture( Gesture::Possible );
+ // A long press gesture may be possible, tell Core about this and change state to TOUCHED.
+ mState = TOUCHED;
+ EmitGesture( GestureState::POSSIBLE );
}
break;
}
- // Touched: Monitor movement and addition/removal of points.
- case Touched:
+ // TOUCHED: Monitor movement and addition/removal of points.
+ case TOUCHED:
{
if (pointCount > mMaximumTouchesRequired)
{
- // A long press did not occur, tell Core that it was cancelled and change state to Failed.
- EmitGesture( Gesture::Cancelled );
+ // A long press did not occur, tell Core that it was cancelled and change state to FAILED.
+ EmitGesture( GestureState::CANCELLED );
mTouchPositions.clear();
platformAbstraction.CancelTimer(mTimerId);
mTimerId = 0;
- mState = Failed;
+ mState = FAILED;
break;
}
case PointState::INTERRUPTED:
{
// System has interrupted us, long press is not possible, inform Core
- EmitGesture( Gesture::Cancelled );
+ EmitGesture( GestureState::CANCELLED );
mTouchPositions.clear();
platformAbstraction.CancelTimer(mTimerId);
mTimerId = 0;
- mState = ( pointCount == 1 ) ? Clear : Failed; // Change state to Clear if only one point, Failed otherwise.
+ mState = ( pointCount == 1 ) ? CLEAR : FAILED; // Change state to CLEAR if only one point, FAILED otherwise.
endLoop = true;
break;
}
if (distanceSquared > ( MAXIMUM_MOTION_ALLOWED * MAXIMUM_MOTION_ALLOWED ) )
{
- // We have moved more than the allowable motion for a long press gesture. Inform Core and change state to Failed.
- EmitGesture( Gesture::Cancelled );
+ // We have moved more than the allowable motion for a long press gesture. Inform Core and change state to FAILED.
+ EmitGesture( GestureState::CANCELLED );
platformAbstraction.CancelTimer(mTimerId);
mTimerId = 0;
- mState = Failed;
+ mState = FAILED;
endLoop = true;
}
break;
break;
}
- // Failed/Finished: Monitor the touches, waiting for all touches to be released.
- case Failed:
- case Finished:
+ // FAILED/FINISHED: Monitor the touches, waiting for all touches to be released.
+ case FAILED:
+ case FINISHED:
{
// eventually the final touch point will be removed, marking the end of this gesture.
if ( pointCount == 1 )
if ( (primaryPointState == PointState::UP) || (primaryPointState == PointState::INTERRUPTED) )
{
- if(mState == Finished)
+ if(mState == FINISHED)
{
// When the last touch point is lifted, we should inform the Core that the Long press has finished.
- EmitGesture(Gesture::Finished);
+ EmitGesture(GestureState::FINISHED);
}
mTouchPositions.clear();
- mState = Clear; // Reset state to clear when last touch point is lifted.
+ mState = CLEAR; // Reset state to clear when last touch point is lifted.
}
}
break;
bool LongPressGestureRecognizer::TimerCallback()
{
- EmitGesture(Gesture::Started);
+ EmitGesture(GestureState::STARTED);
- mState = Finished;
+ mState = FINISHED;
mTimerId = 0;
return false;
}
-void LongPressGestureRecognizer::EmitGesture(Gesture::State state)
+void LongPressGestureRecognizer::EmitGesture(GestureState state)
{
unsigned int touchPoints ( static_cast<unsigned int>( mTouchPositions.size() ) );
- // We should tell Core about the Possible and Cancelled states regardless of whether we have satisfied long press requirements.
- if ( (state == Gesture::Possible) ||
- (state == Gesture::Cancelled) ||
+ // We should tell Core about the POSSIBLE and CANCELLED states regardless of whether we have satisfied long press requirements.
+ if ( (state == GestureState::POSSIBLE) ||
+ (state == GestureState::CANCELLED) ||
(touchPoints >= mMinimumTouchesRequired) )
{
LongPressGestureEvent longPress( state );
longPress.point /= static_cast<float>( touchPoints );
longPress.time = mTouchTime;
- if ( state != Gesture::Possible )
+ if ( state != GestureState::POSSIBLE )
{
longPress.time += mMinimumHoldingTime;
}
#define DALI_INTERNAL_LONG_PRESS_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.
/**
* When given a set of touch events, this detector attempts to determine if a long press gesture has taken place.
- * Emits a LongPressGestureEvent (state = Started) when a long press has been detected (Touch held down for more than duration).
- * Emits a further LongPressGestureEvent (state = Finished) when a long press has been completed (Touch Release).
+ * Emits a LongPressGestureEvent (state = GestureState::STARTED) when a long press has been detected (Touch held down for more than duration).
+ * Emits a further LongPressGestureEvent (state = GestureState::FINISHED) when a long press has been completed (Touch Release).
*/
class LongPressGestureRecognizer : public GestureRecognizer
{
* Emits the long press gesture if all conditions are applicable.
* @param[in] state The state of this gesture event.
*/
- void EmitGesture(Gesture::State state);
+ void EmitGesture( GestureState state );
private:
*/
enum State
{
- Clear, ///< No gesture detected.
- Touched, ///< User is touching the screen.
- Failed, ///< Gesture has failed.
- Finished ///< Gesture has been detected and sent.
+ CLEAR, ///< No gesture detected.
+ TOUCHED, ///< User is touching the screen.
+ FAILED, ///< Gesture has failed.
+ FINISHED ///< Gesture has been detected and sent.
};
State mState; ///< The current state of the detector.
/*
- * 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.
return allowed;
}
-void PanGestureDetector::EmitPanGestureSignal(Dali::Actor actor, const PanGesture& pan)
+void PanGestureDetector::EmitPanGestureSignal(Dali::Actor actor, const Dali::PanGesture& pan)
{
if ( !mDetectedSignal.Empty() )
{
return connected;
}
-void PanGestureDetector::SetPanGestureProperties( const PanGesture& pan )
+void PanGestureDetector::SetPanGestureProperties( const Dali::PanGesture& pan )
{
ThreadLocalStorage::Get().GetGestureEventProcessor().SetGestureProperties( pan );
}
PanGestureDetector::PanGestureDetector( const SceneGraph::PanGesture& sceneObject )
-: GestureDetector(Gesture::Pan, &sceneObject ),
+: GestureDetector( GestureType::PAN, &sceneObject ),
mMinimumTouches(1),
mMaximumTouches(1)
{
#define DALI_INTERNAL_PAN_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.
#include <dali/public-api/events/pan-gesture-detector.h>
#include <dali/public-api/math/vector2.h>
#include <dali/internal/event/events/gesture-detector-impl.h>
+#include <dali/public-api/events/pan-gesture.h>
namespace Dali
{
* @param[in] actor The panned actor.
* @param[in] pan The pan gesture.
*/
- void EmitPanGestureSignal(Dali::Actor actor, const PanGesture& pan);
+ void EmitPanGestureSignal(Dali::Actor actor, const Dali::PanGesture& pan);
public: // Signals
/**
* @copydoc Dali::PanGestureDetector::SetPanGestureProperties()
*/
- static void SetPanGestureProperties( const PanGesture& pan );
+ static void SetPanGestureProperties( const Dali::PanGesture& pan );
protected:
/*
- * 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.
{
-PanGestureEvent::PanGestureEvent(Gesture::State state)
-: GestureEvent(Gesture::Pan, state),
+PanGestureEvent::PanGestureEvent(GestureState state)
+: GestureEvent(GestureType::PAN, state),
timeDelta(0),
numberOfTouches(1)
{
* send it to the Core.
*
* A Pan Gesture event should be in one of five states:
- * - Possible: When the user first puts their finger down - Core needs to hit test the down point.
- * - Started: If a pan is detected.
- * - Continuing: If after a pan is detected, it continues.
- * - Finished: If after a pan, the user lifts their finger(s).
- * - Cancelled: If, after a down event, no pan is detected or a system interruption.
+ * - POSSIBLE: When the user first puts their finger down - Core needs to hit test the down point.
+ * - STARTED: If a pan is detected.
+ * - CONTINUING: If after a pan is detected, it continues.
+ * - FINISHED: If after a pan, the user lifts their finger(s).
+ * - CANCELLED: If, after a down event, no pan is detected or a system interruption.
*
- * A Started state will be ignored if a Possible state does not precede it.
- * Likewise, a Continuing or Finished state will be ignored if a Started state does not precede it.
+ * A STARTED state will be ignored if a POSSIBLE state does not precede it.
+ * Likewise, a CONTINUING or FINISHED state will be ignored if a STARTED state does not precede it.
*/
struct PanGestureEvent: public GestureEvent
{
* Default Constructor
* @param[in] state The state of the gesture
*/
- PanGestureEvent(Gesture::State state);
+ PanGestureEvent(GestureState state);
/**
* Virtual destructor
--- /dev/null
+#ifndef DALI_INTERNAL_PAN_GESTURE_H
+#define DALI_INTERNAL_PAN_GESTURE_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/events/pan-gesture.h>
+#include <dali/internal/event/events/gesture-impl.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+class PanGesture;
+typedef IntrusivePtr< PanGesture > PanGesturePtr;
+
+/**
+ * @copydoc Dali::PanGesture
+ */
+class PanGesture final : public Gesture
+{
+public:
+
+ /**
+ * @brief Default constructor
+ */
+ PanGesture(GestureState state)
+ : Gesture(GestureType::PAN, state)
+ {
+ }
+
+ PanGesture(const PanGesture&) = delete; ///< Deleted copy constructor
+ PanGesture(PanGesture&&) = delete; ///< Deleted move constructor
+ PanGesture& operator=(const PanGesture&) = delete; ///< Deleted copy assignment operator
+ PanGesture& operator=(PanGesture&&) = delete; ///< Deleted move assignment operator
+
+ /**
+ * @brief Set The velocity at which the user is moving their fingers.
+ * @param[in] velocity The Vector2 in local coordinates to set.
+ */
+ inline void SetVelocity(const Vector2& velocity)
+ {
+ mVelocity = velocity;
+ }
+
+ /**
+ * @copydoc Dali::PanGesture::GetVelocity()
+ */
+ inline const Vector2& GetVelocity() const
+ {
+ return mVelocity;
+ }
+
+ /**
+ * @brief Set This is a Vector2 showing how much the user has panned (dragged) since the last pan gesture or,
+ * if the gesture has just started, then the amount panned since the user touched the screen.
+ * @param[in] displacement The Vector2 in local coordinates to set.
+ */
+ inline void SetDisplacement(const Vector2& displacement)
+ {
+ mDisplacement = displacement;
+ }
+
+ /**
+ * @copydoc Dali::PanGesture::GetDisplacement()
+ */
+ inline const Vector2& GetDisplacement() const
+ {
+ return mDisplacement;
+ }
+
+ /**
+ * @brief Set This current touch position of the primary touch point in local actor coordinates.
+ * @param[in] velocity The current touch position to set.
+ */
+ inline void SetPosition(const Vector2& position)
+ {
+ mPosition = position;
+ }
+
+ /**
+ * @copydoc Dali::PanGesture::GetPosition()
+ */
+ inline const Vector2& GetPosition() const
+ {
+ return mPosition;
+ }
+
+ /**
+ * @brief Set The velocity at which the user is moving their fingers.
+ * @param[in] screenVelocity The Vector2 in screen coordinates to set.
+ */
+ inline void SetScreenVelocity(const Vector2& screenVelocity)
+ {
+ mScreenVelocity = screenVelocity;
+ }
+
+ /**
+ * @copydoc Dali::PanGesture::GetScreenVelocity()
+ */
+ inline const Vector2& GetScreenVelocity() const
+ {
+ return mScreenVelocity;
+ }
+
+ /**
+ * @brief Set This is a Vector2 showing how much the user has panned (dragged) since the last pan gesture or,
+ * if the gesture has just started, then the amount panned since the user touched the screen.
+ * @param[in] screenDisplacement The Vector2 in screen coordinates to set.
+ */
+ inline void SetScreenDisplacement(const Vector2& screenDisplacement)
+ {
+ mScreenDisplacement = screenDisplacement;
+ }
+
+ /**
+ * @copydoc Dali::PanGesture::GetScreenDisplacement()
+ */
+ inline const Vector2& GetScreenDisplacement() const
+ {
+ return mScreenDisplacement;
+ }
+
+ /**
+ * @brief Set This current touch position of the primary touch point in screen coordinates.
+ * @param[in] screenPosition The Vector2 in screen coordinates to set.
+ */
+ inline void SetScreenPosition(const Vector2& screenPosition)
+ {
+ mScreenPosition = screenPosition;
+ }
+
+ /**
+ * @copydoc Dali::PanGesture::GetScreenPosition()
+ */
+ inline const Vector2& GetScreenPosition() const
+ {
+ return mScreenPosition;
+ }
+
+ /**
+ * @brief The total number of fingers touching the screen in a pan gesture.
+ * @param[in] numberOfTouches The total number of fingers touching the screen to set.
+ */
+ inline void SetNumberOfTouches(uint32_t numberOfTouches)
+ {
+ mNumberOfTouches = numberOfTouches;
+ }
+
+ /**
+ * @brief The total number of fingers touching the screen in a pan gesture.
+ */
+ inline uint32_t GetNumberOfTouches() const
+ {
+ return mNumberOfTouches;
+ }
+
+ /**
+ * @copydoc Dali::PanGesture::GetSpeed()
+ */
+ inline float GetSpeed() const
+ {
+ return mVelocity.Length();
+ }
+
+ /**
+ * @copydoc Dali::PanGesture::GetDistance()
+ */
+ inline float GetDistance() const
+ {
+ return mDisplacement.Length();
+ }
+
+ /**
+ * @copydoc Dali::PanGesture::GetScreenSpeed()
+ */
+ inline float GetScreenSpeed() const
+ {
+ return mScreenVelocity.Length();
+ }
+
+ /**
+ * @copydoc Dali::PanGesture::GetScreenDistance()
+ */
+ inline float GetScreenDistance() const
+ {
+ return mScreenDisplacement.Length();
+ }
+
+private:
+
+ /**
+ * @brief Virtual destructor
+ *
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~PanGesture() = default;
+
+private:
+ Vector2 mVelocity;
+ Vector2 mDisplacement;
+ Vector2 mPosition;
+ Vector2 mScreenVelocity;
+ Vector2 mScreenDisplacement;
+ Vector2 mScreenPosition;
+ uint32_t mNumberOfTouches{1u};
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::PanGesture& GetImplementation( Dali::PanGesture& panGesture )
+{
+ DALI_ASSERT_ALWAYS( panGesture && "panGesture handle is empty" );
+
+ BaseObject& object = panGesture.GetBaseObject();
+
+ return static_cast< Internal::PanGesture& >( object );
+}
+
+inline const Internal::PanGesture& GetImplementation( const Dali::PanGesture& panGesture )
+{
+ DALI_ASSERT_ALWAYS( panGesture && "panGesture handle is empty" );
+
+ const BaseObject& object = panGesture.GetBaseObject();
+
+ return static_cast< const Internal::PanGesture& >( object );
+}
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_PAN_GESTURE_H
#include <dali/internal/update/gestures/scene-graph-pan-gesture.h>
#include <dali/internal/event/events/multi-point-event-util.h>
#include <dali/internal/event/events/pan-gesture/pan-gesture-recognizer.h>
+#include <dali/internal/event/events/pan-gesture/pan-gesture-impl.h>
#include <dali/internal/event/events/gesture-requests.h>
namespace Dali
const char * GESTURE_STATES[ 6 ] =
{
- "Clear",
- "Started",
- "Continuing",
- "Finished",
- "Cancelled",
- "Possible"
+ "CLEAR",
+ "STARTED",
+ "CONTINUING",
+ "FINISHED",
+ "CANCELLED",
+ "POSSIBLE"
};
#endif // defined(DEBUG_ENABLED)
} // unnamed namespace
PanGestureProcessor::PanGestureProcessor( SceneGraph::UpdateManager& updateManager )
-: GestureProcessor( Gesture::Pan ),
+: GestureProcessor( GestureType::PAN ),
mPanGestureDetectors(),
mCurrentPanEmitters(),
mCurrentRenderTask(),
DALI_LOG_INFO( gLogFilter, Debug::General, " Pan Event\n");
DALI_LOG_INFO( gLogFilter, Debug::General, " State: %s Touches: %d Time: %d TimeDelta: %d\n",
- GESTURE_STATES[panEvent.state], panEvent.numberOfTouches, panEvent.time, panEvent.timeDelta);
+ GESTURE_STATES[static_cast<uint8_t>(panEvent.state)], panEvent.numberOfTouches, panEvent.time, panEvent.timeDelta);
DALI_LOG_INFO( gLogFilter, Debug::General, " Positions: Current: (%.0f, %.0f), Previous: (%.0f, %.0f)\n",
panEvent.currentPosition.x, panEvent.currentPosition.y, panEvent.previousPosition.x, panEvent.previousPosition.y);
#endif
switch( panEvent.state )
{
- case Gesture::Possible:
+ case GestureState::POSSIBLE:
{
mCurrentPanEmitters.clear();
ResetActor();
break;
}
- case Gesture::Started:
+ case GestureState::STARTED:
{
// Requires a core update
mNeedsUpdate = true;
break;
}
- case Gesture::Continuing:
+ case GestureState::CONTINUING:
{
// Requires a core update
mNeedsUpdate = true;
DALI_FALLTHROUGH;
}
- case Gesture::Finished:
- case Gesture::Cancelled:
+ case GestureState::FINISHED:
+ case GestureState::CANCELLED:
{
// Only send subsequent pan gesture signals if we processed the pan gesture when it started.
// Check if actor is still touchable.
currentGesturedActor->ScreenToLocal( *mCurrentRenderTask.Get(), actorCoords.x, actorCoords.y, panEvent.currentPosition.x, panEvent.currentPosition.y );
// EmitPanSignal checks whether we have a valid actor and whether the container we are passing in has emitters before it emits the pan.
- EmitPanSignal( currentGesturedActor, outsideTouchesRangeEmitters, panEvent, actorCoords, Gesture::Finished, mCurrentRenderTask);
+ EmitPanSignal( currentGesturedActor, outsideTouchesRangeEmitters, panEvent, actorCoords, GestureState::FINISHED, mCurrentRenderTask);
EmitPanSignal( currentGesturedActor, mCurrentPanEmitters, panEvent, actorCoords, panEvent.state, mCurrentRenderTask);
}
}
// Clear current gesture detectors if pan gesture has ended or been cancelled.
- if ( ( panEvent.state == Gesture::Finished ) || ( panEvent.state == Gesture::Cancelled ) )
+ if ( ( panEvent.state == GestureState::FINISHED ) || ( panEvent.state == GestureState::CANCELLED ) )
{
mCurrentPanEmitters.clear();
ResetActor();
break;
}
- case Gesture::Clear:
+ case GestureState::CLEAR:
{
- DALI_ABORT( "Incorrect state received from Integration layer: Clear\n" );
+ DALI_ABORT( "Incorrect state received from Integration layer: CLEAR\n" );
break;
}
}
UpdateDetection();
}
-bool PanGestureProcessor::SetPanGestureProperties( const PanGesture& pan )
+bool PanGestureProcessor::SetPanGestureProperties( const Dali::PanGesture& pan )
{
// If we are currently processing a pan gesture then just ignore
if ( mCurrentPanEmitters.empty() && mSceneObject )
{
+ const PanGesture& panImpl( GetImplementation(pan) );
+
// We update the scene object directly rather than sending a message.
// Sending a message could cause unnecessary delays, the scene object ensure thread safe behaviour.
- mSceneObject->AddGesture( pan );
+ mSceneObject->AddGesture( panImpl );
- if( Gesture::Started == pan.state || Gesture::Continuing == pan.state )
+ if( GestureState::STARTED == panImpl.GetState() || GestureState::CONTINUING == panImpl.GetState() )
{
mNeedsUpdate = true;
}
const GestureDetectorContainer& gestureDetectors,
const PanGestureEvent& panEvent,
Vector2 localCurrent,
- Gesture::State state,
+ GestureState state,
RenderTaskPtr renderTask )
{
if ( actor && !gestureDetectors.empty() )
{
- PanGesture pan(state);
- pan.time = panEvent.time;
+ Internal::PanGesturePtr pan( new Internal::PanGesture(state ) );
+
+ pan->SetTime( panEvent.time );
- pan.numberOfTouches = panEvent.numberOfTouches;
- pan.screenPosition = panEvent.currentPosition;
- pan.position = localCurrent;
+ pan->SetNumberOfTouches( panEvent.numberOfTouches );
+ pan->SetScreenPosition( panEvent.currentPosition );
+ pan->SetPosition( localCurrent );
RenderTask& renderTaskImpl( *renderTask.Get() );
Vector2 localPrevious;
actor->ScreenToLocal( renderTaskImpl, localPrevious.x, localPrevious.y, panEvent.previousPosition.x, panEvent.previousPosition.y );
- pan.displacement = localCurrent - localPrevious;
+ pan->SetDisplacement( localCurrent - localPrevious );
Vector2 previousPos( panEvent.previousPosition );
- if ( state == Gesture::Started )
+ if ( state == GestureState::STARTED )
{
previousPos = mPossiblePanPosition;
}
- pan.screenDisplacement = panEvent.currentPosition - previousPos;
+ pan->SetScreenDisplacement( panEvent.currentPosition - previousPos );
// Avoid dividing by 0
if ( panEvent.timeDelta > 0 )
{
- pan.velocity.x = pan.displacement.x / static_cast<float>( panEvent.timeDelta );
- pan.velocity.y = pan.displacement.y / static_cast<float>( panEvent.timeDelta );
-
- pan.screenVelocity.x = pan.screenDisplacement.x / static_cast<float>( panEvent.timeDelta );
- pan.screenVelocity.y = pan.screenDisplacement.y / static_cast<float>( panEvent.timeDelta );
+ Vector2 velocity;
+ velocity.x = pan->GetDisplacement().x / static_cast<float>( panEvent.timeDelta );
+ velocity.y = pan->GetDisplacement().y / static_cast<float>( panEvent.timeDelta );
+ pan->SetVelocity( velocity );
+
+ Vector2 screenVelocity;
+ screenVelocity.x = pan->GetScreenDisplacement().x / static_cast<float>( panEvent.timeDelta );
+ screenVelocity.y = pan->GetScreenDisplacement().y / static_cast<float>( panEvent.timeDelta );
+ pan->SetScreenVelocity( screenVelocity );
}
// When the gesture ends, we may incorrectly get a ZERO velocity (as we have lifted our finger without any movement)
// so we should use the last recorded velocity instead in this scenario.
- if ( ( state == Gesture::Finished ) && ( pan.screenVelocity == Vector2::ZERO ) &&
+ if ( ( state == GestureState::FINISHED ) && ( pan->GetScreenVelocity() == Vector2::ZERO ) &&
( panEvent.timeDelta < MAXIMUM_TIME_WITH_VALID_LAST_VELOCITY ) )
{
- pan.velocity = mLastVelocity;
- pan.screenVelocity = mLastScreenVelocity;
+ pan->SetVelocity( mLastVelocity );
+ pan->SetScreenVelocity( mLastScreenVelocity );
}
else
{
// Store the current velocity for future iterations.
- mLastVelocity = pan.velocity;
- mLastScreenVelocity = pan.screenVelocity;
+ mLastVelocity = pan->GetVelocity();
+ mLastScreenVelocity = pan->GetScreenVelocity();
}
if ( mSceneObject )
{
// We update the scene object directly rather than sending a message.
// Sending a message could cause unnecessary delays, the scene object ensure thread safe behaviour.
- mSceneObject->AddGesture( pan );
+ mSceneObject->AddGesture( *pan.Get() );
}
Dali::Actor actorHandle( actor );
const GestureDetectorContainer::const_iterator endIter = gestureDetectors.end();
for ( GestureDetectorContainer::const_iterator iter = gestureDetectors.begin(); iter != endIter; ++iter )
{
- static_cast< PanGestureDetector* >( *iter )->EmitPanGestureSignal( actorHandle, pan );
+ static_cast< PanGestureDetector* >( *iter )->EmitPanGestureSignal( actorHandle, Dali::PanGesture( pan.Get() ) );
}
}
}
#define DALI_INTERNAL_EVENT_PAN_GESTURE_EVENT_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.
* @return true if Core::Update required
* @note If we are already processing a normal pan, then this call is ignored.
*/
- bool SetPanGestureProperties( const PanGesture& pan );
+ bool SetPanGestureProperties( const Dali::PanGesture& pan );
/**
* Called to provide pan-gesture profiling information.
const GestureDetectorContainer& gestureDetectors,
const PanGestureEvent& panEvent,
Vector2 localCurrent,
- Gesture::State state,
+ GestureState state,
RenderTaskPtr renderTask );
// GestureProcessor overrides
// EXTERNAL INCLUDES
#include <cmath>
-#include <dali/public-api/events/touch-point.h>
+#include <dali/devel-api/events/touch-point.h>
#include <dali/integration-api/events/touch-event-integ.h>
} // unnamed namespace
PanGestureRecognizer::PanGestureRecognizer( Observer& observer, Vector2 screenSize, const PanGestureRequest& request, int32_t minimumDistance, int32_t minimumPanEvents )
-: GestureRecognizer( screenSize, Gesture::Pan ),
+: GestureRecognizer( screenSize, GestureType::PAN ),
mObserver( observer ),
- mState( Clear ),
+ mState( CLEAR ),
mThresholdAdjustmentsRemaining( 0 ),
mThresholdTotalAdjustments( static_cast<unsigned int>( MINIMUM_MOTION_DISTANCE_BEFORE_PAN * MINIMUM_MOTION_DISTANCE_TO_THRESHOLD_ADJUSTMENTS_RATIO ) ),
mPrimaryTouchDownTime( 0 ),
if (primaryPointState == PointState::INTERRUPTED)
{
- if ( ( mState == Started ) || ( mState == Possible ) )
+ if ( ( mState == STARTED ) || ( mState == POSSIBLE ) )
{
// If our pan had started and we are interrupted, then tell Core that pan is cancelled.
mTouchEvents.push_back(event);
- SendPan(Gesture::Cancelled, event);
+ SendPan(GestureState::CANCELLED, event);
}
- mState = Clear; // We should change our state to Clear.
+ mState = CLEAR; // We should change our state to CLEAR.
mTouchEvents.clear();
}
else
{
switch (mState)
{
- case Clear:
+ case CLEAR:
{
if ( ( primaryPointState == PointState::DOWN ) || ( primaryPointState == PointState::STATIONARY ) || ( primaryPointState == PointState::MOTION ))
{
if (event.GetPointCount() == mMinimumTouchesRequired)
{
// We have satisfied the minimum touches required for a pan, tell core that a gesture may be possible and change our state accordingly.
- mState = Possible;
- SendPan(Gesture::Possible, event);
+ mState = POSSIBLE;
+ SendPan(GestureState::POSSIBLE, event);
}
mTouchEvents.push_back(event);
break;
}
- case Possible:
+ case POSSIBLE:
{
unsigned int pointCount(event.GetPointCount());
if ( (pointCount >= mMinimumTouchesRequired)&&(pointCount <= mMaximumTouchesRequired) )
( delta.LengthSquared() >= static_cast<float>( mMinimumDistanceSquared ) ) )
{
// If the touch point(s) have moved enough distance to be considered a pan, then tell Core that the pan gesture has started and change our state accordingly.
- mState = Started;
- SendPan(Gesture::Started, event);
+ mState = STARTED;
+ SendPan(GestureState::STARTED, event);
}
}
else if (primaryPointState == PointState::UP)
Vector2 delta(event.points[0].GetScreenPosition() - mPrimaryTouchDownLocation);
if (delta.LengthSquared() >= static_cast<float>( mMinimumDistanceSquared ) )
{
- SendPan(Gesture::Started, event);
+ SendPan(GestureState::STARTED, event);
mTouchEvents.push_back(event);
- SendPan(Gesture::Finished, event);
+ SendPan(GestureState::FINISHED, event);
}
else
{
- // If we have lifted the primary touch point then tell core the pan is cancelled and change our state to Clear.
- SendPan(Gesture::Cancelled, event);
+ // If we have lifted the primary touch point then tell core the pan is cancelled and change our state to CLEAR.
+ SendPan(GestureState::CANCELLED, event);
}
- mState = Clear;
+ mState = CLEAR;
mTouchEvents.clear();
}
}
else
{
// We do not satisfy pan conditions, tell Core our Gesture has been cancelled.
- SendPan(Gesture::Cancelled, event);
+ SendPan(GestureState::CANCELLED, event);
if (pointCount == 1 && primaryPointState == PointState::UP)
{
- // If we have lifted the primary touch point, then change our state to Clear...
- mState = Clear;
+ // If we have lifted the primary touch point, then change our state to CLEAR...
+ mState = CLEAR;
mTouchEvents.clear();
}
else
{
- // ...otherwise change it to Failed.
- mState = Failed;
+ // ...otherwise change it to FAILED.
+ mState = FAILED;
}
}
break;
}
- case Started:
+ case STARTED:
{
mTouchEvents.push_back(event);
{
case PointState::MOTION:
// Pan is continuing, tell Core.
- SendPan(Gesture::Continuing, event);
+ SendPan(GestureState::CONTINUING, event);
break;
case PointState::UP:
- // Pan is finally finished when our primary point is lifted, tell Core and change our state to Clear.
- mState = Clear;
- SendPan(Gesture::Finished, event);
+ // Pan is finally finished when our primary point is lifted, tell Core and change our state to CLEAR.
+ mState = CLEAR;
+ SendPan(GestureState::FINISHED, event);
mTouchEvents.clear();
break;
{
if(iter->GetState() == PointState::UP)
{
- // The number of touch points will be less than the minimum required. Inform core and change our state to Finished.
- SendPan(Gesture::Finished, event);
- mState = Finished;
+ // The number of touch points will be less than the minimum required. Inform core and change our state to FINISHED.
+ SendPan(GestureState::FINISHED, event);
+ mState = FINISHED;
break;
}
}
else
{
// We have gone outside of the pan requirements, inform Core that the gesture is finished.
- SendPan(Gesture::Finished, event);
+ SendPan(GestureState::FINISHED, event);
if (pointCount == 1 && primaryPointState == PointState::UP)
{
- // If this was the primary point being released, then we change our state back to Clear...
- mState = Clear;
+ // If this was the primary point being released, then we change our state back to CLEAR...
+ mState = CLEAR;
mTouchEvents.clear();
}
else
{
- // ...otherwise we change it to Finished.
- mState = Finished;
+ // ...otherwise we change it to FINISHED.
+ mState = FINISHED;
}
}
break;
}
- case Finished:
- case Failed:
+ case FINISHED:
+ case FAILED:
{
if (primaryPointState == PointState::UP)
{
// Change our state back to clear when the primary touch point is released.
- mState = Clear;
+ mState = CLEAR;
mTouchEvents.clear();
}
break;
mMaximumTouchesRequired = pan.maxTouches;
}
-void PanGestureRecognizer::SendPan(Gesture::State state, const Integration::TouchEvent& currentEvent)
+void PanGestureRecognizer::SendPan(GestureState state, const Integration::TouchEvent& currentEvent)
{
PanGestureEvent gesture(state);
gesture.currentPosition = currentEvent.points[0].GetScreenPosition();
uint32_t previousTime( previousEvent.time );
// If we've just started then we want to remove the threshold from Core calculations.
- if ( state == Gesture::Started )
+ if ( state == GestureState::STARTED )
{
previousPosition = mPrimaryTouchDownLocation;
previousTime = mPrimaryTouchDownTime;
#define DALI_INTERNAL_EVENT_PAN_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.
* @param[in] state The state of the pan.
* @param[in] currentEvent The latest touch event.
*/
- void SendPan(Gesture::State state, const Integration::TouchEvent& currentEvent);
+ void SendPan(GestureState state, const Integration::TouchEvent& currentEvent);
private:
*/
enum State
{
- Clear, ///< No gesture detected.
- Possible, ///< The current touch event data suggests that a gesture is possible.
- Started, ///< A gesture has been detected.
- Finished, ///< A previously started pan gesture has finished.
- Failed, ///< Current touch event data suggests a pan gesture is not possible.
+ CLEAR, ///< No gesture detected.
+ POSSIBLE, ///< The current touch event data suggests that a gesture is possible.
+ STARTED, ///< A gesture has been detected.
+ FINISHED, ///< A previously started pan gesture has finished.
+ FAILED, ///< Current touch event data suggests a pan gesture is not possible.
};
State mState; ///< The current state of the detector.
/*
- * 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.
}
PinchGestureDetector::PinchGestureDetector()
-: GestureDetector(Gesture::Pinch)
+: GestureDetector(GestureType::PINCH)
{
}
{
}
-void PinchGestureDetector::EmitPinchGestureSignal(Dali::Actor actor, const PinchGesture& pinch)
+void PinchGestureDetector::EmitPinchGestureSignal(Dali::Actor actor, const Dali::PinchGesture& pinch)
{
// Guard against destruction during signal emission
Dali::PinchGestureDetector handle( this );
#define DALI_INTERNAL_PINCH_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.
// INTERNAL INCLUDES
#include <dali/public-api/events/pinch-gesture-detector.h>
+#include <dali/public-api/events/pinch-gesture.h>
#include <dali/internal/event/events/gesture-detector-impl.h>
namespace Dali
{
-struct PinchGesture;
-
namespace Internal
{
* @param[in] actor The pinched actor.
* @param[in] pinch The pinch gesture.
*/
- void EmitPinchGestureSignal(Dali::Actor actor, const PinchGesture& pinch);
+ void EmitPinchGestureSignal(Dali::Actor actor, const Dali::PinchGesture& pinch);
public: // Signals
/*
- * 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.
namespace Internal
{
-PinchGestureEvent::PinchGestureEvent(Gesture::State state)
-: GestureEvent(Gesture::Pinch, state),
+PinchGestureEvent::PinchGestureEvent(GestureState state)
+: GestureEvent(GestureType::PINCH, state),
scale(0.0f),
speed(0.0f),
centerPoint()
#define DALI_INTERNAL_EVENT_PINCH_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.
* send it to the Core.
*
* A Pinch Gesture event should be in one of four states:
- * - Started: If a pinch is detected.
- * - Continuing: If after a pinch is detected, it continues.
- * - Finished: If after a pinch, the user lifts their finger(s).
- * - Cancelled: If there is a system interruption.
+ * - STARTED: If a pinch is detected.
+ * - CONTINUING: If after a pinch is detected, it continues.
+ * - FINISHED: If after a pinch, the user lifts their finger(s).
+ * - CANCELLED: If there is a system interruption.
*/
struct PinchGestureEvent : public GestureEvent
{
* Default Constructor
* @param[in] state The state of the gesture
*/
- PinchGestureEvent(Gesture::State state);
+ PinchGestureEvent(GestureState state);
/**
* Virtual destructor
--- /dev/null
+#ifndef DALI_INTERNAL_PINCH_GESTURE_H
+#define DALI_INTERNAL_PINCH_GESTURE_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/events/pinch-gesture.h>
+#include <dali/internal/event/events/gesture-impl.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+class PinchGesture;
+typedef IntrusivePtr< PinchGesture > PinchGesturePtr;
+
+/**
+ * @copydoc Dali::PinchGesture
+ */
+class PinchGesture final : public Gesture
+{
+public:
+
+ /**
+ * @brief Default constructor
+ */
+ PinchGesture( GestureState state )
+ : Gesture(GestureType::PINCH, state)
+ {
+ }
+
+ PinchGesture(const PinchGesture&) = delete; ///< Deleted copy constructor
+ PinchGesture(PinchGesture&&) = delete; ///< Deleted move constructor
+ PinchGesture& operator=(const PinchGesture&) = delete; ///< Deleted copy assignment operator
+ PinchGesture& operator=(PinchGesture&&) = delete; ///< Deleted move assignment operator
+
+ /**
+ * @brief The scale factor from the start of the pinch gesture till the latest pinch gesture.
+ * @param[in] scale The scale to set.
+ */
+ inline void SetScale( float scale )
+ {
+ mScale = scale;
+ }
+
+ /**
+ * @copydoc Dali::PinchGesture::GetScale()
+ */
+ inline float GetScale() const
+ {
+ return mScale;
+ }
+
+ /**
+ * @brief The speed at which the user is moving their fingers.
+ * @param[in] speed The speed to set.
+ */
+ inline void SetSpeed( float speed )
+ {
+ mSpeed = speed;
+ }
+
+ /**
+ * @copydoc Dali::PinchGesture::GetSpeed()
+ */
+ inline float GetSpeed() const
+ {
+ return mSpeed;
+ }
+
+ /**
+ * @brief The center point of the two points that caused the pinch gesture in screen coordinates.
+ * @param[in] screenCenterPoint The point in screen coordinates to set.
+ */
+ inline void SetScreenCenterPoint( const Vector2& screenCenterPoint )
+ {
+ mScreenCenterPoint = screenCenterPoint;
+ }
+
+ /**
+ * @copydoc Dali::PinchGesture::GetScreenCenterPoint()
+ */
+ inline const Vector2& GetScreenCenterPoint() const
+ {
+ return mScreenCenterPoint;
+ }
+
+ /**
+ * @brief The center point of the two points that caused the pinch gesture in local actor coordinates.
+ * @param[in] localCenterPoint The point in local actor coordinates to set.
+ */
+ inline void SetLocalCenterPoint( const Vector2& localCenterPoint )
+ {
+ mLocalCenterPoint = localCenterPoint;
+ }
+
+ /**
+ * @copydoc Dali::PinchGesture::GetLocalCenterPoint()
+ */
+ inline const Vector2& GetLocalCenterPoint() const
+ {
+ return mLocalCenterPoint;
+ }
+
+private:
+
+ /**
+ * @brief Virtual destructor
+ *
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~PinchGesture() = default;
+
+private:
+ Vector2 mScreenCenterPoint;
+ Vector2 mLocalCenterPoint;
+ float mScale{0.0f};
+ float mSpeed{0.0f};
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::PinchGesture& GetImplementation( Dali::PinchGesture& pinchGesture )
+{
+ DALI_ASSERT_ALWAYS( pinchGesture && "pinchGesture handle is empty" );
+
+ BaseObject& object = pinchGesture.GetBaseObject();
+
+ return static_cast< Internal::PinchGesture& >( object );
+}
+
+inline const Internal::PinchGesture& GetImplementation( const Dali::PinchGesture& pinchGesture )
+{
+ DALI_ASSERT_ALWAYS( pinchGesture && "pinchGesture handle is empty" );
+
+ const BaseObject& object = pinchGesture.GetBaseObject();
+
+ return static_cast< const Internal::PinchGesture& >( object );
+}
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_PINCH_GESTURE_H
#include <dali/internal/event/common/scene-impl.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
#include <dali/internal/event/events/pinch-gesture/pinch-gesture-recognizer.h>
+#include <dali/internal/event/events/pinch-gesture/pinch-gesture-impl.h>
#include <dali/internal/event/events/gesture-requests.h>
namespace Dali
const PinchGestureEvent& pinchEvent,
Vector2 localCenter)
{
- PinchGesture pinch(pinchEvent.state);
- pinch.time = pinchEvent.time;
+ Internal::PinchGesturePtr pinch( new Internal::PinchGesture(pinchEvent.state ) );
+ pinch->SetTime( pinchEvent.time );
- pinch.scale = pinchEvent.scale;
- pinch.speed = pinchEvent.speed;
- pinch.screenCenterPoint = pinchEvent.centerPoint;
+ pinch->SetScale( pinchEvent.scale );
+ pinch->SetSpeed( pinchEvent.speed );
+ pinch->SetScreenCenterPoint( pinchEvent.centerPoint );
- pinch.localCenterPoint = localCenter;
+ pinch->SetLocalCenterPoint( localCenter );
Dali::Actor actorHandle( actor );
const GestureDetectorContainer::const_iterator endIter = gestureDetectors.end();
for ( GestureDetectorContainer::const_iterator iter = gestureDetectors.begin(); iter != endIter; ++iter )
{
- static_cast< PinchGestureDetector* >( *iter )->EmitPinchGestureSignal( actorHandle, pinch );
+ static_cast< PinchGestureDetector* >( *iter )->EmitPinchGestureSignal( actorHandle, Dali::PinchGesture( pinch.Get() ) );
}
}
} // unnamed namespace
PinchGestureProcessor::PinchGestureProcessor()
-: GestureProcessor( Gesture::Pinch ),
+: GestureProcessor( GestureType::PINCH ),
mPinchGestureDetectors(),
mCurrentPinchEmitters(),
mCurrentPinchEvent(NULL),
{
switch ( pinchEvent.state )
{
- case Gesture::Started:
+ case GestureState::STARTED:
{
// The pinch gesture should only be sent to the gesture detector which first received it so that
// it can be told when the gesture ends as well.
break;
}
- case Gesture::Continuing:
- case Gesture::Finished:
- case Gesture::Cancelled:
+ case GestureState::CONTINUING:
+ case GestureState::FINISHED:
+ case GestureState::CANCELLED:
{
// Only send subsequent pinch gesture signals if we processed the pinch gesture when it started.
// Check if actor is still touchable.
}
// Clear current emitters if pinch gesture has ended or been cancelled.
- if ( pinchEvent.state == Gesture::Finished || pinchEvent.state == Gesture::Cancelled )
+ if ( pinchEvent.state == GestureState::FINISHED || pinchEvent.state == GestureState::CANCELLED )
{
mCurrentPinchEmitters.clear();
ResetActor();
break;
}
- case Gesture::Clear:
+ case GestureState::CLEAR:
{
- DALI_ABORT( "Incorrect state received from Integration layer: Clear\n" );
+ DALI_ABORT( "Incorrect state received from Integration layer: CLEAR\n" );
break;
}
- case Gesture::Possible:
+ case GestureState::POSSIBLE:
{
- DALI_ABORT( "Incorrect state received from Integration layer: Possible\n" );
+ DALI_ABORT( "Incorrect state received from Integration layer: POSSIBLE\n" );
break;
}
}
// EXTERNAL INCLUDES
#include <cmath>
-#include <dali/public-api/events/touch-point.h>
+#include <dali/devel-api/events/touch-point.h>
#include <dali/public-api/math/vector2.h>
#include <dali/internal/event/events/pinch-gesture/pinch-gesture-event.h>
} // unnamed namespace
PinchGestureRecognizer::PinchGestureRecognizer( Observer& observer, Vector2 screenSize, Vector2 screenDpi, float minimumPinchDistance, uint32_t minimumTouchEvents, uint32_t minimumTouchEventsAfterStart )
-: GestureRecognizer( screenSize, Gesture::Pinch ),
+: GestureRecognizer( screenSize, GestureType::PINCH ),
mObserver( observer ),
- mState( Clear ),
+ mState( CLEAR ),
mTouchEvents(),
mDefaultMinimumDistanceDelta( GetDefaultMinimumPinchDistance( screenDpi ) ),
mStartingDistance( 0.0f ),
switch (mState)
{
- case Clear:
+ case CLEAR:
{
if (pointCount == 2)
{
// Change state to possible as we have two touch points.
- mState = Possible;
+ mState = POSSIBLE;
mTouchEvents.push_back(event);
}
break;
}
- case Possible:
+ case POSSIBLE:
{
if (pointCount != 2)
{
- // We no longer have two touch points so change state back to Clear.
- mState = Clear;
+ // We no longer have two touch points so change state back to CLEAR.
+ mState = CLEAR;
mTouchEvents.clear();
}
else
if (currentPoint1.GetState() == PointState::UP || currentPoint2.GetState() == PointState::UP || currentPoint1.GetState() == PointState::INTERRUPTED)
{
- // One of our touch points has an Up event so change our state back to Clear.
- mState = Clear;
+ // One of our touch points has an Up event so change our state back to CLEAR.
+ mState = CLEAR;
mTouchEvents.clear();
}
else
mStartingDistance = GetDistance(mTouchEvents.begin()->points[0], mTouchEvents.begin()->points[1]);
// Send pinch started
- SendPinch(Gesture::Started, event);
+ SendPinch(GestureState::STARTED, event);
- mState = Started;
+ mState = STARTED;
}
mTouchEvents.clear();
}
- if (mState == Possible)
+ if (mState == POSSIBLE)
{
// No pinch, so restart detection
- mState = Clear;
+ mState = CLEAR;
mTouchEvents.clear();
}
}
break;
}
- case Started:
+ case STARTED:
{
if(event.points[0].GetState() == PointState::INTERRUPTED)
{
// System interruption occurred, pinch should be cancelled
mTouchEvents.clear();
- SendPinch(Gesture::Cancelled, event);
- mState = Clear;
+ SendPinch(GestureState::CANCELLED, event);
+ mState = CLEAR;
mTouchEvents.clear();
}
else if (pointCount != 2)
{
// Send pinch finished event
- SendPinch(Gesture::Finished, event);
+ SendPinch(GestureState::FINISHED, event);
- mState = Clear;
+ mState = CLEAR;
mTouchEvents.clear();
}
else
{
mTouchEvents.push_back(event);
// Send pinch finished event
- SendPinch(Gesture::Finished, event);
+ SendPinch(GestureState::FINISHED, event);
- mState = Clear;
+ mState = CLEAR;
mTouchEvents.clear();
}
else
if( mTouchEvents.size() >= mMinimumTouchEventsAfterStart )
{
// Send pinch continuing
- SendPinch(Gesture::Continuing, event);
+ SendPinch(GestureState::CONTINUING, event);
mTouchEvents.clear();
}
// Nothing to do.
}
-void PinchGestureRecognizer::SendPinch(Gesture::State state, const Integration::TouchEvent& currentEvent)
+void PinchGestureRecognizer::SendPinch(GestureState state, const Integration::TouchEvent& currentEvent)
{
PinchGestureEvent gesture(state);
else
{
// Something has gone wrong, just cancel the gesture.
- gesture.state = Gesture::Cancelled;
+ gesture.state = GestureState::CANCELLED;
}
gesture.time = currentEvent.time;
#define DALI_INTERNAL_EVENT_PINCH_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.
* @param[in] state The state of the pinch (whether it's starting, continuing or finished).
* @param[in] currentEvent The latest touch event.
*/
- void SendPinch(Gesture::State state, const Integration::TouchEvent& currentEvent);
+ void SendPinch(GestureState state, const Integration::TouchEvent& currentEvent);
private:
*/
enum State
{
- Clear, ///< No gesture detected.
- Possible, ///< The current touch event data suggests that a gesture is possible.
- Started, ///< A gesture has been detected.
+ CLEAR, ///< No gesture detected.
+ POSSIBLE, ///< The current touch event data suggests that a gesture is possible.
+ STARTED, ///< A gesture has been detected.
};
State mState; ///< The current state of the detector.
}
RotationGestureDetector::RotationGestureDetector()
-: GestureDetector( Gesture::Rotation )
+: GestureDetector( GestureType::ROTATION )
{
}
-void RotationGestureDetector::EmitRotationGestureSignal( Dali::Actor actor, const RotationGesture& rotation )
+void RotationGestureDetector::EmitRotationGestureSignal( Dali::Actor actor, const Dali::RotationGesture& rotation )
{
// Guard against destruction during signal emission
Dali::RotationGestureDetector handle( this );
// INTERNAL INCLUDES
#include <dali/public-api/events/rotation-gesture-detector.h>
+#include <dali/public-api/events/rotation-gesture.h>
#include <dali/internal/event/events/gesture-detector-impl.h>
namespace Dali
{
-struct RotationGesture;
-
namespace Internal
{
* @param[in] actor The rotated actor
* @param[in] rotation The rotation gesture
*/
- void EmitRotationGestureSignal( Dali::Actor actor, const RotationGesture& rotation );
+ void EmitRotationGestureSignal( Dali::Actor actor, const Dali::RotationGesture& rotation );
public: // Signals
/**
* When a rotation gesture is detected, this structure holds information regarding the gesture.
*
- * A Rotation Gesture event should be in one of four states:
- * - Started: If a rotation is detected.
- * - Continuing: If after a rotation is detected, it continues.
- * - Finished: If after a rotation, the user lifts their finger(s).
- * - Cancelled: If there is a system interruption.
+ * A ROTATION Gesture event should be in one of four states:
+ * - STARTED: If a rotation is detected.
+ * - CONTINUING: If after a rotation is detected, it continues.
+ * - FINISHED: If after a rotation, the user lifts their finger(s).
+ * - CANCELLED: If there is a system interruption.
*/
struct RotationGestureEvent : public GestureEvent
{
* Default Constructor
* @param[in] state The state of the gesture
*/
- RotationGestureEvent( Gesture::State state )
- : GestureEvent( Gesture::Rotation, state )
+ RotationGestureEvent( GestureState state )
+ : GestureEvent( GestureType::ROTATION, state )
{
}
--- /dev/null
+#ifndef DALI_INTERNAL_ROTATION_GESTURE_H
+#define DALI_INTERNAL_ROTATION_GESTURE_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/events/rotation-gesture.h>
+#include <dali/internal/event/events/gesture-impl.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+class RotationGesture;
+typedef IntrusivePtr< RotationGesture > RotationGesturePtr;
+
+/**
+ * @copydoc Dali::RotationGesture
+ */
+class RotationGesture final : public Gesture
+{
+public:
+
+ /**
+ * @brief Default constructor
+ */
+ RotationGesture( GestureState state )
+ : Gesture( GestureType::ROTATION, state )
+ {
+ }
+
+ RotationGesture(const RotationGesture&) = delete; ///< Deleted copy constructor
+ RotationGesture(RotationGesture&&) = delete; ///< Deleted move constructor
+ RotationGesture& operator=(const RotationGesture&) = delete; ///< Deleted copy assignment operator
+ RotationGesture& operator=(RotationGesture&&) = delete; ///< Deleted move assignment operator
+
+ /**
+ * @brief The overall rotation from the start of the rotation gesture till the latest rotation gesture.
+ * @param[in] rotation The rotation to set.
+ */
+ inline void SetRotation( const Radian& rotation )
+ {
+ mRotation = rotation;
+ }
+
+ /**
+ * @copydoc Dali::RotationGesture::GetRotation()
+ */
+ inline const Radian& GetRotation() const
+ {
+ return mRotation;
+ }
+
+ /**
+ * @brief The center point of the two points that caused the rotation gesture in screen coordinates.
+ * @param[in] screenCenterPoint The point in screen coordinates to set.
+ */
+ inline void SetScreenCenterPoint( const Vector2& screenCenterPoint )
+ {
+ mScreenCenterPoint = screenCenterPoint;
+ }
+
+ /**
+ * @copydoc Dali::RotationGesture::GetScreenCenterPoint()
+ */
+ inline const Vector2& GetScreenCenterPoint() const
+ {
+ return mScreenCenterPoint;
+ }
+
+ /**
+ * @brief The center point of the two points that caused the rotation gesture in local actor coordinates.
+ * @param[in] localCenterPoint The point in local actor coordinates to set.
+ */
+ inline void SetLocalCenterPoint( const Vector2& localCenterPoint )
+ {
+ mLocalCenterPoint = localCenterPoint;
+ }
+
+ /**
+ * @copydoc Dali::RotationGesture::GetLocalCenterPoint()
+ */
+ inline const Vector2& GetLocalCenterPoint() const
+ {
+ return mLocalCenterPoint;
+ }
+
+private:
+
+ /**
+ * @brief Virtual destructor
+ *
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~RotationGesture() = default;
+
+private:
+ Radian mRotation;
+ Vector2 mScreenCenterPoint;
+ Vector2 mLocalCenterPoint;
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::RotationGesture& GetImplementation( Dali::RotationGesture& rotationGesture )
+{
+ DALI_ASSERT_ALWAYS( rotationGesture && "rotationGesture handle is empty" );
+
+ BaseObject& object = rotationGesture.GetBaseObject();
+
+ return static_cast< Internal::RotationGesture& >( object );
+}
+
+inline const Internal::RotationGesture& GetImplementation( const Dali::RotationGesture& rotationGesture )
+{
+ DALI_ASSERT_ALWAYS( rotationGesture && "rotationGesture handle is empty" );
+
+ const BaseObject& object = rotationGesture.GetBaseObject();
+
+ return static_cast< const Internal::RotationGesture& >( object );
+}
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_ROTATION_GESTURE_H
#include <dali/internal/event/render-tasks/render-task-impl.h>
#include <dali/internal/event/events/rotation-gesture/rotation-gesture-recognizer.h>
#include <dali/internal/event/events/gesture-requests.h>
+#include <dali/internal/event/events/rotation-gesture/rotation-gesture-impl.h>
namespace Dali
{
const RotationGestureEvent& rotationEvent,
Vector2 localCenter)
{
- RotationGesture rotation(rotationEvent.state);
- rotation.time = rotationEvent.time;
- rotation.rotation = rotationEvent.rotation;
- rotation.screenCenterPoint = rotationEvent.centerPoint;
- rotation.localCenterPoint = localCenter;
+ Internal::RotationGesturePtr rotation( new Internal::RotationGesture(rotationEvent.state ) );
+ rotation->SetTime( rotationEvent.time );
+ rotation->SetRotation( rotationEvent.rotation );
+ rotation->SetScreenCenterPoint( rotationEvent.centerPoint );
+ rotation->SetLocalCenterPoint( localCenter );
Dali::Actor actorHandle( actor );
const GestureDetectorContainer::const_iterator endIter = gestureDetectors.end();
for ( GestureDetectorContainer::const_iterator iter = gestureDetectors.begin(); iter != endIter; ++iter )
{
- static_cast< RotationGestureDetector* >( *iter )->EmitRotationGestureSignal( actorHandle, rotation );
+ static_cast< RotationGestureDetector* >( *iter )->EmitRotationGestureSignal( actorHandle, Dali::RotationGesture( rotation.Get() ) );
}
}
} // unnamed namespace
RotationGestureProcessor::RotationGestureProcessor()
-: GestureProcessor( Gesture::Rotation ),
+: GestureProcessor( GestureType::ROTATION ),
mRotationGestureDetectors(),
mCurrentRotationEmitters(),
mCurrentRotationEvent( nullptr ),
{
switch ( rotationEvent.state )
{
- case Gesture::Started:
+ case GestureState::STARTED:
{
// The rotation gesture should only be sent to the gesture detector which first received it so that
// it can be told when the gesture ends as well.
break;
}
- case Gesture::Continuing:
- case Gesture::Finished:
- case Gesture::Cancelled:
+ case GestureState::CONTINUING:
+ case GestureState::FINISHED:
+ case GestureState::CANCELLED:
{
// Only send subsequent rotation gesture signals if we processed the rotation gesture when it started.
// Check if actor is still touchable.
}
// Clear current emitters if rotation gesture has ended or been cancelled.
- if ( rotationEvent.state == Gesture::Finished || rotationEvent.state == Gesture::Cancelled )
+ if ( rotationEvent.state == GestureState::FINISHED || rotationEvent.state == GestureState::CANCELLED )
{
mCurrentRotationEmitters.clear();
ResetActor();
break;
}
- case Gesture::Clear:
- case Gesture::Possible:
+ case GestureState::CLEAR:
+ case GestureState::POSSIBLE:
{
// Nothing to do
break;
#include <cmath>
// INTERNAL INCLUDES
-#include <dali/public-api/events/touch-point.h>
+#include <dali/devel-api/events/touch-point.h>
#include <dali/public-api/math/vector2.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/internal/event/events/rotation-gesture/rotation-gesture-event.h>
} // unnamed namespace
RotationGestureRecognizer::RotationGestureRecognizer( Observer& observer, uint32_t minimumTouchEvents, uint32_t minimumTouchEventsAfterStart )
-: GestureRecognizer( Gesture::Rotation ),
+: GestureRecognizer( GestureType::ROTATION ),
mObserver( observer ),
- mState( Clear ),
+ mState( CLEAR ),
mTouchEvents(),
mStartingAngle( 0.0f ),
mMinimumTouchEvents( minimumTouchEvents ),
switch( mState )
{
- case Clear:
+ case CLEAR:
{
if( pointCount == 2 )
{
// Change state to possible as we have two touch points.
- mState = Possible;
+ mState = POSSIBLE;
mTouchEvents.push_back( event );
}
break;
}
- case Possible:
+ case POSSIBLE:
{
if ( pointCount != 2 )
{
- // We no longer have two touch points so change state back to Clear.
- mState = Clear;
+ // We no longer have two touch points so change state back to CLEAR.
+ mState = CLEAR;
mTouchEvents.clear();
}
else
if( currentPoint1.GetState() == PointState::UP || currentPoint2.GetState() == PointState::UP || currentPoint1.GetState() == PointState::INTERRUPTED )
{
- // One of our touch points has an Up event so change our state back to Clear.
- mState = Clear;
+ // One of our touch points has an Up event so change our state back to CLEAR.
+ mState = CLEAR;
mTouchEvents.clear();
}
else
mStartingAngle = GetAngle( mTouchEvents.begin()->points[0], mTouchEvents.begin()->points[1] );
// Send rotation started
- SendRotation( Gesture::Started, event );
+ SendRotation( GestureState::STARTED, event );
- mState = Started;
+ mState = STARTED;
}
mTouchEvents.clear();
- if( mState == Possible )
+ if( mState == POSSIBLE )
{
// No rotation, so restart detection
- mState = Clear;
+ mState = CLEAR;
mTouchEvents.clear();
}
}
break;
}
- case Started:
+ case STARTED:
{
if(event.points[0].GetState() == PointState::INTERRUPTED)
{
// System interruption occurred, rotation should be cancelled
mTouchEvents.clear();
- SendRotation(Gesture::Cancelled, event);
- mState = Clear;
+ SendRotation(GestureState::CANCELLED, event);
+ mState = CLEAR;
mTouchEvents.clear();
}
else if( pointCount != 2 )
{
// Send rotation finished event
- SendRotation( Gesture::Finished, event );
+ SendRotation( GestureState::FINISHED, event );
- mState = Clear;
+ mState = CLEAR;
mTouchEvents.clear();
}
else
{
mTouchEvents.push_back( event );
// Send rotation finished event
- SendRotation( Gesture::Finished, event );
+ SendRotation( GestureState::FINISHED, event );
- mState = Clear;
+ mState = CLEAR;
mTouchEvents.clear();
}
else
if( mTouchEvents.size() >= mMinimumTouchEventsAfterStart )
{
// Send rotation continuing
- SendRotation( Gesture::Continuing, event );
+ SendRotation( GestureState::CONTINUING, event );
mTouchEvents.clear();
}
mMinimumTouchEventsAfterStart = value;
}
-void RotationGestureRecognizer::SendRotation( Gesture::State state, const Integration::TouchEvent& currentEvent )
+void RotationGestureRecognizer::SendRotation( GestureState state, const Integration::TouchEvent& currentEvent )
{
RotationGestureEvent gesture( state );
-
if( !mTouchEvents.empty() )
{
// Assert if we have been holding TouchEvents that do not have 2 points
else
{
// Something has gone wrong, just cancel the gesture.
- gesture.state = Gesture::Cancelled;
+ gesture.state = GestureState::CANCELLED;
}
gesture.time = currentEvent.time;
#define DALI_INTERNAL_EVENT_ROTATION_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.
* @param[in] state The state of the rotation (whether it's starting, continuing or finished).
* @param[in] currentEvent The latest touch event.
*/
- void SendRotation( Gesture::State state, const Integration::TouchEvent& currentEvent );
+ void SendRotation( GestureState state, const Integration::TouchEvent& currentEvent );
private:
*/
enum State
{
- Clear, ///< No gesture detected.
- Possible, ///< The current touch event data suggests that a gesture is possible.
- Started, ///< A gesture has been detected.
+ CLEAR, ///< No gesture detected.
+ POSSIBLE, ///< The current touch event data suggests that a gesture is possible.
+ STARTED, ///< A gesture has been detected.
};
State mState; ///< The current state of the detector.
/*
- * 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.
}
TapGestureDetector::TapGestureDetector()
-: GestureDetector( Gesture::Tap ),
+: GestureDetector( GestureType::TAP ),
mMinimumTapsRequired( DEFAULT_TAPS_REQUIRED ),
mMaximumTapsRequired( DEFAULT_TAPS_REQUIRED ),
mTouchesRequired( DEFAULT_TOUCHES_REQUIRED )
}
TapGestureDetector::TapGestureDetector( unsigned int tapsRequired )
-: GestureDetector( Gesture::Tap ),
+: GestureDetector( GestureType::TAP ),
mMinimumTapsRequired( tapsRequired ),
mMaximumTapsRequired( tapsRequired ),
mTouchesRequired( DEFAULT_TOUCHES_REQUIRED )
return mTouchesRequired;
}
-void TapGestureDetector::EmitTapGestureSignal(Dali::Actor tappedActor, const TapGesture& tap)
+void TapGestureDetector::EmitTapGestureSignal(Dali::Actor tappedActor, const Dali::TapGesture& tap)
{
// Guard against destruction during signal emission
Dali::TapGestureDetector handle( this );
#define DALI_INTERNAL_TAP_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.
// INTERNAL INCLUDES
#include <dali/public-api/events/tap-gesture-detector.h>
+#include <dali/public-api/events/tap-gesture.h>
#include <dali/internal/event/events/gesture-detector-impl.h>
namespace Dali
{
-struct TapGesture;
-
namespace Internal
{
* @param[in] tappedActor The tapped actor.
* @param[in] tap The tap gesture.
*/
- void EmitTapGestureSignal(Dali::Actor tappedActor, const TapGesture& tap);
+ void EmitTapGestureSignal(Dali::Actor tappedActor, const Dali::TapGesture& tap);
public: // Signals
/*
- * 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.
namespace Internal
{
-TapGestureEvent::TapGestureEvent( Gesture::State state )
-: GestureEvent(Gesture::Tap, state),
+TapGestureEvent::TapGestureEvent( GestureState state )
+: GestureEvent(GestureType::TAP, state),
numberOfTaps(1),
numberOfTouches(1)
{
#define DALI_INTERNAL_EVENT_TAP_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.
* send it to the Core.
*
* A Tap Gesture event should be in one of three states:
- * - Possible: When the user first puts their finger down - Core needs to hit test the down point so
+ * - POSSIBLE: When the user first puts their finger down - Core needs to hit test the down point so
* that a tap (down and up quickly) is also on the same actor.
- * - Started: If a tap is detected (No Finished state is expected).
- * - Cancelled: If, after a down event, no tap is detected, or a system interruption.
+ * - STARTED: If a tap is detected (No FINISHED state is expected).
+ * - CANCELLED: If, after a down event, no tap is detected, or a system interruption.
*
- * A Started state will be ignored if a Possible state does not precede it.
+ * A STARTED state will be ignored if a POSSIBLE state does not precede it.
*/
struct TapGestureEvent : public GestureEvent
{
/**
* Default Constructor
- * @param[in] state Possible, denotes down press;
- * Started, of a tap occurs; and
- * Cancelled, when tap does not occur.
+ * @param[in] state POSSIBLE, denotes down press;
+ * STARTED, of a tap occurs; and
+ * CANCELLED, when tap does not occur.
*/
- TapGestureEvent( Gesture::State state );
+ TapGestureEvent( GestureState state );
/**
* Virtual destructor
--- /dev/null
+#ifndef DALI_INTERNAL_TAP_GESTURE_H
+#define DALI_INTERNAL_TAP_GESTURE_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/events/tap-gesture.h>
+#include <dali/internal/event/events/gesture-impl.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+class TapGesture;
+typedef IntrusivePtr< TapGesture > TapGesturePtr;
+
+/**
+ * @copydoc Dali::TapGesture
+ */
+class TapGesture final : public Gesture
+{
+public:
+
+ /**
+ * @brief Default constructor
+ */
+ TapGesture( GestureState state )
+ : Gesture(GestureType::TAP, state)
+ {
+ }
+
+ TapGesture(const TapGesture&) = delete; ///< Deleted copy constructor
+ TapGesture(TapGesture&&) = delete; ///< Deleted move constructor
+ TapGesture& operator=(const TapGesture&) = delete; ///< Deleted copy assignment operator
+ TapGesture& operator=(TapGesture&&) = delete; ///< Deleted move assignment operator
+
+ /**
+ * @brief The number of taps in this tap gesture.
+ * @param[in] numberOfTaps The number of taps to set.
+ */
+ inline void SetNumberOfTaps( uint32_t numberOfTaps )
+ {
+ mNumberOfTaps = numberOfTaps;
+ }
+
+ /**
+ * @copydoc Dali::TapGesture::GetNumberOfTaps()
+ */
+ inline uint32_t GetNumberOfTaps() const
+ {
+ return mNumberOfTaps;
+ }
+
+ /**
+ * @brief The number of touch points in this tap gesture, i.e. the number of fingers the user had on the screen to generate the tap gesture.
+ * @param[in] numberOfTouches The number of touch points in this tap gesture to set.
+ */
+ inline void SetNumberOfTouches( uint32_t numberOfTouches )
+ {
+ mNumberOfTouches = numberOfTouches;
+ }
+
+ /**
+ * @copydoc Dali::TapGesture::GetPointCount()
+ */
+ inline uint32_t GetNumberOfTouches() const
+ {
+ return mNumberOfTouches;
+ }
+
+ /**
+ * @brief This is the point, in screen coordinates, where the tap occurred.
+ * @param[in] screenPoint The point in screen coordinates to set.
+ */
+ inline void SetScreenPoint( const Vector2& screenPoint )
+ {
+ mScreenPoint = screenPoint;
+ }
+
+ /**
+ * @copydoc Dali::TapGesture::GetDeviceId()
+ */
+ inline const Vector2& GetScreenPoint() const
+ {
+ return mScreenPoint;
+ }
+
+ /**
+ * @brief This is the point, in local actor coordinates, where the tap occurred.
+ * @param[in] localPoint The point in local actor coordinates to set.
+ */
+ inline void SetLocalPoint( const Vector2& localPoint )
+ {
+ mLocalPoint = localPoint;
+ }
+
+ /**
+ * @copydoc Dali::TapGesture::GetGetState()
+ */
+ inline const Vector2& GetLocalPoint() const
+ {
+ return mLocalPoint;
+ }
+
+private:
+
+ /**
+ * @brief Virtual destructor
+ *
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~TapGesture() = default;
+
+private:
+ Vector2 mScreenPoint;
+ Vector2 mLocalPoint;
+ uint32_t mNumberOfTaps{1u};
+ uint32_t mNumberOfTouches{1u};
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::TapGesture& GetImplementation( Dali::TapGesture& tapGesture )
+{
+ DALI_ASSERT_ALWAYS( tapGesture && "TapGesture handle is empty" );
+
+ BaseObject& object = tapGesture.GetBaseObject();
+
+ return static_cast< Internal::TapGesture& >( object );
+}
+
+inline const Internal::TapGesture& GetImplementation( const Dali::TapGesture& tapGesture )
+{
+ DALI_ASSERT_ALWAYS( tapGesture && "TapGesture handle is empty" );
+
+ const BaseObject& object = tapGesture.GetBaseObject();
+
+ return static_cast< const Internal::TapGesture& >( object );
+}
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_TAP_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.
#include <dali/internal/event/render-tasks/render-task-impl.h>
#include <dali/internal/event/common/scene-impl.h>
#include <dali/internal/event/events/tap-gesture/tap-gesture-recognizer.h>
+#include <dali/internal/event/events/tap-gesture/tap-gesture-impl.h>
#include <dali/internal/event/events/gesture-requests.h>
#include <dali/internal/event/events/tap-gesture/tap-gesture-event.h>
const TapGestureEvent& tapEvent,
Vector2 localPoint)
{
- TapGesture tap;
- tap.time = tapEvent.time;
- tap.numberOfTaps = tapEvent.numberOfTaps;
- tap.numberOfTouches = tapEvent.numberOfTouches;
- tap.screenPoint = tapEvent.point;
- tap.localPoint = localPoint;
+ Internal::TapGesturePtr tap( new Internal::TapGesture(tapEvent.state) );
+ tap->SetTime( tapEvent.time );
+ tap->SetNumberOfTaps(tapEvent.numberOfTaps);
+ tap->SetNumberOfTouches(tapEvent.numberOfTouches);
+ tap->SetScreenPoint(tapEvent.point);
+ tap->SetLocalPoint(localPoint);
Dali::Actor actorHandle( actor );
const GestureDetectorContainer::const_iterator endIter = gestureDetectors.end();
for ( GestureDetectorContainer::const_iterator iter = gestureDetectors.begin(); iter != endIter; ++iter )
{
- static_cast< TapGestureDetector* >( *iter )->EmitTapGestureSignal( actorHandle, tap );
+ static_cast< TapGestureDetector* >( *iter )->EmitTapGestureSignal( actorHandle, Dali::TapGesture( tap.Get() ) );
}
}
} // unnamed namespace
TapGestureProcessor::TapGestureProcessor()
-: GestureProcessor( Gesture::Tap ),
+: GestureProcessor( GestureType::TAP ),
mTapGestureDetectors(),
mMinTapsRequired( 1 ),
mMaxTapsRequired( 1 ),
{
switch ( tapEvent.state )
{
- case Gesture::Possible:
+ case GestureState::POSSIBLE:
{
// Do a hit test and if an actor has been hit then save to see if tap event is still valid on a tap( same actor being hit )
HitTestAlgorithm::Results hitTestResults;
break;
}
- case Gesture::Started:
+ case GestureState::STARTED:
{
// Ensure that we're processing a hit on the current actor and that we've already processed a touch down
HitTestAlgorithm::Results hitTestResults;
break;
}
- case Gesture::Cancelled:
+ case GestureState::CANCELLED:
{
mPossibleProcessed = false;
ResetActor();
break;
}
- case Gesture::Continuing:
+ case GestureState::CONTINUING:
{
- DALI_ABORT( "Incorrect state received from Integration layer: Continuing\n" );
+ DALI_ABORT( "Incorrect state received from Integration layer: CONTINUING\n" );
break;
}
- case Gesture::Finished:
+ case GestureState::FINISHED:
{
- DALI_ABORT( "Incorrect state received from Integration layer: Finished\n" );
+ DALI_ABORT( "Incorrect state received from Integration layer: FINISHED\n" );
break;
}
- case Gesture::Clear:
+ case GestureState::CLEAR:
{
- DALI_ABORT( "Incorrect state received from Integration layer: Clear\n" );
+ DALI_ABORT( "Incorrect state received from Integration layer: CLEAR\n" );
break;
}
}
} // unnamed namespace
TapGestureRecognizer::TapGestureRecognizer( Observer& observer, Vector2 screenSize, const TapGestureRequest& request)
-: GestureRecognizer( screenSize, Gesture::Tap ),
+: GestureRecognizer( screenSize, GestureType::TAP ),
mObserver(observer),
- mState(Clear),
+ mState(CLEAR),
mMinimumTapsRequired(request.minTaps),
mMaximumTapsRequired(request.maxTaps),
mTapsRegistered(0),
switch (mState)
{
- case Clear:
+ case CLEAR:
{
if (pointState == PointState::DOWN)
{
break;
}
- case Touched:
+ case TOUCHED:
{
uint32_t deltaBetweenTouchDownTouchUp = event.time - mTouchTime;
{
mLastTapTime = mTouchTime;
EmitSingleTap( event.time, point );
- mState = Registered;
+ mState = REGISTERED;
}
else
{
- mState = Clear;
+ mState = CLEAR;
}
}
else if (pointState == PointState::INTERRUPTED)
{
- mState = Clear;
+ mState = CLEAR;
}
break;
}
- case Registered:
+ case REGISTERED:
{
if ( pointState == PointState::UP )
{
{
mLastTapTime = event.time;
EmitSingleTap(event.time, point);
- mState = Registered;
+ mState = REGISTERED;
}
else
{
++mTapsRegistered;
- EmitGesture( Gesture::Started, event.time );
- mState = Clear;
+ EmitGesture( GestureState::STARTED, event.time );
+ mState = CLEAR;
}
}
- else // Delta between touch down and touch up too long to be considered a Tap event
+ else // Delta between touch down and touch up too long to be considered a TAP event
{
- mState = Clear;
+ mState = CLEAR;
}
}
else if (pointState == PointState::DOWN)
break;
}
- case Failed:
+ case FAILED:
default:
{
- mState = Clear;
+ mState = CLEAR;
break;
}
}
}
else
{
- mState = Failed;
+ mState = FAILED;
// We have entered a multi-touch event so emit registered gestures if required.
- EmitGesture(Gesture::Started, event.time);
+ EmitGesture(GestureState::STARTED, event.time);
}
}
mTouchTime = event.time;
mLastTapTime = 0u;
mTapsRegistered = 0;
- mState = Touched;
+ mState = TOUCHED;
EmitPossibleState( event );
}
void TapGestureRecognizer::EmitPossibleState( const Integration::TouchEvent& event )
{
- TapGestureEvent tapEvent( Gesture::Possible );
+ TapGestureEvent tapEvent( GestureState::POSSIBLE );
tapEvent.point = mTouchPosition;
tapEvent.time = event.time;
mMaximumTapsRequired = tap.maxTaps;
}
-void TapGestureRecognizer::EmitGesture( Gesture::State state, uint32_t time )
+void TapGestureRecognizer::EmitGesture( GestureState state, uint32_t time )
{
- if ( (state == Gesture::Cancelled) ||
+ if ( (state == GestureState::CANCELLED) ||
(mTapsRegistered >= mMinimumTapsRequired && mTapsRegistered <= mMaximumTapsRequired) )
{
void TapGestureRecognizer::EmitSingleTap( uint32_t time, const Integration::Point& point )
{
- TapGestureEvent event( Gesture::Started );
+ TapGestureEvent event( GestureState::STARTED );
const Vector2& screen( point.GetScreenPosition() );
Vector2 distanceDelta(std::abs(mTouchPosition.x - screen.x),
std::abs(mTouchPosition.y - screen.y));
if (distanceDelta.x > MAXIMUM_MOTION_ALLOWED ||
distanceDelta.y > MAXIMUM_MOTION_ALLOWED )
{
- event.state = Gesture::Cancelled;
+ event.state = GestureState::CANCELLED;
}
mTapsRegistered = 1u;
EmitTap( time, event );
#define DALI_INTERNAL_EVENT_EVENTS_TAP_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.
* @param[in] state current state of incomplete gesture
* @param[in] time time of this latest touch event
*/
- void EmitGesture( Gesture::State state, uint32_t time );
+ void EmitGesture( GestureState state, uint32_t time );
/**
* Initialises tap gesture detector for next tap sequence
*/
enum State
{
- Clear, ///< No gesture detected.
- Touched, ///< User is touching the screen.
- Registered, ///< At least one tap has been registered.
- Failed, ///< Gesture has failed.
+ CLEAR, ///< No gesture detected.
+ TOUCHED, ///< User is touching the screen.
+ REGISTERED, ///< At least one tap has been registered.
+ FAILED, ///< Gesture has failed.
};
State mState; ///< Current state of the detector.
namespace Internal
{
-TouchEvent::TouchEvent()
-: mPoints(),
- mTime( 0 )
-{
-}
-
-TouchEvent::TouchEvent( unsigned long time )
-: mPoints(),
- mTime( time )
-{
-}
-
TouchEventPtr TouchEvent::Clone( const TouchEvent& other )
{
TouchEventPtr touchEvent( new TouchEvent );
return touchEvent;
}
-TouchEvent::~TouchEvent()
-{
-}
-
-unsigned long TouchEvent::GetTime() const
-{
- return mTime;
-}
-
-std::size_t TouchEvent::GetPointCount() const
-{
- return mPoints.size();
-}
-
int32_t TouchEvent::GetDeviceId( std::size_t point ) const
{
if( point < mPoints.size() )
return mPoints[ point ];
}
-void TouchEvent::AddPoint( const Integration::Point& point )
-{
- mPoints.push_back( point );
-}
-
Device::Class::Type TouchEvent::GetDeviceClass( std::size_t point ) const
{
if( point < mPoints.size() )
return MouseButton::INVALID;
}
+void TouchEvent::AddPoint( const Integration::Point& point )
+{
+ mPoints.push_back( point );
+}
+
} // namsespace Internal
} // namespace Dali
/**
* @brief Default constructor
*/
- TouchEvent();
+ TouchEvent() = default;
/**
* @brief Constructor
* @param[in] time The time the event occurred
*/
- TouchEvent( unsigned long time );
+ TouchEvent( unsigned long time )
+ : mTime( time )
+ {
+ }
/**
* @brief Clones the TouchEvent object.
*/
static TouchEventPtr Clone( const TouchEvent& other );
- /**
- * @brief Destructor
- */
- ~TouchEvent();
+ TouchEvent( const TouchEvent& other ) = delete; ///< Deleted copy constructor.
+ TouchEvent( TouchEvent&& other ) = delete; ///< Deleted move constructor.
+ TouchEvent& operator=( const TouchEvent& other ) = delete; ///< Deleted copy assignment operator.
+ TouchEvent& operator=( TouchEvent&& other ) = delete; ///< Deleted move assignment operator.
// Getters
/**
* @copydoc Dali::TouchEvent::GetTime()
*/
- unsigned long GetTime() const;
+ inline unsigned long GetTime() const
+ {
+ return mTime;
+ }
/**
* @copydoc Dali::TouchEvent::GetPointCount()
*/
- std::size_t GetPointCount() const;
+ inline std::size_t GetPointCount() const
+ {
+ return mPoints.size();
+ }
/**
* @copydoc Dali::TouchEvent::GetDeviceId()
*/
Integration::Point& GetPoint( std::size_t point );
- // Setters
-
- /**
- * @brief Adds a point to this touch event handler.
- * @param[in] point The point to add to the touch event handler.
- */
- void AddPoint( const Integration::Point& point );
-
/**
* @brief Get the device class the mouse/touch event originated from
*
*/
MouseButton::Type GetMouseButton( std::size_t point ) const;
+ // Setters
-private:
+ /**
+ * @brief Adds a point to this touch event handler.
+ * @param[in] point The point to add to the touch event handler.
+ */
+ void AddPoint( const Integration::Point& point );
- /// Undefined Copy constructor
- TouchEvent( const TouchEvent& other );
+private:
- /// Undefined
- TouchEvent& operator=( const TouchEvent& other );
+ /**
+ * @brief Virtual Destructor
+ *
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~TouchEvent() = default;
private:
std::vector< Integration::Point > mPoints; ///< Container of the points for this touch event.
- unsigned long mTime; ///< The time (in ms) that the touch event occurred.
+ unsigned long mTime{0u}; ///< The time (in ms) that the touch event occurred.
};
} // namespace Internal
{
}
-WheelEvent::~WheelEvent()
-{
-}
-
WheelEventPtr WheelEvent::New( Dali::WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp )
{
WheelEventPtr wheelEvent = new WheelEvent( type, direction, modifiers, point, delta, timeStamp );
WheelEvent( Dali::WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp );
/**
- * @brief Destructor
- */
- ~WheelEvent();
-
- /**
* Create a new WheelEvent.
*
* @param[in] type The type of the wheel event
private:
+ /**
+ * @brief Destructor
+ *
+ * A reference counted object may only be deleted by calling Unreference()
+ */
+ virtual ~WheelEvent() = default;
+
// Not copyable or movable
WheelEvent( const WheelEvent& rhs ) = delete; ///< Deleted copy constructor
mFunc->Apply( updateBufferIndex, current );
// Optionally bake the final value
- if ( Dali::Constraint::Bake == mRemoveAction )
+ if ( Dali::Constraint::BAKE == mRemoveAction )
{
mTargetProperty.Bake( updateBufferIndex, current );
}
mConditionType(condition),
mArguments(arguments),
mValid(false),
- mNotifyMode( Dali::PropertyNotification::Disabled ),
+ mNotifyMode( Dali::PropertyNotification::DISABLED ),
mConditionFunction(NULL)
{
SetNotifyMode(notifyMode);
// means don't notify so notifyRequired stays false
switch( mNotifyMode )
{
- case Dali::PropertyNotification::Disabled:
+ case Dali::PropertyNotification::DISABLED:
{
// notify never, already initialized to false
break;
}
- case Dali::PropertyNotification::NotifyOnTrue:
+ case Dali::PropertyNotification::NOTIFY_ON_TRUE:
{
notifyRequired = mValid; // notify if value is true
break;
}
- case Dali::PropertyNotification::NotifyOnFalse:
+ case Dali::PropertyNotification::NOTIFY_ON_FALSE:
{
notifyRequired = !mValid; // notify when its false
break;
}
- case Dali::PropertyNotification::NotifyOnChanged:
+ case Dali::PropertyNotification::NOTIFY_ON_CHANGED:
{
notifyRequired = true; // notify whenever changed
break;
// INTERNAL INCLUDES
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/events/gesture-enumerations.h>
namespace Dali
{
{
struct Position
{
- Position( unsigned int time, Vector2 position, Vector2 displacement, Vector2 velocity, int state )
+ Position( unsigned int time, Vector2 position, Vector2 displacement, Vector2 velocity, GestureState state )
: time( time ), position( position ), displacement( displacement ), velocity( velocity ), state( state )
{
}
Vector2 position;
Vector2 displacement;
Vector2 velocity;
- int state;
+ GestureState state;
};
typedef std::vector< PanGestureProfiling::Position > PanPositionContainer;
/*
- * Copyright (c) 2018 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.
delete mProfiling;
}
-void PanGesture::AddGesture( const Dali::PanGesture& gesture )
+void PanGesture::AddGesture( const Internal::PanGesture& gesture )
{
Dali::Mutex::ScopedLock lock( mMutex );
mGestures[ mWritePosition ] = gesture;
// add event to history
mPanHistory.push_back( currentGesture );
- if( currentGesture.state == Gesture::Started )
+ if( currentGesture.state == GestureState::STARTED )
{
info.justStarted = true;
// clear just finished as we have started new pan
info.justFinished = false;
}
- info.justFinished |= ( currentGesture.state == Gesture::Finished || currentGesture.state == Gesture::Cancelled );
+ info.justFinished |= ( currentGesture.state == GestureState::FINISHED || currentGesture.state == GestureState::CANCELLED );
// Update our read position.
previousReadPosition = mReadPosition;
info.frameGesture.screen.velocity += lastReadGesture.screen.velocity;
info.frameGesture.local.velocity += lastReadGesture.local.velocity;
- if( lastReadGesture.state == Gesture::Started )
+ if( lastReadGesture.state == GestureState::STARTED )
{
// Clear just finished as we have started new pan.
info.justFinished = false;
}
else
{
- info.justFinished |= ( lastReadGesture.state == Gesture::Finished || lastReadGesture.state == Gesture::Cancelled );
+ info.justFinished |= ( lastReadGesture.state == GestureState::FINISHED || lastReadGesture.state == GestureState::CANCELLED );
}
// Add event to history
readGesture.screen.displacement, readGesture.screen.velocity, readGesture.state ) );
}
- if( readGesture.state == Gesture::Started )
+ if( readGesture.state == GestureState::STARTED )
{
// Clear pan data.
mPanHistory.clear();
}
else
{
- justFinished |= ( readGesture.state == Gesture::Finished || readGesture.state == Gesture::Cancelled );
+ justFinished |= ( readGesture.state == GestureState::FINISHED || readGesture.state == GestureState::CANCELLED );
}
rateConvertedGesture.screen.position += readGesture.screen.position;
#define DALI_INTERNAL_SCENE_GRAPH_PAN_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.
// INTERNAL INCLUDES
#include <dali/devel-api/threading/mutex.h>
#include <dali/public-api/common/vector-wrapper.h>
-#include <dali/public-api/events/pan-gesture.h>
+#include <dali/internal/event/events/pan-gesture/pan-gesture-impl.h>
#include <dali/internal/update/common/property-owner.h>
#include <dali/internal/update/gestures/gesture-properties.h>
namespace Dali
{
-struct PanGesture;
+class PanGesture;
namespace Internal
{
*/
PanInfo()
: time( 0u ),
- state( Gesture::Clear ),
+ state( GestureState::CLEAR ),
read( true )
{
}
* Assignment operator
* @param[in] gesture A Dali::Gesture
*/
- PanInfo& operator=( const Dali::PanGesture& rhs )
+ PanInfo& operator=( const Internal::PanGesture& rhs )
{
- time = rhs.time;
- state = rhs.state;
+ time = rhs.GetTime();
+ state = rhs.GetState();
- local.velocity = rhs.velocity;
- local.displacement = rhs.displacement;
- local.position = rhs.position;
+ local.velocity = rhs.GetVelocity();
+ local.displacement = rhs.GetDisplacement();
+ local.position = rhs.GetPosition();
- screen.velocity = rhs.screenVelocity;
- screen.displacement = rhs.screenDisplacement;
- screen.position = rhs.screenPosition;
+ screen.velocity = rhs.GetScreenVelocity();
+ screen.displacement = rhs.GetScreenDisplacement();
+ screen.position = rhs.GetScreenPosition();
return *this;
}
// Data
unsigned int time;
- Gesture::State state;
+ GestureState state;
Info local;
Info screen;
volatile bool read;
* Adds a PanGesture to the internal circular-buffer waiting to be handled by UpdateProperties.
* @param[in] gesture The latest pan gesture.
*/
- void AddGesture( const Dali::PanGesture& gesture );
+ void AddGesture( const Internal::PanGesture& gesture );
/**
* @brief Removes pan events from the history that are older than maxAge, leaving at least minEvents
volatile unsigned int mWritePosition; ///< The next PanInfo buffer to write to. (starts at 0).
unsigned int mReadPosition; ///< The next PanInfo buffer to read. (starts at 0).
bool mNotAtTarget; ///< Keeps track of if the last gesture used was the most recent received.
- bool mInGesture; ///< True if the gesture is currently being handled i.e. between Started <-> Finished/Cancelled.
+ bool mInGesture; ///< True if the gesture is currently being handled i.e. between STARTED <-> FINISHED/CANCELLED.
bool mPredictionAmountOverridden;
bool mSmoothingAmountOverridden;
renderManager( renderManager ),
renderQueue( renderQueue ),
renderTaskProcessor( renderTaskProcessor ),
- backgroundColor( Dali::Stage::DEFAULT_BACKGROUND_COLOR ),
+ backgroundColor( Dali::DEFAULT_BACKGROUND_COLOR ),
renderers(),
textureSets(),
shaders(),
return GetImplementation(*this).GetRelayoutSize( dimension );
}
-Actor::TouchEventSignalType& Actor::TouchSignal()
+Actor::TouchEventSignalType& Actor::TouchedSignal()
{
- return GetImplementation( *this ).TouchSignal();
+ return GetImplementation( *this ).TouchedSignal();
}
Actor::HoverSignalType& Actor::HoveredSignal()
*
* <h3>Multi-Touch Events:</h3>
*
- * Touch or hover events are received via signals; see Actor::TouchSignal() and Actor::HoveredSignal() for more details.
+ * Touch or hover events are received via signals; see Actor::TouchedSignal() and Actor::HoveredSignal() for more details.
*
* <i>Hit Testing Rules Summary:</i>
*
* Signals
* | %Signal Name | Method |
* |-------------------|------------------------------|
- * | touch | @ref TouchSignal() |
+ * | touched | @ref TouchedSignal() |
* | hovered | @ref HoveredSignal() |
* | wheelEvent | @ref WheelEventSignal() |
* | onScene | @ref OnSceneSignal() |
// Typedefs
- typedef Signal< bool (Actor, const TouchEvent&) > TouchEventSignalType; ///< Touch signal type @SINCE_1_1.37
+ typedef Signal< bool (Actor, const TouchEvent&) > TouchEventSignalType; ///< Touch signal type @SINCE_1_1.37
typedef Signal< bool (Actor, const HoverEvent&) > HoverSignalType; ///< Hover signal type @SINCE_1_0.0
typedef Signal< bool (Actor, const WheelEvent&) > WheelEventSignalType; ///< Wheel signal type @SINCE_1_0.0
typedef Signal< void (Actor) > OnSceneSignalType; ///< Scene connection signal type @SINCE_1_9.24
* The return value of True, indicates that the touch event has been consumed.
* Otherwise the signal will be emitted on the next sensitive parent of the actor.
* A true return will also cancel any ongoing gestures.
- * @SINCE_1_1.37
+ * @SINCE_1_9.28
* @return The signal to connect to
* @pre The Actor has been initialized.
*/
- TouchEventSignalType& TouchSignal();
+ TouchEventSignalType& TouchedSignal();
/**
* @brief This signal is emitted when hover input is received.
return CustomActor(mOwner);
}
-void CustomActorImpl::OnPropertySet( Property::Index index, Property::Value propertyValue )
+void CustomActorImpl::OnPropertySet( Property::Index index, const Property::Value& propertyValue )
{
}
return mOwner;
}
-bool CustomActorImpl::RequiresTouchEvents() const
-{
- return ( mFlags & REQUIRES_TOUCH_EVENTS );
-}
-
-bool CustomActorImpl::RequiresHoverEvents() const
-{
- return ( mFlags & REQUIRES_HOVER_EVENTS );
-}
-
-bool CustomActorImpl::RequiresWheelEvents() const
-{
- return ( mFlags & REQUIRES_WHEEL_EVENTS );
-}
-
bool CustomActorImpl::IsRelayoutEnabled() const
{
return ( mFlags & DISABLE_SIZE_NEGOTIATION ) == 0;
* @param[in] index The Property index that was set
* @param[in] propertyValue The value to set
*/
- virtual void OnPropertySet( Property::Index index, Property::Value propertyValue );
+ virtual void OnPropertySet( Property::Index index, const Property::Value& propertyValue );
/**
* @brief Called when the owning actor's size is set e.g. using Actor::SetSize().
virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize) = 0;
/**
- * @brief Called after a hover-event is received by the owning actor.
- *
- * @SINCE_1_0.0
- * @param[in] event The hover event
- * @return True if the event should be consumed
- * @note CustomActorImpl::REQUIRES_HOVER_EVENTS must be enabled during construction. See CustomActorImpl::CustomActorImpl( ActorFlags flags ).
- */
- virtual bool OnHoverEvent(const HoverEvent& event) = 0;
-
- /**
- * @brief Called after a key-event is received by the actor that has had its focus set.
- *
- * @SINCE_1_0.0
- * @param[in] event The Key Event
- * @return True if the event should be consumed
- */
- virtual bool OnKeyEvent(const KeyEvent& event) = 0;
-
- /**
- * @brief Called after a wheel-event is received by the owning actor.
- *
- * @SINCE_1_0.0
- * @param[in] event The wheel event
- * @return True if the event should be consumed
- * @note CustomActorImpl::REQUIRES_WHEEL_EVENTS must be enabled during construction. See CustomActorImpl::CustomActorImpl( ActorFlags flags ).
- */
- virtual bool OnWheelEvent(const WheelEvent& event) = 0;
-
- /**
* @brief Called after the size negotiation has been finished for this control.
*
* The control is expected to assign this given size to itself/its children.
{
ACTOR_BEHAVIOUR_DEFAULT = 0, ///< Use to provide default behaviour (size negotiation is on, event callbacks are not called). @SINCE_1_2_10
DISABLE_SIZE_NEGOTIATION = 1 << 0, ///< True if control does not need size negotiation, i.e. it can be skipped in the algorithm @SINCE_1_0.0
- REQUIRES_TOUCH_EVENTS = 1 << 1, ///< True if the OnTouchEvent() callback is required. @SINCE_1_0.0
- REQUIRES_HOVER_EVENTS = 1 << 2, ///< True if the OnHoverEvent() callback is required. @SINCE_1_0.0
- REQUIRES_WHEEL_EVENTS = 1 << 3, ///< True if the OnWheelEvent() callback is required. @SINCE_1_0.0
LAST_ACTOR_FLAG ///< Special marker for last actor flag @SINCE_1_0.0
};
Internal::CustomActor* GetOwner() const;
/**
- * @brief Returns whether the OnTouchEvent() callback is required.
- * @SINCE_1_0.0
- * @return True if the OnTouchEvent() callback is required
- * @note Called when ownership of the CustomActorImpl is passed to a CustomActor.
- */
- bool RequiresTouchEvents() const;
-
- /**
- * @brief Returns whether the OnHoverEvent() callback is required.
- * @SINCE_1_0.0
- * @return True if the OnHoverEvent() callback is required
- * @note Called when ownership of the CustomActorImpl is passed to a CustomActor.
- */
- bool RequiresHoverEvents() const;
-
- /**
- * @brief Returns whether the OnWheelEvent() callback is required.
- * @SINCE_1_0.0
- * @return True if the OnWheelEvent() callback is required
- * @note Called when ownership of the CustomActorImpl is passed to a CustomActor.
- */
- bool RequiresWheelEvents() const;
-
- /**
* @brief Returns whether relayout is enabled.
* @SINCE_1_0.0
* @return Return true if relayout is enabled on the custom actor
private:
Internal::CustomActor* mOwner; ///< Internal owner of this custom actor implementation
- ActorFlags mFlags :ACTOR_FLAG_COUNT; ///< ActorFlags flags to determine behaviour
+ ActorFlags mFlags; ///< ActorFlags flags to determine behaviour
};
/**
} // unnamed namespace
-const Constraint::RemoveAction Constraint::DEFAULT_REMOVE_ACTION = Constraint::Bake;
+const Constraint::RemoveAction Constraint::DEFAULT_REMOVE_ACTION = Constraint::BAKE;
Constraint::Constraint()
{
*/
enum RemoveAction
{
- Bake, ///< When the constraint is fully-applied, the constrained value is saved. @SINCE_1_0.0
- Discard ///< When the constraint is removed, the constrained value is discarded. @SINCE_1_0.0
+ BAKE, ///< When the constraint is fully-applied, the constrained value is saved. @SINCE_1_9.28
+ DISCARD ///< When the constraint is removed, the constrained value is discarded. @SINCE_1_9.28
};
- static const RemoveAction DEFAULT_REMOVE_ACTION; ///< Bake
+ static const RemoveAction DEFAULT_REMOVE_ACTION; ///< BAKE
/**
* @brief Creates an uninitialized Constraint; this can be initialized with Constraint::New().
Dali::Property::Index GetTargetProperty();
/**
- * @brief Sets the remove action. Constraint::Bake will "bake" a value when fully-applied.
+ * @brief Sets the remove action. Constraint::BAKE will "bake" a value when fully-applied.
*
- * In case of Constraint::Discard, the constrained value will be discarded, when the constraint is removed.
- * The default value is Constraint::Bake.
+ * In case of Constraint::DISCARD, the constrained value will be discarded, when the constraint is removed.
+ * The default value is Constraint::BAKE.
* @SINCE_1_0.0
* @param[in] action The remove-action
*/
} // namespace Math
+// background colors
+static constexpr Vector4 DEFAULT_BACKGROUND_COLOR = Color::BLACK;
+static constexpr Vector4 DEBUG_BACKGROUND_COLOR(0.2f, 0.5f, 0.2f, 1.0f); ///< Dark green, useful for debugging visuals (texture / shader issues / culling etc.).
+
/**
* @}
*/
const uint32_t CORE_MAJOR_VERSION = 1;
const uint32_t CORE_MINOR_VERSION = 9;
-const uint32_t CORE_MICRO_VERSION = 27;
+const uint32_t CORE_MICRO_VERSION = 28;
const char * const CORE_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/events/gesture-detector.h>
+#include <dali/public-api/events/gesture-enumerations.h>
#include <dali/public-api/events/gesture.h>
#include <dali/public-api/events/hover-event.h>
#include <dali/public-api/events/key-event.h>
#include <dali/public-api/events/tap-gesture-detector.h>
#include <dali/public-api/events/tap-gesture.h>
#include <dali/public-api/events/touch-event.h>
-#include <dali/public-api/events/touch-point.h>
#include <dali/public-api/images/native-image-interface.h>
#include <dali/public-api/images/pixel.h>
--- /dev/null
+#ifndef DALI_GESTURE_ENUMERATIONS_H
+#define DALI_GESTURE_ENUMERATIONS_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <cstdint>
+
+namespace Dali
+{
+
+/**
+ * @brief Enumeration for type of gesture.
+ * @SINCE_1_9.28
+ */
+namespace GestureType
+{
+enum Value : uint8_t
+{
+ PINCH = 1 << 0, ///< When two touch points move away or towards each other. @SINCE_1_9.28
+ PAN = 1 << 1, ///< When the user drags their finger(s) in a particular direction. @SINCE_1_9.28
+ TAP = 1 << 2, ///< When the user taps the screen. @SINCE_1_9.28
+ LONG_PRESS = 1 << 3, ///< When the user continues to touch the same area on the screen for the device configured time. @SINCE_1_9.28
+ ROTATION = 1 << 4, ///< When the user rotates two fingers around a particular ares of the screen. @SINCE_1_9.28
+};
+} // namespace GestureType
+
+/**
+ * @brief Enumeration for state of the gesture.
+ * @SINCE_1_9.28
+ */
+enum class GestureState : uint8_t
+{
+ CLEAR, ///< There is no state associated with this gesture. @SINCE_1_9.28
+ STARTED, ///< The touched points on the screen have moved enough to be considered a gesture. @SINCE_1_9.28
+ CONTINUING, ///< The gesture is continuing. @SINCE_1_9.28
+ FINISHED, ///< The user has lifted a finger or touched an additional point on the screen. @SINCE_1_9.28
+ CANCELLED, ///< The gesture has been cancelled. @SINCE_1_9.28
+ POSSIBLE ///< A gesture is possible. @SINCE_1_9.28
+};
+
+} // namespace Dali
+
+#endif // DALI_GESTURE_ENUMERATIONS_H
/*
- * Copyright (c) 2016 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.
// CLASS HEADER
#include <dali/public-api/events/gesture.h>
+// INTERNAL INCLUDES
+#include <dali/internal/event/events/gesture-impl.h>
+
namespace Dali
{
-Gesture::Gesture( const Gesture& rhs )
-: type(rhs.type),
- state(rhs.state),
- time(rhs.time)
+Gesture::Gesture()
{
}
-Gesture& Gesture::operator=( const Gesture& rhs )
+Gesture::Gesture(Internal::Gesture* internal)
+: BaseHandle(internal)
{
- if( this != &rhs )
- {
- type = rhs.type;
- state = rhs.state;
- time = rhs.time;
- }
-
- return *this;
}
+Gesture::Gesture( const Gesture& rhs ) = default;
+
+Gesture::Gesture( Gesture&& rhs ) = default;
+
+Gesture& Gesture::operator=( const Gesture& rhs ) = default;
+
+Gesture& Gesture::operator=( Gesture&& rhs ) = default;
+
Gesture::~Gesture()
{
}
-Gesture::Gesture(Type gestureType, State gestureState)
-: type(gestureType),
- state(gestureState),
- time(0)
+GestureType::Value Gesture::GetType() const
+{
+ return GetImplementation(*this).GetType();
+}
+
+GestureState Gesture::GetState() const
+{
+ return GetImplementation(*this).GetState();
+}
+
+uint32_t Gesture::GetTime() const
{
+ return GetImplementation(*this).GetTime();
}
} // namespace Dali
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/object/base-handle.h>
+#include <dali/public-api/events/gesture-enumerations.h>
namespace Dali
{
* @{
*/
+namespace Internal DALI_INTERNAL
+{
+class Gesture;
+}
+
/**
* @brief Base structure for different gestures that an application can receive.
*
* To receive a particular gesture, the application has to create and connect to the appropriate
* GestureDetector.
*
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @note An instance of this class cannot be created.
* @see GestureDetector
*
*/
-struct DALI_CORE_API Gesture
+class DALI_CORE_API Gesture : public BaseHandle
{
+public:
+
+ /**
+ * @brief Creates an uninitialized Gesture handle.
+ *
+ * Calling member functions with an uninitialized Actor handle is not allowed.
+ * @SINCE_1_9.28
+ */
+ Gesture();
+
/**
* @brief Copy constructor.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
*/
Gesture( const Gesture& rhs );
/**
+ * @brief Move constructor.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the handle to move
+ */
+ Gesture( Gesture&& rhs );
+
+ /**
* @brief Assignment operator.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
* @return A reference to this
*/
Gesture& operator=( const Gesture& rhs );
- // Destruction
-
- /**
- * @brief Virtual destructor.
- * @SINCE_1_0.0
- */
- virtual ~Gesture();
-
/**
- * @brief Enumeration for type of gesture.
- * @SINCE_1_0.0
+ * @brief Move assignment operator.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the handle to move
+ * @return A reference to this
*/
- enum Type
- {
- 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
- Rotation = 1 << 4, ///< When the user rotates two fingers around a particular ares of the screen. @SINCE_1_9.27
- };
+ Gesture& operator=( Gesture&& rhs );
/**
- * @brief Enumeration for state of the gesture.
- * @SINCE_1_0.0
+ * @brief Non virtual destructor.
+ * @SINCE_1_9.28
*/
- enum State
- {
- Clear, ///< There is no state associated with this gesture. @SINCE_1_0.0
- Started, ///< The touched points on the screen have moved enough to be considered a gesture. @SINCE_1_0.0
- Continuing, ///< The gesture is continuing. @SINCE_1_0.0
- Finished, ///< The user has lifted a finger or touched an additional point on the screen. @SINCE_1_0.0
- Cancelled, ///< The gesture has been cancelled. @SINCE_1_0.0
- Possible ///< A gesture is possible. @SINCE_1_0.0
- };
-
- // Data
+ ~Gesture();
/**
* @brief The gesture type.
+ * @SINCE_1_9.28
+ * @return The gesture type
*/
- Type type;
+ GestureType::Value GetType() const;
/**
* @brief The gesture state.
*
* Please see the description in the sub-classes to see the states
* used by the actual gesture.
+ * @SINCE_1_9.28
+ * @return The state of the gesture
*/
- State state;
+ GestureState GetState() const;
/**
* @brief The time the gesture took place.
+ * @SINCE_1_9.28
+ * @return The time the gesture took place
*/
- uint32_t time;
+ uint32_t GetTime() const;
-protected: // Creation
+public: // Not intended for application developers
+ /// @cond internal
/**
- * @brief This constructor is only used by derived classes.
- *
- * @SINCE_1_0.0
- * @param[in] gestureType The type of gesture event.
- * @param[in] gestureState The state of the gesture event.
+ * @brief Internal constructor.
+ * @SINCE_1_9.28
+ * @param[in] gesture Pointer to internal gesture
*/
- Gesture(Type gestureType, State gestureState);
-
+ explicit DALI_INTERNAL Gesture(Internal::Gesture* gesture);
+ /// @endcond
};
/**
#define DALI_LONG_PRESS_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.
class LongPressGestureDetector;
}
-struct LongPressGesture;
+class LongPressGesture;
/**
* @brief This class emits a signals when a long press gesture occurs that meets the requirements set by the application.
* @SINCE_1_0.0
*
* For any valid long press, two signals will be emitted:
- * - First identifying the beginning (state = Started) i.e. when fingers held down for the required time.
- * - Second identifying the ending (state = Finished) i.e. when fingers are released.
+ * - First identifying the beginning (state = GestureState::STARTED) i.e. when fingers held down for the required time.
+ * - Second identifying the ending (state = GestureState::FINISHED) i.e. when fingers are released.
*
* The application programmer can use this gesture detector as follows:
* @code
/*
- * Copyright (c) 2016 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.
// CLASS HEADER
#include <dali/public-api/events/long-press-gesture.h>
+// INTERNAL INCLUDES
+#include <dali/internal/event/events/long-press-gesture/long-press-gesture-impl.h>
+
namespace Dali
{
-LongPressGesture::LongPressGesture(Gesture::State state)
-: Gesture( Gesture::LongPress, state ),
- numberOfTouches( 1 )
+LongPressGesture::LongPressGesture( Internal::LongPressGesture* internal )
+: Gesture( internal )
{
}
-LongPressGesture::LongPressGesture( const LongPressGesture& rhs )
-: Gesture( rhs ),
- numberOfTouches( rhs.numberOfTouches ),
- screenPoint( rhs.screenPoint ),
- localPoint( rhs.localPoint )
+LongPressGesture::LongPressGesture() = default;
+
+LongPressGesture::LongPressGesture( const LongPressGesture& rhs ) = default;
+
+LongPressGesture::LongPressGesture( LongPressGesture&& rhs ) = default;
+
+LongPressGesture& LongPressGesture::operator=( const LongPressGesture& rhs ) = default;
+
+LongPressGesture& LongPressGesture::operator=( LongPressGesture&& rhs ) = default;
+
+LongPressGesture::~LongPressGesture() = default;
+
+uint32_t LongPressGesture::GetNumberOfTouches() const
{
+ return GetImplementation( *this ).GetNumberOfTouches();
}
-LongPressGesture& LongPressGesture::operator=( const LongPressGesture& rhs )
+const Vector2& LongPressGesture::GetScreenPoint() const
{
- if( this != &rhs )
- {
- Gesture::operator=(rhs);
- numberOfTouches = rhs.numberOfTouches;
- screenPoint = rhs.screenPoint;
- localPoint = rhs.localPoint;
- }
-
- return *this;
+ return GetImplementation( *this ).GetScreenPoint();
}
-LongPressGesture::~LongPressGesture()
+const Vector2& LongPressGesture::GetLocalPoint() const
{
+ return GetImplementation( *this ).GetLocalPoint();
}
} // namespace Dali
#define DALI_LONG_PRESS_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.
namespace Dali
{
+
+namespace Internal DALI_INTERNAL
+{
+class LongPressGesture;
+}
+
/**
* @addtogroup dali_core_events
* @{
/**
* @brief A LongPressGesture is emitted when the user touches and holds the screen with the stated number of fingers.
*
- * This gesture can be in one of two states, when the long-press gesture is first detected: Gesture::Started
- * and when the long-press gesture ends: Gesture::Finished.
+ * This gesture can be in one of two states, when the long-press gesture is first detected: GestureState::STARTED
+ * and when the long-press gesture ends: GestureState::FINISHED.
*
* Long press gesture finishes when all touches have been released.
*
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @see LongPressGestureDetector
*/
-struct DALI_CORE_API LongPressGesture : public Gesture
+class DALI_CORE_API LongPressGesture : public Gesture
{
- // Construction & Destruction
+public:
/**
- * @brief Constructor.
+ * @brief Creates an uninitialized LongPressGesture handle.
*
- * @SINCE_1_0.0
- * @param[in] state The state of the gesture
+ * Calling member functions with an uninitialized Actor handle is not allowed.
+ * @SINCE_1_9.28
*/
- LongPressGesture(Gesture::State state);
+ LongPressGesture();
/**
* @brief Copy constructor.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
*/
LongPressGesture( const LongPressGesture& rhs );
/**
+ * @brief Move constructor.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the handle to move
+ */
+ LongPressGesture( LongPressGesture&& rhs );
+
+ /**
* @brief Assignment operator.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
* @return A reference to this
*/
LongPressGesture& operator=( const LongPressGesture& rhs );
/**
- * @brief Virtual destructor.
- * @SINCE_1_0.0
+ * @brief Move assignment operator.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the moved handle
+ * @return A reference to this
*/
- virtual ~LongPressGesture();
+ LongPressGesture& operator=( LongPressGesture&& rhs );
- // Data
+ /**
+ * @brief Non virtual destructor.
+ * @SINCE_1_9.28
+ */
+ ~LongPressGesture();
/**
- * @brief The number of touch points in this long press gesture, i.e. the number of fingers the user had
- * on the screen to generate the long press gesture.
+ * @brief The number of touch points in this long press gesture.
+ *
+ * In other words, the number of fingers the user had on the screen to generate the long press gesture.
+ * @SINCE_1_9.28
+ * @return The number of touch points
*/
- uint32_t numberOfTouches;
+ uint32_t GetNumberOfTouches() const;
/**
* @brief This is the point, in screen coordinates, where the long press occurred.
*
* If a multi-touch long press, then this is the centroid of all the touch points.
+ * @SINCE_1_9.28
+ * @return The point where the long press occurred (in screen coordinates)
*/
- Vector2 screenPoint;
+ const Vector2& GetScreenPoint() const;
/**
* @brief This is the point, in local actor coordinates, where the long press occurred.
*
* If a multi-touch long press, then this is the centroid of all the touch points.
+ * @SINCE_1_9.28
* @return The point where tap has occurred (in local actor coordinates)
*/
- Vector2 localPoint;
+ const Vector2& GetLocalPoint() const;
+
+public: // Not intended for application developers
+
+ /// @cond internal
+ /**
+ * @brief This constructor is used internally to Create an initialized LongPressGesture handle.
+ *
+ * @param[in] longPressGesture A pointer to a newly allocated Dali resource
+ * @SINCE_1_9.28
+ */
+ explicit DALI_INTERNAL LongPressGesture( Internal::LongPressGesture* longPressGesture );
+ /// @endcond
+
};
/**
/*
- * 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.
return GetImplementation(*this).DetectedSignal();
}
-void PanGestureDetector::SetPanGestureProperties( const PanGesture& pan )
+void PanGestureDetector::SetPanGestureProperties( const Dali::PanGesture& pan )
{
Internal::PanGestureDetector::SetPanGestureProperties( pan );
}
#define DALI_PAN_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.
// INTERNAL INCLUDES
#include <dali/public-api/events/gesture-detector.h>
+#include <dali/public-api/events/pan-gesture.h>
#include <dali/public-api/object/property-index-ranges.h>
#include <dali/public-api/signals/dali-signal.h>
class PanGestureDetector;
}
-struct PanGesture;
-
/**
* @addtogroup dali_core_events
* @{
/*
- * Copyright (c) 2016 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.
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
+#include <dali/internal/event/events/pan-gesture/pan-gesture-impl.h>
namespace Dali
{
-PanGesture::PanGesture()
-: Gesture(Gesture::Pan, Gesture::Clear),
- numberOfTouches(1)
+PanGesture::PanGesture( Internal::PanGesture* internal )
+: Gesture( internal )
{
}
-PanGesture::PanGesture(Gesture::State state)
-: Gesture(Gesture::Pan, state),
- numberOfTouches(1)
+PanGesture::PanGesture() = default;
+
+PanGesture::PanGesture( const PanGesture& rhs ) = default;
+
+PanGesture::PanGesture( PanGesture&& rhs ) = default;
+
+PanGesture& PanGesture::operator=( const PanGesture& rhs ) = default;
+
+PanGesture& PanGesture::operator=( PanGesture&& rhs ) = default;
+
+PanGesture::~PanGesture() = default;
+
+const Vector2& PanGesture::GetVelocity() const
+{
+ return GetImplementation( *this ).GetVelocity();
+}
+
+const Vector2& PanGesture::GetDisplacement() const
+{
+ return GetImplementation( *this ).GetDisplacement();
+}
+
+const Vector2& PanGesture::GetPosition() const
+{
+ return GetImplementation( *this ).GetPosition();
+}
+
+const Vector2& PanGesture::GetScreenVelocity() const
{
+ return GetImplementation( *this ).GetScreenVelocity();
}
-PanGesture::PanGesture( const PanGesture& rhs )
-: Gesture( rhs ),
- velocity( rhs.velocity ),
- displacement( rhs.displacement ),
- position( rhs.position ),
- screenVelocity( rhs.screenVelocity ),
- screenDisplacement( rhs.screenDisplacement ),
- screenPosition( rhs.screenPosition ),
- numberOfTouches( rhs.numberOfTouches )
+const Vector2& PanGesture::GetScreenDisplacement() const
{
+ return GetImplementation( *this ).GetScreenDisplacement();
}
-PanGesture& PanGesture::operator=( const PanGesture& rhs )
+const Vector2& PanGesture::GetScreenPosition() const
{
- if( this != &rhs )
- {
- Gesture::operator=(rhs);
- velocity = rhs.velocity;
- displacement = rhs.displacement;
- position = rhs.position;
- screenVelocity = rhs.screenVelocity;
- screenDisplacement = rhs.screenDisplacement;
- screenPosition = rhs.screenPosition;
- numberOfTouches = rhs.numberOfTouches;
- }
-
- return *this;
+ return GetImplementation( *this ).GetScreenPosition();
}
-PanGesture::~PanGesture()
+uint32_t PanGesture::GetNumberOfTouches() const
{
+ return GetImplementation( *this ).GetNumberOfTouches();
}
float PanGesture::GetSpeed() const
{
- return velocity.Length();
+ return GetImplementation( *this ).GetSpeed();
}
float PanGesture::GetDistance() const
{
- return displacement.Length();
+ return GetImplementation( *this ).GetDistance();
}
float PanGesture::GetScreenSpeed() const
{
- return screenVelocity.Length();
+ return GetImplementation( *this ).GetScreenSpeed();
}
float PanGesture::GetScreenDistance() const
{
- return screenDisplacement.Length();
+ return GetImplementation( *this ).GetScreenDistance();
}
} // namespace Dali
#define DALI_PAN_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.
namespace Dali
{
+
+namespace Internal DALI_INTERNAL
+{
+class PanGesture;
+}
+
/**
* @addtogroup dali_core_events
* @{
/**
* @brief A PanGesture is emitted when the user moves one or more fingers in a particular direction.
*
- * This gesture can be in one of three states, when the pan gesture is first detected: Gesture::Started
- * when the pan gesture is continuing: Gesture::Continuing and finally, when the pan gesture ends:
- * Gesture::Finished.
+ * This gesture can be in one of three states, when the pan gesture is first detected: GestureState::STARTED
+ * when the pan gesture is continuing: GestureState::CONTINUING and finally, when the pan gesture ends:
+ * GestureState::FINISHED.
*
* A pan gesture will end in the following ways:
* - User releases the primary finger (the first touch).
* - Cancelled by the system.
*
* A pan gesture will continue to be sent to the actor under than initial pan until it ends.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
*/
-struct DALI_CORE_API PanGesture: public Gesture
+class DALI_CORE_API PanGesture: public Gesture
{
- // Construction & Destruction
-
- /**
- * @brief Default Constructor.
- * @SINCE_1_0.0
- */
- PanGesture();
+public:
/**
- * @brief Constructor.
+ * @brief Creates an uninitialized PanGesture handle.
*
- * @SINCE_1_0.0
- * @param[in] state The state of the gesture
+ * Calling member functions with an uninitialized Actor handle is not allowed.
+ * @SINCE_1_9.28
*/
- PanGesture(Gesture::State state);
+ PanGesture();
/**
* @brief Copy constructor.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
*/
PanGesture( const PanGesture& rhs );
/**
+ * @brief Move constructor.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the moved handle
+ */
+ PanGesture( PanGesture&& rhs );
+
+ /**
* @brief Assignment operator.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
* @return A reference to this
*/
PanGesture& operator=( const PanGesture& rhs );
/**
- * @brief Virtual destructor.
- * @SINCE_1_0.0
+ * @brief Move assignment operator.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the moved handle
+ * @return A reference to this
*/
- virtual ~PanGesture();
+ PanGesture& operator=( PanGesture&& rhs );
- // Data
+ /**
+ * @brief Non virtual destructor.
+ * @SINCE_1_9.28
+ */
+ ~PanGesture();
/**
* @brief The velocity at which the user is moving their fingers.
* A positive x value shows that the user is panning to the right, a negative x value means the opposite.
* A positive y value shows that the user is panning downwards, a negative y values means upwards.
* This value represents the local coordinates of the actor attached to the PanGestureDetector.
+ * @SINCE_1_9.28
+ * @return The velocity of the pan
*/
- Vector2 velocity;
+ const Vector2& GetVelocity() const;
/**
* @brief This is a Vector2 showing how much the user has panned (dragged) since the last pan gesture or,
* A positive y value shows that the user is panning downwards, a negative y value means upwards.
* This value is in local actor coordinates, the actor being the one attached to the
* PanGestureDetector.
+ * @SINCE_1_9.28
+ * @return The displacement of the pan
*/
- Vector2 displacement;
+ const Vector2& GetDisplacement() const;
/**
* @brief This current touch position of the primary touch point in local actor coordinates.
+ * @SINCE_1_9.28
+ * @return The current position of the pan (in local actor coordinates)
*/
- Vector2 position;
+ const Vector2& GetPosition() const;
/**
* @brief The velocity at which the user is moving their fingers.
* A positive x value shows that the user is panning to the right, a negative x value means the opposite.
* A positive y value shows that the user is panning downwards, a negative y values means upwards.
* This value represents the screen coordinates.
+ * @SINCE_1_9.28
+ * @return The velocity of the pan (in screen coordinates)
*/
- Vector2 screenVelocity;
+ const Vector2& GetScreenVelocity() const;
/**
* @brief This is a Vector2 showing how much the user has panned (dragged) since the last pan gesture or,
* A positive x value shows that the user is panning to the right, a negative x value means the opposite.
* A positive y value shows that the user is panning downwards, a negative y value means upwards.
* This value is in screen coordinates.
+ * @SINCE_1_9.28
+ * @return The displacement of the pan (in screen coordinates)
*/
- Vector2 screenDisplacement;
+ const Vector2& GetScreenDisplacement() const;
/**
* @brief This current touch position of the primary touch point in screen coordinates.
+ * @SINCE_1_9.28
+ * @return The current position of the pan (in screen coordinates)
*/
- Vector2 screenPosition;
+ const Vector2& GetScreenPosition() const;
/**
* @brief The total number of fingers touching the screen in a pan gesture.
+ * @SINCE_1_9.28
+ * @return The number of touches in the pan
*/
- uint32_t numberOfTouches;
+ uint32_t GetNumberOfTouches() const;
// Convenience Methods
* @brief Returns the speed at which the user is moving their fingers.
*
* This is the pixel movement per millisecond.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @return The speed of the pan (in pixels per millisecond)
*/
float GetSpeed() const;
* if the gesture has just started, then the distance moved since the user touched the screen.
*
* This is always a positive value.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @return The distance, as a float, a user's finger has panned
*/
float GetDistance() const;
* @brief Returns the speed at which the user is moving their fingers relative to screen coordinates.
*
* This is the pixel movement per millisecond.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @return The speed of the pan (in pixels per millisecond)
*/
float GetScreenSpeed() const;
* since the user touched the screen.
*
* This is always a positive value.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @return The distance, as a float, a user's finger has panned
*/
float GetScreenDistance() const;
+
+public: // Not intended for application developers
+
+ /// @cond internal
+ /**
+ * @brief This constructor is used internally to Create an initialized PanGesture handle.
+ *
+ * @param[in] panGesture A pointer to a newly allocated Dali resource
+ * @SINCE_1_9.28
+ */
+ explicit DALI_INTERNAL PanGesture( Internal::PanGesture* panGesture );
+ /// @endcond
+
};
/**
#define DALI_PINCH_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.
class PinchGestureDetector;
}
-struct PinchGesture;
+class PinchGesture;
/**
* @brief This class looks for pinching gestures involving two touches.
/*
- * Copyright (c) 2016 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.
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
+#include <dali/internal/event/events/pinch-gesture/pinch-gesture-impl.h>
namespace Dali
{
-PinchGesture::PinchGesture(Gesture::State state)
-: Gesture(Gesture::Pinch, state),
- scale(0.0f),
- speed(0.0f)
+PinchGesture::PinchGesture( Internal::PinchGesture* internal )
+: Gesture( internal )
{
}
-PinchGesture::PinchGesture( const PinchGesture& rhs )
-: Gesture( rhs ),
- scale( rhs.scale ),
- speed( rhs.speed ),
- screenCenterPoint( rhs.screenCenterPoint ),
- localCenterPoint( rhs.localCenterPoint )
+PinchGesture::PinchGesture() = default;
+
+PinchGesture::PinchGesture( const PinchGesture& rhs ) = default;
+
+PinchGesture::PinchGesture( PinchGesture&& rhs ) = default;
+
+PinchGesture& PinchGesture::operator=( const PinchGesture& rhs ) = default;
+
+PinchGesture& PinchGesture::operator=( PinchGesture&& rhs ) = default;
+
+PinchGesture::~PinchGesture() = default;
+
+float PinchGesture::GetScale() const
+{
+ return GetImplementation( *this ).GetScale();
+}
+
+float PinchGesture::GetSpeed() const
{
+ return GetImplementation( *this ).GetSpeed();
}
-PinchGesture& PinchGesture::operator=( const PinchGesture& rhs )
+const Vector2& PinchGesture::GetScreenCenterPoint() const
{
- if( this != &rhs )
- {
- Gesture::operator=(rhs);
- scale = rhs.scale;
- speed = rhs.speed;
- screenCenterPoint = rhs.screenCenterPoint;
- localCenterPoint = rhs.localCenterPoint;
- }
-
- return *this;
+ return GetImplementation( *this ).GetScreenCenterPoint();
}
-PinchGesture::~PinchGesture()
+const Vector2& PinchGesture::GetLocalCenterPoint() const
{
+ return GetImplementation( *this ).GetLocalCenterPoint();
}
} // namespace Dali
#define DALI_PINCH_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.
namespace Dali
{
+
+namespace Internal DALI_INTERNAL
+{
+class PinchGesture;
+}
+
/**
* @addtogroup dali_core_events
* @{
* @brief A PinchGesture is emitted when the user moves two fingers towards or away from each other.
*
* This gesture can be in one of three states; when the pinch gesture is first detected, its
- * state is set to Gesture::Started. After this, if there is change in the gesture, the state will
- * be Gesture::Continuing. Finally, when the gesture ends, the state of the gesture changes to
- * Gesture::Finished.
+ * state is set to GestureState::STARTED. After this, if there is change in the gesture, the state will
+ * be GestureState::CONTINUING. Finally, when the gesture ends, the state of the gesture changes to
+ * GestureState::FINISHED.
*
* A pinch gesture will continue to be sent to the actor under the center point of the pinch
* until the pinch ends.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
*/
-struct DALI_CORE_API PinchGesture: public Gesture
+class DALI_CORE_API PinchGesture: public Gesture
{
- // Construction & Destruction
+public:
/**
- * @brief Default Constructor.
+ * @brief Creates an uninitialized PinchGesture handle.
*
- * @SINCE_1_0.0
- * @param[in] state The state of the gesture
+ * Calling member functions with an uninitialized Actor handle is not allowed.
+ * @SINCE_1_9.28
*/
- PinchGesture(Gesture::State state);
+ PinchGesture();
/**
* @brief Copy constructor.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
*/
PinchGesture( const PinchGesture& rhs );
/**
+ * @brief Move constructor.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the moved handle
+ */
+ PinchGesture( PinchGesture&& rhs );
+
+ /**
* @brief Assignment operator.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
* @return A reference to this
*/
PinchGesture& operator=( const PinchGesture& rhs );
/**
- * @brief Virtual destructor.
- * @SINCE_1_0.0
+ * @brief Assignment operator.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the moved handle
+ * @return A reference to this
*/
- virtual ~PinchGesture();
+ PinchGesture& operator=( PinchGesture&& rhs );
- // Data
+ /**
+ * @brief Non virtual destructor.
+ * @SINCE_1_9.28
+ */
+ ~PinchGesture();
/**
* @brief The scale factor from the start of the pinch gesture till the latest pinch gesture.
*
- * If the user is moving their fingers away from each other, then
- * this value increases. Conversely, if the user is moving their
- * fingers towards each other, this value will decrease.
+ * If the user is moving their fingers away from each other, then this value increases.
+ * Conversely, if the user is moving their fingers towards each other, this value will
+ * decrease.
+ * @SINCE_1_9.28
+ * @return The scale of the pinch (from the pinch start)
*/
- float scale;
+ float GetScale() const;
/**
* @brief The speed at which the user is moving their fingers.
*
* This is the pixel movement per second.
+ * @SINCE_1_9.28
+ * @return The speed of the pinch (pixels per second)
*/
- float speed;
+ float GetSpeed() const;
/**
* @brief The center point of the two points that caused the pinch gesture in screen coordinates.
+ * @SINCE_1_9.28
+ * @return The current center point of the pinch (in screen coordinates)
*/
- Vector2 screenCenterPoint;
+ const Vector2& GetScreenCenterPoint() const;
/**
* @brief The center point of the two points that caused the pinch gesture in local actor coordinates.
+ * @SINCE_1_9.28
+ * @return The current center point of the pinch (in local actor coordinates)
+ */
+ const Vector2& GetLocalCenterPoint() const;
+
+public: // Not intended for application developers
+
+ /// @cond internal
+ /**
+ * @brief This constructor is used internally to Create an initialized PinchGesture handle.
+ *
+ * @param[in] PinchGesture A pointer to a newly allocated Dali resource
+ * @SINCE_1_9.28
*/
- Vector2 localCenterPoint;
+ explicit DALI_INTERNAL PinchGesture( Internal::PinchGesture* pinchGesture );
+ /// @endcond
+
};
/**
class RotationGestureDetector;
}
-struct RotationGesture;
+class RotationGesture;
/**
* @brief This class looks for a rotation gesture involving two touches.
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
+#include <dali/internal/event/events/rotation-gesture/rotation-gesture-impl.h>
namespace Dali
{
-RotationGesture::RotationGesture( Gesture::State state )
-: Gesture( Gesture::Rotation, state )
+RotationGesture::RotationGesture( Internal::RotationGesture* internal )
+: Gesture( internal )
{
}
-RotationGesture::RotationGesture( const RotationGesture& rhs )
-: Gesture( rhs ),
- rotation( rhs.rotation ),
- screenCenterPoint( rhs.screenCenterPoint ),
- localCenterPoint( rhs.localCenterPoint )
+RotationGesture::RotationGesture() = default;
+
+RotationGesture::RotationGesture( const RotationGesture& rhs ) = default;
+
+RotationGesture::RotationGesture( RotationGesture&& rhs ) = default;
+
+RotationGesture& RotationGesture::operator=( const RotationGesture& rhs ) = default;
+
+RotationGesture& RotationGesture::operator=( RotationGesture&& rhs ) = default;
+
+RotationGesture::~RotationGesture() = default;
+
+const Radian& RotationGesture::GetRotation() const
{
+ return GetImplementation( *this ).GetRotation();
}
-RotationGesture& RotationGesture::operator=( const RotationGesture& rhs )
+const Vector2& RotationGesture::GetScreenCenterPoint() const
{
- if( this != &rhs )
- {
- Gesture::operator=( rhs );
- rotation = rhs.rotation;
- screenCenterPoint = rhs.screenCenterPoint;
- localCenterPoint = rhs.localCenterPoint;
- }
-
- return *this;
+ return GetImplementation( *this ).GetScreenCenterPoint();
}
-RotationGesture::~RotationGesture()
+const Vector2& RotationGesture::GetLocalCenterPoint() const
{
+ return GetImplementation( *this ).GetLocalCenterPoint();
}
} // namespace Dali
namespace Dali
{
+namespace Internal DALI_INTERNAL
+{
+class RotationGesture;
+}
+
/**
* @brief A RotationGesture is emitted when the user moves two fingers that are opposite each other
* in a rotational/circular gesture.
*
* This gesture can be in one of three states; when the rotation gesture is first detected, its
- * state is set to Gesture::Started. After this, if there is change in the gesture, the state will
- * be Gesture::Continuing. Finally, when the gesture ends, the state of the gesture changes to
- * Gesture::Finished.
+ * state is set to GestureState::STARTED. After this, if there is change in the gesture, the state will
+ * be GestureState::CONTINUING. Finally, when the gesture ends, the state of the gesture changes to
+ * GestureState::FINISHED.
*
* 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
+ * @SINCE_1_9.28
*/
-struct DALI_CORE_API RotationGesture: public Gesture
+class DALI_CORE_API RotationGesture: public Gesture
{
- // Construction & Destruction
+public:
/**
- * @brief Default Constructor.
- * @SINCE_1_9.27
- * @param[in] state The state of the gesture
+ * @brief Creates an uninitialized RotationGesture handle.
+ *
+ * Calling member functions with an uninitialized Actor handle is not allowed.
+ * @SINCE_1_9.28
*/
- RotationGesture( Gesture::State state );
+ RotationGesture();
/**
* @brief Copy constructor.
- * @SINCE_1_9.27
+ * @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
*/
RotationGesture( const RotationGesture& rhs );
/**
+ * @brief Move constructor.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the moved handle
+ */
+ RotationGesture( RotationGesture&& rhs );
+
+ /**
* @brief Assignment operator.
- * @SINCE_1_9.27
+ * @SINCE_1_9.28
* @param[in] rhs A reference to the copied handle
* @return A reference to this
*/
RotationGesture& operator=( const RotationGesture& rhs );
/**
- * @brief Virtual destructor.
- * @SINCE_1_9.27
+ * @brief Move assignment operator.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the moved handle
+ * @return A reference to this
*/
- virtual ~RotationGesture();
+ RotationGesture& operator=( RotationGesture&& rhs );
- // Data
+ /**
+ * @brief Non virtual destructor.
+ * @SINCE_1_9.28
+ */
+ ~RotationGesture();
/**
* @brief The overall rotation from the start of the rotation gesture till the latest rotation gesture.
- * @SINCE_1_9.27
+ * @SINCE_1_9.28
+ * @return The rotation from the start of the rotation gesture till the latest rotation gesture.
*/
- Radian rotation;
+ const Radian& GetRotation() const;
/**
* @brief The center point of the two points that caused the rotation gesture in screen coordinates.
- * @SINCE_1_9.27
+ * @SINCE_1_9.28
+ * @return The center point in screen coordinates
*/
- Vector2 screenCenterPoint;
+ const Vector2& GetScreenCenterPoint() const;
/**
* @brief The center point of the two points that caused the rotation gesture in local actor coordinates.
- * @SINCE_1_9.27
+ * @SINCE_1_9.28
+ * @return The center point in local actor coordinates
+ */
+ const Vector2& GetLocalCenterPoint() const;
+
+public: // Not intended for application developers
+
+ /// @cond internal
+ /**
+ * @brief This constructor is used internally to Create an initialized RotationGesture handle.
+ *
+ * @param[in] rotationGesture A pointer to a newly allocated Dali resource
+ * @SINCE_1_9.28
*/
- Vector2 localCenterPoint;
+ explicit DALI_INTERNAL RotationGesture( Internal::RotationGesture* rotationGesture );
+ /// @endcond
};
} // namespace Dali
#define DALI_TAP_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.
class TapGestureDetector;
}
-struct TapGesture;
+class TapGesture;
/**
* @brief This class emits a signal when a tap gesture occurs that meets the requirements set by the
/*
- * Copyright (c) 2016 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.
// CLASS HEADER
#include <dali/public-api/events/tap-gesture.h>
+// INTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
+#include <dali/internal/event/events/tap-gesture/tap-gesture-impl.h>
+
namespace Dali
{
-TapGesture::TapGesture()
-: Gesture(Gesture::Tap, Gesture::Clear),
- numberOfTaps(1),
- numberOfTouches(1)
+TapGesture::TapGesture( Internal::TapGesture* internal )
+: Gesture( internal )
+{
+}
+
+TapGesture::TapGesture() = default;
+
+TapGesture::TapGesture( const TapGesture& rhs ) = default;
+
+TapGesture::TapGesture( TapGesture&& rhs ) = default;
+
+TapGesture& TapGesture::operator=( const TapGesture& rhs ) = default;
+
+TapGesture& TapGesture::operator=( TapGesture&& rhs ) = default;
+
+TapGesture::~TapGesture() = default;
+
+uint32_t TapGesture::GetNumberOfTaps() const
{
+ return GetImplementation( *this ).GetNumberOfTaps();
}
-TapGesture::TapGesture( const TapGesture& rhs )
-: Gesture( rhs ),
- numberOfTaps( rhs.numberOfTaps ),
- numberOfTouches( rhs.numberOfTouches ),
- screenPoint( rhs.screenPoint ),
- localPoint( rhs.localPoint )
+uint32_t TapGesture::GetNumberOfTouches() const
{
+ return GetImplementation( *this ).GetNumberOfTouches();
}
-TapGesture& TapGesture::operator=( const TapGesture& rhs )
+const Vector2& TapGesture::GetScreenPoint() const
{
- if( this != &rhs )
- {
- Gesture::operator=(rhs);
- numberOfTaps = rhs.numberOfTaps;
- numberOfTouches = rhs.numberOfTouches;
- screenPoint = rhs.screenPoint;
- localPoint = rhs.localPoint;
- }
-
- return *this;
+ return GetImplementation( *this ).GetScreenPoint();
}
-TapGesture::~TapGesture()
+const Vector2& TapGesture::GetLocalPoint() const
{
+ return GetImplementation( *this ).GetLocalPoint();
}
} // namespace Dali
#define DALI_TAP_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.
namespace Dali
{
+
+namespace Internal DALI_INTERNAL
+{
+class TapGesture;
+}
+
/**
* @addtogroup dali_core_events
* @{
* @brief A TapGesture is emitted when the user taps the screen with the stated number of fingers a stated number of times.
*
* This is a discrete gesture so does not have any state information.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @see TapGestureDetector
*/
-struct DALI_CORE_API TapGesture : public Gesture
+class DALI_CORE_API TapGesture : public Gesture
{
- // Construction & Destruction
+public:
/**
- * @brief Default Constructor.
- * @SINCE_1_0.0
+ * @brief Creates an uninitialized TapGesture handle.
+ *
+ * Calling member functions with an uninitialized Actor handle is not allowed.
+ * @SINCE_1_9.28
*/
TapGesture();
/**
* @brief Copy constructor.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @param rhs A reference to the copied handle
*/
TapGesture( const TapGesture& rhs );
/**
+ * @brief Move constructor.
+ * @SINCE_1_9.28
+ * @param rhs The handle to move.
+ */
+ TapGesture( TapGesture&& rhs );
+
+ /**
* @brief Assignment operator.
- * @SINCE_1_0.0
+ * @SINCE_1_9.28
* @param rhs A reference to the copied handle
* @return A reference to this
*/
TapGesture& operator=( const TapGesture& rhs );
/**
- * @brief Virtual destructor.
- * @SINCE_1_0.0
+ * @brief Move assignment operator.
+ * @SINCE_1_9.28
+ * @param rhs The handle to move.
*/
- virtual ~TapGesture();
+ TapGesture& operator=( TapGesture&& rhs );
- // Data
+ /**
+ * @brief Non virtual destructor.
+ * @SINCE_1_9.28
+ */
+ ~TapGesture();
/**
* @brief The number of taps in this tap gesture.
+ * @SINCE_1_9.28
+ * @return The number of taps
*/
- uint32_t numberOfTaps;
+ uint32_t GetNumberOfTaps() const;
/**
* @brief The number of touch points in this tap gesture, i.e. the number of fingers the user had on the
* screen to generate the tap gesture.
+ * @SINCE_1_9.28
+ * @return The number of touchs
*/
- uint32_t numberOfTouches;
+ uint32_t GetNumberOfTouches() const;
/**
* @brief This is the point, in screen coordinates, where the tap occurred.
*
* If a multi-touch tap, then this is the centroid of all the touch points.
+ * @SINCE_1_9.28
+ * @return The point where tap has occurred( in screen coordinates)
*/
- Vector2 screenPoint;
+ const Vector2& GetScreenPoint() const;
/**
* @brief This is the point, in local actor coordinates, where the tap occurred.
*
* If a multi-touch tap, then this is the centroid of all the touch points.
+ * @SINCE_1_9.28
* @return The point where tap has occurred (in local actor coordinates)
*/
- Vector2 localPoint;
+ const Vector2& GetLocalPoint() const;
+
+public: // Not intended for application developers
+
+ /// @cond internal
+ /**
+ * @brief This constructor is used internally to Create an initialized TapGesture handle.
+ *
+ * @param[in] tapGesture A pointer to a newly allocated Dali resource
+ * @SINCE_1_9.28
+ */
+ explicit DALI_INTERNAL TapGesture( Internal::TapGesture* tapGesture );
+ /// @endcond
};
/**
namespace Dali
{
-TouchEvent::TouchEvent()
-: BaseHandle()
-{
-}
+TouchEvent::TouchEvent() = default;
-TouchEvent::TouchEvent( const TouchEvent& other )
-: BaseHandle( other )
-{
-}
+TouchEvent::TouchEvent( const TouchEvent& other ) = default;
-TouchEvent::~TouchEvent()
-{
-}
+TouchEvent::TouchEvent( TouchEvent&& other ) = default;
-TouchEvent& TouchEvent::operator=( const TouchEvent& other )
-{
- BaseHandle::operator=( other );
- return *this;
-}
+TouchEvent::~TouchEvent() = default;
+
+TouchEvent& TouchEvent::operator=( const TouchEvent& other ) = default;
+
+TouchEvent& TouchEvent::operator=( TouchEvent&& other ) = default;
unsigned long TouchEvent::GetTime() const
{
TouchEvent( const TouchEvent& other );
/**
+ * @brief Move constructor.
+ *
+ * @SINCE_1_9.28
+ * @param[in] other The TouchEvent to move
+ */
+ TouchEvent( TouchEvent&& other );
+
+ /**
* @brief Destructor.
*
* @SINCE_1_9.26
*/
TouchEvent& operator=( const TouchEvent& other );
+ /**
+ * @brief Move assignment Operator.
+ *
+ * @SINCE_1_9.28
+ * @param[in] other The TouchEvent to move
+ * @return A reference to this
+ */
+ TouchEvent& operator=( TouchEvent&& other );
+
// Getters
/**
${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
${public_api_src_dir}/events/touch-event.cpp
${public_api_src_dir}/images/pixel.cpp
${public_api_src_dir}/images/pixel-data.cpp
${public_api_src_dir}/events/device.h
${public_api_src_dir}/events/gesture.h
${public_api_src_dir}/events/gesture-detector.h
+ ${public_api_src_dir}/events/gesture-enumerations.h
${public_api_src_dir}/events/hover-event.h
${public_api_src_dir}/events/key-event.h
${public_api_src_dir}/events/long-press-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
${public_api_src_dir}/events/touch-event.h
${public_api_src_dir}/events/mouse-button.h
)
*/
enum NotifyMode
{
- Disabled, ///< Don't notify, regardless of result of Condition @SINCE_1_0.0
- NotifyOnTrue, ///< Notify whenever condition changes from false to true. @SINCE_1_0.0
- NotifyOnFalse, ///< Notify whenever condition changes from true to false. @SINCE_1_0.0
- NotifyOnChanged ///< Notify whenever condition changes (false to true, and true to false) @SINCE_1_0.0
+ DISABLED, ///< Don't notify, regardless of result of Condition @SINCE_1_9.28
+ NOTIFY_ON_TRUE, ///< Notify whenever condition changes from false to true. @SINCE_1_9.28
+ NOTIFY_ON_FALSE, ///< Notify whenever condition changes from true to false. @SINCE_1_9.28
+ NOTIFY_ON_CHANGED ///< Notify whenever condition changes (false to true, and true to false) @SINCE_1_9.28
};
public:
* notification should respond to the result of a condition.
*
* @SINCE_1_0.0
- * @param[in] mode Notification mode (Default is PropertyNotification::NotifyOnTrue)
+ * @param[in] mode Notification mode (Default is PropertyNotification::NOTIFY_ON_TRUE)
*/
void SetNotifyMode( NotifyMode mode );
/**
* @brief Gets the result of the last condition check that caused a signal emit,
- * useful when using NotifyOnChanged mode and need to know what it changed to.
+ * useful when using NOTIFY_ON_CHANGED mode and need to know what it changed to.
*
* @SINCE_1_0.0
* @return whether condition result that triggered last emit was true or false
* {
* Actor actor = Actor::New();
*
- * actor.TouchSignal().Connect( this, &MyClass::Callback );
+ * actor.TouchedSignal().Connect( this, &MyClass::Callback );
* }
*
* ~MyClass()
Name: dali2
Summary: DALi 3D Engine
-Version: 1.9.27
+Version: 1.9.28
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT