Revert "Revert "WheelEvent class pimpling""
authorJoogab Yun <joogab.yun@samsung.com>
Mon, 7 Sep 2020 05:18:17 +0000 (14:18 +0900)
committerJoogab Yun <joogab.yun@samsung.com>
Mon, 7 Sep 2020 05:18:17 +0000 (14:18 +0900)
This reverts commit c16f2ac157730dfa3d28c448bf92a994e2afe975.

22 files changed:
automated-tests/src/dali/utc-Dali-Scene.cpp
automated-tests/src/dali/utc-Dali-Stage.cpp
automated-tests/src/dali/utc-Dali-WheelEvent.cpp
dali/devel-api/common/stage.h
dali/devel-api/events/wheel-event-devel.cpp [new file with mode: 0644]
dali/devel-api/events/wheel-event-devel.h [new file with mode: 0644]
dali/devel-api/file.list
dali/integration-api/events/wheel-event-integ.cpp
dali/integration-api/events/wheel-event-integ.h
dali/integration-api/scene.h
dali/internal/event/actors/actor-impl.cpp
dali/internal/event/actors/actor-impl.h
dali/internal/event/common/scene-impl.cpp
dali/internal/event/common/scene-impl.h
dali/internal/event/events/wheel-event-impl.cpp [new file with mode: 0755]
dali/internal/event/events/wheel-event-impl.h [new file with mode: 0755]
dali/internal/event/events/wheel-event-processor.cpp
dali/internal/file.list
dali/public-api/actors/actor.h
dali/public-api/actors/custom-actor-impl.h
dali/public-api/events/wheel-event.cpp
dali/public-api/events/wheel-event.h

index 7da86d9..59ea755 100644 (file)
@@ -839,12 +839,12 @@ int UtcDaliSceneSignalWheelEventP(void)
   application.ProcessEvent( event );
 
   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
-  DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event.type) == data.receivedWheelEvent.type );
-  DALI_TEST_CHECK( event.direction == data.receivedWheelEvent.direction );
-  DALI_TEST_CHECK( event.modifiers == data.receivedWheelEvent.modifiers );
-  DALI_TEST_CHECK( event.point == data.receivedWheelEvent.point );
-  DALI_TEST_CHECK( event.z == data.receivedWheelEvent.z );
-  DALI_TEST_CHECK( event.timeStamp == data.receivedWheelEvent.timeStamp );
+  DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event.type) == data.receivedWheelEvent.GetType() );
+  DALI_TEST_CHECK( event.direction == data.receivedWheelEvent.GetDirection() );
+  DALI_TEST_CHECK( event.modifiers == data.receivedWheelEvent.GetModifiers() );
+  DALI_TEST_CHECK( event.point == data.receivedWheelEvent.GetPoint() );
+  DALI_TEST_CHECK( event.delta == data.receivedWheelEvent.GetDelta() );
+  DALI_TEST_CHECK( event.timeStamp == data.receivedWheelEvent.GetTime() );
 
   data.Reset();
 
@@ -852,12 +852,12 @@ int UtcDaliSceneSignalWheelEventP(void)
   application.ProcessEvent( event2 );
 
   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
-  DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event2.type) == data.receivedWheelEvent.type );
-  DALI_TEST_CHECK( event2.direction == data.receivedWheelEvent.direction );
-  DALI_TEST_CHECK( event2.modifiers == data.receivedWheelEvent.modifiers );
-  DALI_TEST_CHECK( event2.point == data.receivedWheelEvent.point );
-  DALI_TEST_CHECK( event2.z == data.receivedWheelEvent.z );
-  DALI_TEST_CHECK( event2.timeStamp == data.receivedWheelEvent.timeStamp );
+  DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event2.type) == data.receivedWheelEvent.GetType() );
+  DALI_TEST_CHECK( event2.direction == data.receivedWheelEvent.GetDirection() );
+  DALI_TEST_CHECK( event2.modifiers == data.receivedWheelEvent.GetModifiers() );
+  DALI_TEST_CHECK( event2.point == data.receivedWheelEvent.GetPoint() );
+  DALI_TEST_CHECK( event2.delta == data.receivedWheelEvent.GetDelta() );
+  DALI_TEST_CHECK( event2.timeStamp == data.receivedWheelEvent.GetTime() );
   END_TEST;
 }
 
index 4131d4b..d1a6444 100644 (file)
@@ -1406,12 +1406,12 @@ int UtcDaliStageSignalWheelEventP(void)
   application.ProcessEvent( event );
 
   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
-  DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event.type) == data.receivedWheelEvent.type );
-  DALI_TEST_CHECK( event.direction == data.receivedWheelEvent.direction );
-  DALI_TEST_CHECK( event.modifiers == data.receivedWheelEvent.modifiers );
-  DALI_TEST_CHECK( event.point == data.receivedWheelEvent.point );
-  DALI_TEST_CHECK( event.z == data.receivedWheelEvent.z );
-  DALI_TEST_CHECK( event.timeStamp == data.receivedWheelEvent.timeStamp );
+  DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event.type) == data.receivedWheelEvent.GetType() );
+  DALI_TEST_CHECK( event.direction == data.receivedWheelEvent.GetDirection() );
+  DALI_TEST_CHECK( event.modifiers == data.receivedWheelEvent.GetModifiers() );
+  DALI_TEST_CHECK( event.point == data.receivedWheelEvent.GetPoint() );
+  DALI_TEST_CHECK( event.delta == data.receivedWheelEvent.GetDelta() );
+  DALI_TEST_CHECK( event.timeStamp == data.receivedWheelEvent.GetTime() );
 
   data.Reset();
 
@@ -1419,12 +1419,12 @@ int UtcDaliStageSignalWheelEventP(void)
   application.ProcessEvent( event2 );
 
   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
-  DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event2.type) == data.receivedWheelEvent.type );
-  DALI_TEST_CHECK( event2.direction == data.receivedWheelEvent.direction );
-  DALI_TEST_CHECK( event2.modifiers == data.receivedWheelEvent.modifiers );
-  DALI_TEST_CHECK( event2.point == data.receivedWheelEvent.point );
-  DALI_TEST_CHECK( event2.z == data.receivedWheelEvent.z );
-  DALI_TEST_CHECK( event2.timeStamp == data.receivedWheelEvent.timeStamp );
+  DALI_TEST_CHECK( static_cast< WheelEvent::Type >(event2.type) == data.receivedWheelEvent.GetType() );
+  DALI_TEST_CHECK( event2.direction == data.receivedWheelEvent.GetDirection() );
+  DALI_TEST_CHECK( event2.modifiers == data.receivedWheelEvent.GetModifiers() );
+  DALI_TEST_CHECK( event2.point == data.receivedWheelEvent.GetPoint() );
+  DALI_TEST_CHECK( event2.delta == data.receivedWheelEvent.GetDelta() );
+  DALI_TEST_CHECK( event2.timeStamp == data.receivedWheelEvent.GetTime() );
   END_TEST;
 }
 
index 5d8d303..dd9ea50 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
 #include <stdlib.h>
 #include <dali/public-api/dali-core.h>
 #include <dali/integration-api/events/wheel-event-integ.h>
+#include <dali/devel-api/events/wheel-event-devel.h>
 #include <dali-test-suite-utils.h>
 
 using namespace Dali;
@@ -44,13 +45,7 @@ struct SignalData
   {
     functorCalled = false;
 
-    receivedWheelEvent.type = WheelEvent::MOUSE_WHEEL;
-    receivedWheelEvent.direction = 0;
-    receivedWheelEvent.modifiers = 0;
-    receivedWheelEvent.point = Vector2::ZERO;
-    receivedWheelEvent.z = 0;
-    receivedWheelEvent.timeStamp = 0;
-
+    receivedWheelEvent.Reset();
     wheeledActor.Reset();
   }
 
@@ -82,14 +77,15 @@ int UtcDaliWheelEventConstructor(void)
 {
   TestApplication application; // Reset all test adapter return codes
 
-  WheelEvent event(WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u);  // coustruct a wheel event
+  Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u );
+  DALI_TEST_CHECK( event );
 
-  DALI_TEST_EQUALS(WheelEvent::MOUSE_WHEEL, event.type, TEST_LOCATION); // check type
-  DALI_TEST_EQUALS(1, event.direction, TEST_LOCATION); // check direction
-  DALI_TEST_EQUALS(SHIFT_MODIFIER, event.modifiers, TEST_LOCATION); // check modifier
-  DALI_TEST_EQUALS(Vector2(1.0f, 1.0f), event.point, TEST_LOCATION); // check modifier
-  DALI_TEST_EQUALS(1, event.z, TEST_LOCATION); // check modifier
-  DALI_TEST_EQUALS(1000u, event.timeStamp, TEST_LOCATION); // check modifier
+  DALI_TEST_EQUALS(Dali::WheelEvent::MOUSE_WHEEL, event.GetType(), TEST_LOCATION); // check type
+  DALI_TEST_EQUALS(1, event.GetDirection(), TEST_LOCATION); // check direction
+  DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetModifiers(), TEST_LOCATION); // check modifier
+  DALI_TEST_EQUALS(Vector2(1.0f, 1.0f), event.GetPoint(), TEST_LOCATION); // check modifier
+  DALI_TEST_EQUALS(1, event.GetDelta(), TEST_LOCATION); // check modifier
+  DALI_TEST_EQUALS(1000u, event.GetTime(), TEST_LOCATION); // check modifier
   END_TEST;
 }
 
@@ -98,12 +94,10 @@ int UtcDaliWheelEventIsShiftModifier(void)
 {
   TestApplication application; // Reset all test adapter return codes
 
-  WheelEvent event;
-  DALI_TEST_EQUALS(0u, event.modifiers, TEST_LOCATION);
-
-  event.modifiers = SHIFT_MODIFIER; // Set to Shift Modifier
+  Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u );
+  DALI_TEST_CHECK( event );
 
-  DALI_TEST_EQUALS(SHIFT_MODIFIER, event.modifiers, TEST_LOCATION); // check able to set
+  DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetModifiers(), TEST_LOCATION);
 
   DALI_TEST_EQUALS(true, event.IsShiftModifier(), TEST_LOCATION); // check IsShiftModifier
 
@@ -115,12 +109,10 @@ int UtcDaliWheelEventIsCtrlModifier(void)
 {
   TestApplication application; // Reset all test adapter return codes
 
-  WheelEvent event;
-  DALI_TEST_EQUALS(0u, event.modifiers, TEST_LOCATION);
-
-  event.modifiers = CTRL_MODIFIER; // Set to Ctrl Modifier
+  Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, CTRL_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u );
+  DALI_TEST_CHECK( event );
 
-  DALI_TEST_EQUALS(CTRL_MODIFIER, event.modifiers, TEST_LOCATION); // check able to set
+  DALI_TEST_EQUALS(CTRL_MODIFIER, event.GetModifiers(), TEST_LOCATION);
 
   DALI_TEST_EQUALS(true, event.IsCtrlModifier(), TEST_LOCATION); // check IsCtrlModifier
   END_TEST;
@@ -131,12 +123,10 @@ int UtcDaliWheelEventIsAltModifier(void)
 {
   TestApplication application; // Reset all test adapter return codes
 
-  WheelEvent event;
-  DALI_TEST_EQUALS(0u, event.modifiers, TEST_LOCATION);
+  Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, ALT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u );
+  DALI_TEST_CHECK( event );
 
-  event.modifiers = ALT_MODIFIER; // Set to Alt Modifier
-
-  DALI_TEST_EQUALS(ALT_MODIFIER, event.modifiers, TEST_LOCATION); // check able to set
+  DALI_TEST_EQUALS(ALT_MODIFIER, event.GetModifiers(), TEST_LOCATION);
 
   DALI_TEST_EQUALS(true, event.IsAltModifier(), TEST_LOCATION);  // IsAltModifier
   END_TEST;
@@ -147,9 +137,10 @@ int UtcDaliWheelEventIsNotShiftModifier(void)
 {
   TestApplication application; // Reset all test adapter return codes
 
-  WheelEvent event(WheelEvent::MOUSE_WHEEL, 1, CTRL_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u);
+  Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, CTRL_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u );
+  DALI_TEST_CHECK( event );
 
-  DALI_TEST_EQUALS(CTRL_MODIFIER, event.modifiers, TEST_LOCATION);  // check different modifier used
+  DALI_TEST_EQUALS(CTRL_MODIFIER, event.GetModifiers(), TEST_LOCATION);  // check different modifier used
 
   DALI_TEST_EQUALS(false, event.IsShiftModifier(), TEST_LOCATION);
   END_TEST;
@@ -160,9 +151,10 @@ int UtcDaliWheelEventIsNotCtrlModifier(void)
 {
   TestApplication application; // Reset all test adapter return codes
 
-  WheelEvent event(WheelEvent::MOUSE_WHEEL, 1, ALT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u);
+  Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, ALT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u );
+  DALI_TEST_CHECK( event );
 
-  DALI_TEST_EQUALS(ALT_MODIFIER, event.modifiers, TEST_LOCATION);  // check different modifier used
+  DALI_TEST_EQUALS(ALT_MODIFIER, event.GetModifiers(), TEST_LOCATION);  // check different modifier used
 
   DALI_TEST_EQUALS(false, event.IsCtrlModifier(), TEST_LOCATION);
   END_TEST;
@@ -173,9 +165,10 @@ int UtcDaliWheelEventIsNotAltModifier(void)
 {
   TestApplication application; // Reset all test adapter return codes
 
-  WheelEvent event(WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u);
+  Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u );
+  DALI_TEST_CHECK( event );
 
-  DALI_TEST_EQUALS(SHIFT_MODIFIER, event.modifiers, TEST_LOCATION);  // check different modifier used
+  DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetModifiers(), TEST_LOCATION);  // check different modifier used
 
   DALI_TEST_EQUALS(false, event.IsAltModifier(), TEST_LOCATION);
   END_TEST;
@@ -186,12 +179,12 @@ int UtcDaliWheelEventANDModifer(void)
 {
   TestApplication application; // Reset all test adapter return codes
 
-  WheelEvent event(WheelEvent::MOUSE_WHEEL, 1, SHIFT_AND_CTRL_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u);
+  Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_AND_CTRL_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u );
+  DALI_TEST_CHECK( event );
   DALI_TEST_EQUALS(true, event.IsCtrlModifier() && event.IsShiftModifier(), TEST_LOCATION);
 
-  event.modifiers = SHIFT_MODIFIER;
-
-  DALI_TEST_EQUALS(false, event.IsCtrlModifier() && event.IsShiftModifier(), TEST_LOCATION);
+  Dali::WheelEvent newEvent = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u );
+  DALI_TEST_EQUALS(false, newEvent.IsCtrlModifier() && newEvent.IsShiftModifier(), TEST_LOCATION);
   END_TEST;
 }
 
@@ -200,12 +193,12 @@ int UtcDaliWheelEventORModifer(void)
 {
   TestApplication application; // Reset all test adapter return codes
 
-  WheelEvent event(WheelEvent::MOUSE_WHEEL, 1, SHIFT_AND_CTRL_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u);
+  Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_AND_CTRL_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u );
+  DALI_TEST_CHECK( event );
   DALI_TEST_EQUALS(true, event.IsCtrlModifier() || event.IsAltModifier(), TEST_LOCATION);
 
-  event.modifiers = SHIFT_MODIFIER;
-
-  DALI_TEST_EQUALS(false, event.IsCtrlModifier() && event.IsAltModifier(), TEST_LOCATION);
+  Dali::WheelEvent newEvent = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u );
+  DALI_TEST_EQUALS(false, newEvent.IsCtrlModifier() && newEvent.IsAltModifier(), TEST_LOCATION);
   END_TEST;
 }
 
@@ -234,12 +227,12 @@ int UtcDaliWheelEventSignalling(void)
   application.ProcessEvent( event );
   DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION );
   DALI_TEST_CHECK( actor == data.wheeledActor );
-  DALI_TEST_EQUALS(WheelEvent::MOUSE_WHEEL, data.receivedWheelEvent.type, TEST_LOCATION); // check type
-  DALI_TEST_EQUALS(0, data.receivedWheelEvent.direction, TEST_LOCATION); // check direction
-  DALI_TEST_EQUALS(SHIFT_MODIFIER, data.receivedWheelEvent.modifiers, TEST_LOCATION); // check modifier
-  DALI_TEST_EQUALS(screenCoordinates, data.receivedWheelEvent.point, TEST_LOCATION); // check modifier
-  DALI_TEST_EQUALS(1, data.receivedWheelEvent.z, TEST_LOCATION); // check modifier
-  DALI_TEST_EQUALS(1000u, data.receivedWheelEvent.timeStamp, TEST_LOCATION); // check modifier
+  DALI_TEST_EQUALS(WheelEvent::MOUSE_WHEEL, data.receivedWheelEvent.GetType(), TEST_LOCATION); // check type
+  DALI_TEST_EQUALS(0, data.receivedWheelEvent.GetDirection(), TEST_LOCATION); // check direction
+  DALI_TEST_EQUALS(SHIFT_MODIFIER, data.receivedWheelEvent.GetModifiers(), TEST_LOCATION); // check modifier
+  DALI_TEST_EQUALS(screenCoordinates, data.receivedWheelEvent.GetPoint(), TEST_LOCATION); // check modifier
+  DALI_TEST_EQUALS(1, data.receivedWheelEvent.GetDelta(), TEST_LOCATION); // check modifier
+  DALI_TEST_EQUALS(1000u, data.receivedWheelEvent.GetTime(), TEST_LOCATION); // check modifier
   data.Reset();
 
   // Emit a wheel signal where the actor is not present, will hit the root actor though
@@ -256,12 +249,12 @@ int UtcDaliWheelEventSignalling(void)
   DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION );
   DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION );
   DALI_TEST_CHECK( rootActor == rootData.wheeledActor );
-  DALI_TEST_EQUALS(WheelEvent::MOUSE_WHEEL, rootData.receivedWheelEvent.type, TEST_LOCATION); // check type
-  DALI_TEST_EQUALS(0, rootData.receivedWheelEvent.direction, TEST_LOCATION); // check direction
-  DALI_TEST_EQUALS(SHIFT_MODIFIER, rootData.receivedWheelEvent.modifiers, TEST_LOCATION); // check modifier
-  DALI_TEST_EQUALS(screenCoordinates, rootData.receivedWheelEvent.point, TEST_LOCATION); // check modifier
-  DALI_TEST_EQUALS(1, rootData.receivedWheelEvent.z, TEST_LOCATION); // check modifier
-  DALI_TEST_EQUALS(1000u, rootData.receivedWheelEvent.timeStamp, TEST_LOCATION); // check modifier
+  DALI_TEST_EQUALS(WheelEvent::MOUSE_WHEEL, rootData.receivedWheelEvent.GetType(), TEST_LOCATION); // check type
+  DALI_TEST_EQUALS(0, rootData.receivedWheelEvent.GetDirection(), TEST_LOCATION); // check direction
+  DALI_TEST_EQUALS(SHIFT_MODIFIER, rootData.receivedWheelEvent.GetModifiers(), TEST_LOCATION); // check modifier
+  DALI_TEST_EQUALS(screenCoordinates, rootData.receivedWheelEvent.GetPoint(), TEST_LOCATION); // check modifier
+  DALI_TEST_EQUALS(1, rootData.receivedWheelEvent.GetDelta(), TEST_LOCATION); // check modifier
+  DALI_TEST_EQUALS(1000u, rootData.receivedWheelEvent.GetTime(), TEST_LOCATION); // check modifier
 
   // Remove actor from the scene
   application.GetScene().Remove( actor );
index 743f38e..50ba0de 100644 (file)
@@ -42,11 +42,11 @@ class Layer;
 class ObjectRegistry;
 class TouchEvent;
 class RenderTaskList;
+class WheelEvent;
 struct Vector2;
 struct Vector3;
 struct Vector4;
 struct KeyEvent;
-struct WheelEvent;
 
 /**
  * @brief The Stage is a top-level object used for displaying a tree of Actors.
diff --git a/dali/devel-api/events/wheel-event-devel.cpp b/dali/devel-api/events/wheel-event-devel.cpp
new file mode 100644 (file)
index 0000000..83ca780
--- /dev/null
@@ -0,0 +1,38 @@
+/*\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/wheel-event-devel.h>\r
+#include <dali/internal/event/events/wheel-event-impl.h>\r
+\r
+namespace Dali\r
+{\r
+\r
+namespace DevelWheelEvent\r
+{\r
+\r
+WheelEvent New( WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp )\r
+{\r
+  Internal::WheelEventPtr internal = Internal::WheelEvent::New( type, direction, modifiers, point, delta, timeStamp );\r
+\r
+  return WheelEvent( internal.Get() );\r
+}\r
+\r
+} // namespace DevelKeyEvent\r
+\r
+} // namespace Dali\r
+\r
diff --git a/dali/devel-api/events/wheel-event-devel.h b/dali/devel-api/events/wheel-event-devel.h
new file mode 100644 (file)
index 0000000..36f9b79
--- /dev/null
@@ -0,0 +1,49 @@
+#ifndef DALI_WHEEL_EVENT_DEVEL_H\r
+#define DALI_WHEEL_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/wheel-event.h>\r
+\r
+namespace Dali\r
+{\r
+\r
+namespace DevelWheelEvent\r
+{\r
+\r
+/**\r
+ * @brief Creates an initialized WheelEvent.\r
+ *\r
+ * @SINCE_1_9.26\r
+ * @param[in] type      The type of the wheel event\r
+ * @param[in] direction The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel)\r
+ * @param[in] modifiers Modifier keys pressed during the event (such as shift, alt and control)\r
+ * @param[in] point     The co-ordinates of the cursor relative to the top-left of the screen\r
+ * @param[in] delta     The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise)\r
+ * @param[in] timeStamp The time the wheel is being rolled\r
+ * @return A handle to a newly allocated Dali resource\r
+ */\r
+DALI_CORE_API WheelEvent New( WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp );\r
+\r
+\r
+} // namespace DevelWheelEvent\r
+\r
+} // namespace Dali\r
+\r
+#endif // DALI_WHEEL_EVENT_DEVEL_H\r
index b3f5f40..5ae82c1 100644 (file)
@@ -16,6 +16,7 @@ SET( devel_api_src_files
   ${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/key-event-devel.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
   ${devel_api_src_dir}/object/handle-devel.cpp
@@ -71,6 +72,7 @@ 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/key-event-devel.h
+  ${devel_api_src_dir}/events/wheel-event-devel.h
 )
 
 
index 3f99995..cf0d7ab 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 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.
@@ -30,18 +30,18 @@ WheelEvent::WheelEvent()
   direction( 0 ),
   modifiers( 0 ),
   point( Vector2::ZERO ),
-  z( 0 ),
+  delta( 0 ),
   timeStamp( 0 )
 {
 }
 
-WheelEvent::WheelEvent( Type type, int direction, unsigned int modifiers, Vector2 point, int z, unsigned int timeStamp )
+WheelEvent::WheelEvent( Type type, int direction, unsigned int modifiers, Vector2 point, int delta, unsigned int timeStamp )
 : Event( Wheel ),
   type( type ),
   direction( direction ),
   modifiers( modifiers ),
   point( point ),
-  z( z ),
+  delta( delta ),
   timeStamp( timeStamp )
 {
 }
index cf23ffb..eb47e2c 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTEGRATION_WHEEL_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.
@@ -60,10 +60,10 @@ struct DALI_CORE_API WheelEvent : public Event
    * @param[in]  direction  The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel)
    * @param[in]  modifiers  modifier keys pressed during the event (such as shift, alt and control)
    * @param[in]  point      The co-ordinates of the cursor relative to the top-left of the screen.
-   * @param[in]  z          The offset of rolling (positive value means roll down, and negative value means roll up)
+   * @param[in]  delta      The offset of rolling (positive value means roll down, and negative value means roll up)
    * @param[in]  timeStamp  The time the wheel is being rolled.
    */
-  WheelEvent( Type type, int direction, unsigned int modifiers, Vector2 point, int z, unsigned int timeStamp );
+  WheelEvent( Type type, int direction, unsigned int modifiers, Vector2 point, int delta, unsigned int timeStamp );
 
   /**
    * Virtual destructor
@@ -73,32 +73,32 @@ struct DALI_CORE_API WheelEvent : public Event
   // Data
 
   /**
-   *@copydoc Dali::WheelEvent::type
+   *@copydoc Dali::WheelEvent::GetType
    */
   Type type;
 
   /**
-   *@copydoc Dali::WheelEvent::direction
+   *@copydoc Dali::WheelEvent::GetDrection
    */
   int direction;
 
   /**
-   *@copydoc Dali::WheelEvent::modifiers
+   *@copydoc Dali::WheelEvent::GetModifiers
    */
   unsigned int modifiers;
 
   /**
-   *@copydoc Dali::WheelEvent::point
+   *@copydoc Dali::WheelEvent::GetPoint
    */
   Vector2 point;
 
   /**
-   *@copydoc Dali::WheelEvent::z
+   *@copydoc Dali::WheelEvent::GetDelta
    */
-  int z;
+  int delta;
 
   /**
-   *@copydoc Dali::WheelEvent::timeStamp
+   *@copydoc Dali::WheelEvent::GetTime
    */
   unsigned int timeStamp;
 
index f7e5d31..c335154 100755 (executable)
@@ -35,7 +35,7 @@ struct KeyEvent;
 class Layer;
 class RenderTaskList;
 class TouchEvent;
-struct WheelEvent;
+class WheelEvent;
 
 namespace Internal DALI_INTERNAL
 {
index bd42ddc..91f19d9 100644 (file)
@@ -1854,7 +1854,7 @@ bool Actor::EmitHoverEventSignal( const Dali::HoverEvent& event )
   return consumed;
 }
 
-bool Actor::EmitWheelEventSignal( const WheelEvent& event )
+bool Actor::EmitWheelEventSignal( const Dali::WheelEvent& event )
 {
   bool consumed = false;
 
index d6065af..699cbf8 100644 (file)
@@ -44,7 +44,7 @@ namespace Dali
 struct KeyEvent;
 class TouchData;
 class TouchEvent;
-struct WheelEvent;
+class WheelEvent;
 
 namespace Internal
 {
@@ -1422,7 +1422,7 @@ public:
    * @param[in] event The wheel event.
    * @return True if the event was consumed.
    */
-  bool EmitWheelEventSignal( const WheelEvent& event );
+  bool EmitWheelEventSignal( const Dali::WheelEvent& event );
 
   /**
    * @brief Emits the visibility change signal for this actor and all its children.
index db4c217..09486d8 100644 (file)
@@ -324,7 +324,7 @@ void Scene::EmitTouchedSignal( const Dali::TouchEvent& touch )
   }
 }
 
-void Scene::EmitWheelEventSignal(const WheelEvent& event)
+void Scene::EmitWheelEventSignal(const Dali::WheelEvent& event)
 {
   if ( !mWheelEventSignal.Empty() )
   {
index 4100f8a..9db7d02 100644 (file)
@@ -213,7 +213,7 @@ public:
    * Used by the EventProcessor to emit wheel event signals.
    * @param[in] event The wheel event.
    */
-  void EmitWheelEventSignal( const WheelEvent& event );
+  void EmitWheelEventSignal( const Dali::WheelEvent& event );
 
   /**
    * @copydoc Dali::Integration::Scene::AddFrameRenderedCallback
diff --git a/dali/internal/event/events/wheel-event-impl.cpp b/dali/internal/event/events/wheel-event-impl.cpp
new file mode 100755 (executable)
index 0000000..2508796
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * 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/internal/event/events/wheel-event-impl.h>
+
+namespace Dali
+{
+
+namespace
+{
+const uint32_t MODIFIER_SHIFT = 0x1;
+const uint32_t MODIFIER_CTRL  = 0x2;
+const uint32_t MODIFIER_ALT   = 0x4;
+}
+
+namespace Internal
+{
+
+WheelEvent::WheelEvent()
+: mType( Dali::WheelEvent::MOUSE_WHEEL ),
+  mDirection( 0 ),
+  mModifiers( 0 ),
+  mPoint( Vector2::ZERO ),
+  mDelta( 0 ),
+  mTimeStamp( 0 )
+{
+}
+
+WheelEvent::WheelEvent( Dali::WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp )
+: mType( type ),
+  mDirection( direction ),
+  mModifiers( modifiers ),
+  mPoint( point ),
+  mDelta( delta ),
+  mTimeStamp( timeStamp )
+{
+}
+
+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 );
+  return wheelEvent;
+}
+
+bool WheelEvent::IsShiftModifier() const
+{
+  return ( ( MODIFIER_SHIFT & mModifiers ) == MODIFIER_SHIFT );
+}
+
+bool WheelEvent::IsCtrlModifier() const
+{
+  return ( ( MODIFIER_CTRL & mModifiers ) == MODIFIER_CTRL );
+}
+
+bool WheelEvent::IsAltModifier() const
+{
+  return ( ( MODIFIER_ALT & mModifiers ) == MODIFIER_ALT );
+}
+
+Dali::WheelEvent::Type WheelEvent::GetType() const
+{
+  return mType;
+}
+
+int32_t WheelEvent::GetDirection() const
+{
+  return mDirection;
+}
+
+uint32_t WheelEvent::GetModifiers() const
+{
+  return mModifiers;
+}
+
+const Vector2& WheelEvent::GetPoint() const
+{
+  return mPoint;
+}
+
+int32_t WheelEvent::GetDelta() const
+{
+  return mDelta;
+}
+
+uint32_t WheelEvent::GetTime() const
+{
+  return mTimeStamp;
+}
+
+} // namsespace Internal
+
+} // namespace Dali
diff --git a/dali/internal/event/events/wheel-event-impl.h b/dali/internal/event/events/wheel-event-impl.h
new file mode 100755 (executable)
index 0000000..91c8152
--- /dev/null
@@ -0,0 +1,168 @@
+#ifndef DALI_INTERNAL_WHEEL_EVENT_H
+#define DALI_INTERNAL_WHEEL_EVENT_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/wheel-event.h>
+#include <dali/public-api/object/base-object.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+class WheelEvent;
+typedef IntrusivePtr< WheelEvent > WheelEventPtr;
+
+/**
+ * @copydoc Dali::WheelEvent
+ */
+class WheelEvent : public BaseObject
+{
+public:
+
+  // Construction & Destruction
+
+  /**
+   * @brief Default constructor
+   */
+  WheelEvent();
+
+  /**
+   * @brief Constructor.
+   *
+   * @param[in] type      The type of the wheel event
+   * @param[in] direction The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel)
+   * @param[in] modifiers Modifier keys pressed during the event (such as shift, alt and control)
+   * @param[in] point     The co-ordinates of the cursor relative to the top-left of the screen
+   * @param[in] delta     The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise)
+   * @param[in] timeStamp The time the wheel is being rolled
+   */
+  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
+   * @param[in] direction The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel)
+   * @param[in] modifiers Modifier keys pressed during the event (such as shift, alt and control)
+   * @param[in] point     The co-ordinates of the cursor relative to the top-left of the screen
+   * @param[in] delta     The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise)
+   * @param[in] timeStamp The time the wheel is being rolled
+   * @return A smart-pointer to the newly allocated WheelEvent.
+   */
+  static WheelEventPtr New( Dali::WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp );
+
+  /**
+   * @copydoc Dali::WheelEvent::IsShiftModifier()
+   */
+  bool IsShiftModifier() const;
+
+  /**
+   * @copydoc Dali::WheelEvent::IsCtrlModifier()
+   */
+  bool IsCtrlModifier() const;
+
+  /**
+   * @copydoc Dali::WheelEvent::IsAltModifier()
+   */
+  bool IsAltModifier() const;
+
+  // Getters
+
+  /**
+   * @copydoc Dali::WheelEvent::GetType()
+   */
+  Dali::WheelEvent::Type GetType() const;
+
+  /**
+   * @copydoc Dali::WheelEvent::GetDirection()
+   */
+  int32_t GetDirection() const;
+
+  /**
+   * @copydoc Dali::WheelEvent::GetModifiers()
+   */
+  uint32_t GetModifiers() const;
+
+  /**
+   * @copydoc Dali::WheelEvent::GetPoint()
+   */
+  const Vector2& GetPoint() const;
+
+  /**
+   * @copydoc Dali::WheelEvent::GetDelta()
+   */
+  int32_t GetDelta() const;
+
+  /**
+   * @copydoc Dali::WheelEvent::GetTime()
+   */
+  uint32_t GetTime() const;
+
+private:
+
+  // Not copyable or movable
+
+  WheelEvent( const WheelEvent& rhs ) = delete;             ///< Deleted copy constructor
+  WheelEvent( WheelEvent&& rhs ) = delete;                  ///< Deleted move constructor
+  WheelEvent& operator=( const WheelEvent& rhs ) = delete;  ///< Deleted copy assignment operator
+  WheelEvent& operator=( WheelEvent&& rhs ) = delete;       ///< Deleted move assignment operator
+
+private:
+
+  Dali::WheelEvent::Type mType; ///< The type of the event
+  int32_t mDirection;           ///< The direction in which the wheel is being rolled
+  uint32_t mModifiers;          ///< Modifier keys pressed during the event
+  Vector2 mPoint;               ///< The co-ordinates of the cursor relative to the top-left of the screen when the wheel is being rolled.
+  int32_t mDelta;               ///< The offset of the wheel rolling
+  uint32_t mTimeStamp;          ///< The time when the wheel is being rolled
+};
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::WheelEvent& GetImplementation( Dali::WheelEvent& wheelEvent )
+{
+  DALI_ASSERT_ALWAYS( wheelEvent && "Wheel Event handle is empty" );
+
+  BaseObject& object = wheelEvent.GetBaseObject();
+
+  return static_cast< Internal::WheelEvent& >( object );
+}
+
+inline const Internal::WheelEvent& GetImplementation( const Dali::WheelEvent& wheelEvent )
+{
+  DALI_ASSERT_ALWAYS( wheelEvent && "Wheel Event handle is empty" );
+
+  const BaseObject& object = wheelEvent.GetBaseObject();
+
+  return static_cast< const Internal::WheelEvent& >( object );
+}
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_WHEEL_EVENT_H
index d2a7645..a5c93e8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -26,6 +26,7 @@
 #include <dali/internal/event/actors/actor-impl.h>
 #include <dali/internal/event/common/scene-impl.h>
 #include <dali/internal/event/events/hit-test-algorithm-impl.h>
+#include <dali/internal/event/events/wheel-event-impl.h>
 
 namespace Dali
 {
@@ -43,7 +44,7 @@ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WHE
 /**
  *  Recursively deliver events to the actor and its parents, until the event is consumed or the stage is reached.
  */
-Dali::Actor EmitWheelSignals( Dali::Actor actor, const WheelEvent& event )
+Dali::Actor EmitWheelSignals( Dali::Actor actor, const Dali::WheelEvent& event )
 {
   Dali::Actor consumedActor;
 
@@ -133,9 +134,10 @@ WheelEventProcessor::~WheelEventProcessor()
 
 void WheelEventProcessor::ProcessWheelEvent( const Integration::WheelEvent& event )
 {
-  WheelEvent wheelEvent( static_cast< WheelEvent::Type >( event.type ), event.direction, event.modifiers, event.point, event.z, event.timeStamp );
+  WheelEventPtr wheelEvent = WheelEvent::New( static_cast< Dali::WheelEvent::Type >( event.type ), event.direction, event.modifiers, event.point, event.delta, event.timeStamp );
+  Dali::WheelEvent wheelEventHandle( wheelEvent.Get() );
 
-  if( wheelEvent.type == WheelEvent::MOUSE_WHEEL )
+  if( wheelEvent->GetType() == Dali::WheelEvent::MOUSE_WHEEL )
   {
     Dali::HitTestAlgorithm::Results hitTestResults;
     HitTestAlgorithm::HitTest( mScene.GetSize(), mScene.GetRenderTaskList(), mScene.GetLayerList(), event.point, hitTestResults, IsActorWheelableFunction );
@@ -147,7 +149,7 @@ void WheelEventProcessor::ProcessWheelEvent( const Integration::WheelEvent& even
                    hitTestResults.actorCoordinates.x, hitTestResults.actorCoordinates.y );
 
     // Recursively deliver events to the actor and its parents, until the event is consumed or the stage is reached.
-    Dali::Actor consumedActor = EmitWheelSignals( hitTestResults.actor, wheelEvent );
+    Dali::Actor consumedActor = EmitWheelSignals( hitTestResults.actor, wheelEventHandle );
 
     DALI_LOG_INFO( gLogFilter, Debug::Concise, "HitActor:      (%p) %s\n", hitTestResults.actor ? reinterpret_cast< void* >( &hitTestResults.actor.GetBaseObject() ) : NULL, hitTestResults.actor ? hitTestResults.actor.GetProperty< std::string >( Dali::Actor::Property::NAME ).c_str() : "" );
     DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? reinterpret_cast< void* >( &consumedActor.GetBaseObject() ) : NULL, consumedActor ? consumedActor.GetProperty< std::string >( Dali::Actor::Property::NAME ).c_str() : "" );
@@ -155,7 +157,7 @@ void WheelEventProcessor::ProcessWheelEvent( const Integration::WheelEvent& even
   else
   {
     // if CUSTOM_WHEEL, emit the wheel event signal from the scene.
-    mScene.EmitWheelEventSignal( wheelEvent );
+    mScene.EmitWheelEventSignal( wheelEventHandle );
   }
 }
 
index b8ca1e2..f748935 100644 (file)
@@ -55,6 +55,7 @@ SET( internal_src_files
   ${internal_src_dir}/event/events/hit-test-algorithm-impl.cpp
   ${internal_src_dir}/event/events/hover-event-impl.cpp
   ${internal_src_dir}/event/events/hover-event-processor.cpp
+  ${internal_src_dir}/event/events/wheel-event-impl.cpp
   ${internal_src_dir}/event/events/wheel-event-processor.cpp
   ${internal_src_dir}/event/events/multi-point-event-util.cpp
   ${internal_src_dir}/event/events/touch-event-impl.cpp
index 21ead2d..d556600 100644 (file)
@@ -51,7 +51,7 @@ class Quaternion;
 class Layer;
 class TouchEvent;
 class HoverEvent;
-struct WheelEvent;
+class WheelEvent;
 struct Vector2;
 struct Vector3;
 struct Vector4;
index c4eaeb1..aab7f0b 100644 (file)
@@ -46,7 +46,7 @@ class CustomActorImpl;
 class RelayoutContainer;
 struct KeyEvent;
 class HoverEvent;
-struct WheelEvent;
+class WheelEvent;
 struct Vector2;
 struct Vector3;
 
index 7494ef0..c6dd583 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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/wheel-event.h>
 
+// INTERNAL INCLUDES
+#include <dali/internal/event/events/wheel-event-impl.h>
+
 namespace Dali
 {
 
-namespace
+WheelEvent::WheelEvent()
+: BaseHandle()
 {
-const uint32_t MODIFIER_SHIFT = 0x1;
-const uint32_t MODIFIER_CTRL  = 0x2;
-const uint32_t MODIFIER_ALT   = 0x4;
+}
+
+WheelEvent::WheelEvent( const WheelEvent& rhs ) = default;
 
+WheelEvent::WheelEvent( WheelEvent&& rhs ) = default;
+
+WheelEvent::~WheelEvent()
+{
 }
 
-WheelEvent::WheelEvent()
-: type( MOUSE_WHEEL ),
-  direction( 0 ),
-  modifiers( 0 ),
-  point( Vector2::ZERO ),
-  z( 0 ),
-  timeStamp( 0 )
+WheelEvent& WheelEvent::operator=( const WheelEvent& rhs ) = default;
+
+WheelEvent& WheelEvent::operator=( WheelEvent&& rhs ) = default;
+
+bool WheelEvent::IsShiftModifier() const
 {
+  return GetImplementation( *this ).IsShiftModifier();
 }
 
-WheelEvent::WheelEvent( Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t z, uint32_t timeStamp )
-: type( type ),
-  direction( direction ),
-  modifiers( modifiers ),
-  point( point ),
-  z( z ),
-  timeStamp( timeStamp )
+bool WheelEvent::IsCtrlModifier() const
 {
+  return GetImplementation( *this ).IsCtrlModifier();
 }
 
-WheelEvent::~WheelEvent()
+bool WheelEvent::IsAltModifier() const
 {
+  return GetImplementation( *this ).IsAltModifier();
 }
 
-bool WheelEvent::IsShiftModifier() const
+WheelEvent::Type WheelEvent::GetType() const
 {
-  if ((MODIFIER_SHIFT & modifiers) == MODIFIER_SHIFT)
-  {
-    return true;
-  }
+  return GetImplementation( *this ).GetType();
+}
 
-  return false;
+int32_t WheelEvent::GetDirection() const
+{
+  return GetImplementation( *this ).GetDirection();
 }
 
-bool WheelEvent::IsCtrlModifier() const
+uint32_t WheelEvent::GetModifiers() const
 {
-  if ((MODIFIER_CTRL & modifiers) == MODIFIER_CTRL)
-  {
-    return true;
-  }
+  return GetImplementation( *this ).GetModifiers();
+}
 
-  return false;
+const Vector2& WheelEvent::GetPoint() const
+{
+  return GetImplementation( *this ).GetPoint();
 }
 
-bool WheelEvent::IsAltModifier() const
+int32_t WheelEvent::GetDelta() const
+{
+  return GetImplementation( *this ).GetDelta();
+}
+
+uint32_t WheelEvent::GetTime() const
 {
-  if ((MODIFIER_ALT & modifiers) == MODIFIER_ALT)
-  {
-    return true;
-  }
+  return GetImplementation( *this ).GetTime();
+}
 
-  return false;
+WheelEvent::WheelEvent( Internal::WheelEvent* internal )
+: BaseHandle( internal )
+{
 }
 
 } // namespace Dali
index 7e310ee..4e6a985 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_WHEEL_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.
 // INTERNAL INCLUDES
 #include <dali/public-api/common/dali-common.h>
 #include <dali/public-api/math/vector2.h>
-
+#include <dali/public-api/object/base-handle.h>
 
 namespace Dali
 {
+
+namespace Internal DALI_INTERNAL
+{
+class WheelEvent;
+}
+
 /**
  * @addtogroup dali_core_events
  * @{
  */
 
 /**
- * @brief The wheel event structure is used to store a wheel rolling, it facilitates
+ * @brief The wheel event class is used to store a wheel rolling, it facilitates
  * processing of the wheel rolling and passing to other libraries like Toolkit.
  *
  * There is a key modifier which relates to keys like alt, shift and control functions are
@@ -44,8 +50,11 @@ namespace Dali
  * The mouse wheel event can be sent to the specific actor but the custom wheel event will be sent to the stage.
  * @SINCE_1_0.0
  */
-struct DALI_CORE_API WheelEvent
+class DALI_CORE_API WheelEvent : public BaseHandle
 {
+
+public:
+
   // Enumerations
 
   /**
@@ -58,24 +67,31 @@ struct DALI_CORE_API WheelEvent
     CUSTOM_WHEEL      ///< Custom wheel event @SINCE_1_0.0
   };
 
+  // Construction & Destruction
+
   /**
-   * @brief Default constructor.
+   * @brief An uninitialized WheelEvent instance.
+   *
+   * Calling member functions with an uninitialized WheelEvent handle is not allowed.
    * @SINCE_1_0.0
    */
   WheelEvent();
 
   /**
-   * @brief Constructor.
+   * @brief Copy constructor.
    *
-   * @SINCE_1_0.0
-   * @param[in] type      The type of the wheel event
-   * @param[in] direction The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel)
-   * @param[in] modifiers Modifier keys pressed during the event (such as shift, alt and control)
-   * @param[in] point     The co-ordinates of the cursor relative to the top-left of the screen
-   * @param[in] z         The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise)
-   * @param[in] timeStamp The time the wheel is being rolled
+   * @SINCE_1_9.26
+   * @param[in] rhs The WheelEvent to copy from
    */
-  WheelEvent( Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t z, uint32_t timeStamp );
+  WheelEvent( const WheelEvent& rhs );
+
+  /**
+   * @brief Move constructor.
+   *
+   * @SINCE_1_9.26
+   * @param[in] rhs A reference to the moved WheelEvent
+   */
+  WheelEvent( WheelEvent&& rhs );
 
   /**
    * @brief Destructor.
@@ -84,6 +100,24 @@ struct DALI_CORE_API WheelEvent
   ~WheelEvent();
 
   /**
+   * @brief Copy assignment operator.
+   *
+   * @SINCE_1_9.26
+   * @param[in] rhs The WheelEvent to copy from
+   * @return A reference to this
+   */
+  WheelEvent& operator=( const WheelEvent& rhs );
+
+  /**
+   * @brief Move assignment operator.
+   *
+   * @SINCE_1_9.26
+   * @param[in] rhs A reference to the moved WheelEvent
+   * @return A reference to this
+   */
+  WheelEvent& operator=( WheelEvent&& rhs );
+
+  /**
    * @brief Checks to see if Shift key modifier has been supplied.
    *
    * @SINCE_1_0.0
@@ -107,44 +141,68 @@ struct DALI_CORE_API WheelEvent
    */
   bool IsAltModifier() const;
 
-  // Data
+  // Getters
 
   /**
-   * @brief Type of the event.
+   * @brief Get the type of the wheel event.
    *
-   * @see Type
+   * @SINCE_1_9.26
+   * @return The type of the wheel event
    */
-  Type type;
+  Type GetType() const;
 
   /**
-   * @brief The direction in which the wheel is being rolled.
+   * @brief Get the direction in which the wheel is being rolled.
    *
-   * 0 means the default vertical wheel, and 1 means horizontal wheel.
+   * @SINCE_1_9.26
+   * @return The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel)
    */
-  int32_t direction;
+  int32_t GetDirection() const;
 
   /**
-   * @brief Modifier keys pressed during the event (such as shift, alt and control).
+   * @brief Get the modifier keys pressed during the event (such as shift, alt and control).
+   *
+   * @SINCE_1_9.26
+   * @return The modifier keys pressed during the event
    */
-  uint32_t modifiers;
+  uint32_t GetModifiers() const;
 
   /**
-   * @brief The co-ordinates of the cursor relative to the top-left of the screen
+   * @brief Get the co-ordinates of the cursor relative to the top-left of the screen
    * when the wheel is being rolled.
+   *
+   * @SINCE_1_9.26
+   * @return The co-ordinates of the cursor relative to the top-left of the screen
    */
-  Vector2 point;
+  const Vector2& GetPoint() const;
 
   /**
-   * @brief The offset of the wheel rolling, where positive value means rolling down or clockwise
-   * and negative value means rolling up or counter-clockwise.
+   * @brief Get the offset of the wheel rolling
+   *
+   * @SINCE_1_9.26
+   * @return The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise)
    */
-  int32_t z;
+  int32_t GetDelta() const;
 
   /**
-   * @brief The time when the wheel is being rolled.
+   * @brief Get the time when the wheel is being rolled.
+   *
+   * @SINCE_1_9.26
+   * @return The time when the wheel is being rolled
    */
-  uint32_t timeStamp;
+  uint32_t GetTime() const;
+
+public: // Not intended for application developers
 
+  /// @cond internal
+  /**
+   * @brief This constructor is used internally to Create an initialized WheelEvent handle.
+   *
+   * @SINCE_1_9.26
+   * @param[in] wheelEvent A pointer to a newly allocated Dali resource
+   */
+  explicit DALI_INTERNAL WheelEvent( Internal::WheelEvent* hoverEvent );
+  /// @endcond
 };
 
 /**