From c16f2ac157730dfa3d28c448bf92a994e2afe975 Mon Sep 17 00:00:00 2001 From: Joogab Yun Date: Tue, 1 Sep 2020 16:55:39 +0900 Subject: [PATCH] Revert "WheelEvent class pimpling" This reverts commit 477f1464fef5c1ca028c7c23e9cd74b4a7a7965a. --- automated-tests/src/dali/utc-Dali-Scene.cpp | 24 +-- automated-tests/src/dali/utc-Dali-Stage.cpp | 24 +-- .../src/dali/utc-Dali-WheelEvent.cpp | 105 ++++++----- dali/devel-api/common/stage.h | 2 +- dali/devel-api/events/wheel-event-devel.cpp | 38 ---- dali/devel-api/events/wheel-event-devel.h | 49 ----- dali/devel-api/file.list | 2 - .../events/wheel-event-integ.cpp | 8 +- .../events/wheel-event-integ.h | 20 +-- dali/integration-api/scene.h | 2 +- dali/internal/event/actors/actor-impl.cpp | 2 +- dali/internal/event/actors/actor-impl.h | 4 +- dali/internal/event/common/scene-impl.cpp | 2 +- dali/internal/event/common/scene-impl.h | 2 +- .../event/events/wheel-event-impl.cpp | 111 ------------ dali/internal/event/events/wheel-event-impl.h | 168 ------------------ .../event/events/wheel-event-processor.cpp | 14 +- dali/internal/file.list | 1 - dali/public-api/actors/actor.h | 2 +- dali/public-api/actors/custom-actor-impl.h | 2 +- dali/public-api/events/wheel-event.cpp | 84 ++++----- dali/public-api/events/wheel-event.h | 118 ++++-------- 22 files changed, 177 insertions(+), 607 deletions(-) delete mode 100644 dali/devel-api/events/wheel-event-devel.cpp delete mode 100644 dali/devel-api/events/wheel-event-devel.h delete mode 100755 dali/internal/event/events/wheel-event-impl.cpp delete mode 100755 dali/internal/event/events/wheel-event-impl.h diff --git a/automated-tests/src/dali/utc-Dali-Scene.cpp b/automated-tests/src/dali/utc-Dali-Scene.cpp index 299bf9b46..2a72d807a 100644 --- a/automated-tests/src/dali/utc-Dali-Scene.cpp +++ b/automated-tests/src/dali/utc-Dali-Scene.cpp @@ -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.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() ); + 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 ); 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.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() ); + 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 ); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-Stage.cpp b/automated-tests/src/dali/utc-Dali-Stage.cpp index d1a644487..4131d4b79 100644 --- a/automated-tests/src/dali/utc-Dali-Stage.cpp +++ b/automated-tests/src/dali/utc-Dali-Stage.cpp @@ -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.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() ); + 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 ); 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.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() ); + 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 ); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-WheelEvent.cpp b/automated-tests/src/dali/utc-Dali-WheelEvent.cpp index dd9ea50e6..5d8d30330 100644 --- a/automated-tests/src/dali/utc-Dali-WheelEvent.cpp +++ b/automated-tests/src/dali/utc-Dali-WheelEvent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -19,7 +19,6 @@ #include #include #include -#include #include using namespace Dali; @@ -45,7 +44,13 @@ struct SignalData { functorCalled = false; - receivedWheelEvent.Reset(); + receivedWheelEvent.type = WheelEvent::MOUSE_WHEEL; + receivedWheelEvent.direction = 0; + receivedWheelEvent.modifiers = 0; + receivedWheelEvent.point = Vector2::ZERO; + receivedWheelEvent.z = 0; + receivedWheelEvent.timeStamp = 0; + wheeledActor.Reset(); } @@ -77,15 +82,14 @@ int UtcDaliWheelEventConstructor(void) { TestApplication application; // Reset all test adapter return codes - Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u ); - DALI_TEST_CHECK( event ); + WheelEvent event(WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); // coustruct a wheel event - 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 + 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 END_TEST; } @@ -94,10 +98,12 @@ int UtcDaliWheelEventIsShiftModifier(void) { TestApplication application; // Reset all test adapter return codes - Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u ); - DALI_TEST_CHECK( event ); + WheelEvent event; + DALI_TEST_EQUALS(0u, event.modifiers, TEST_LOCATION); + + event.modifiers = SHIFT_MODIFIER; // Set to Shift Modifier - DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetModifiers(), TEST_LOCATION); + DALI_TEST_EQUALS(SHIFT_MODIFIER, event.modifiers, TEST_LOCATION); // check able to set DALI_TEST_EQUALS(true, event.IsShiftModifier(), TEST_LOCATION); // check IsShiftModifier @@ -109,10 +115,12 @@ int UtcDaliWheelEventIsCtrlModifier(void) { TestApplication application; // Reset all test adapter return codes - Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, CTRL_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u ); - DALI_TEST_CHECK( event ); + WheelEvent event; + DALI_TEST_EQUALS(0u, event.modifiers, TEST_LOCATION); + + event.modifiers = CTRL_MODIFIER; // Set to Ctrl Modifier - DALI_TEST_EQUALS(CTRL_MODIFIER, event.GetModifiers(), TEST_LOCATION); + DALI_TEST_EQUALS(CTRL_MODIFIER, event.modifiers, TEST_LOCATION); // check able to set DALI_TEST_EQUALS(true, event.IsCtrlModifier(), TEST_LOCATION); // check IsCtrlModifier END_TEST; @@ -123,10 +131,12 @@ int UtcDaliWheelEventIsAltModifier(void) { TestApplication application; // Reset all test adapter return codes - Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, ALT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u ); - DALI_TEST_CHECK( event ); + WheelEvent event; + DALI_TEST_EQUALS(0u, event.modifiers, TEST_LOCATION); - DALI_TEST_EQUALS(ALT_MODIFIER, event.GetModifiers(), TEST_LOCATION); + event.modifiers = ALT_MODIFIER; // Set to Alt Modifier + + DALI_TEST_EQUALS(ALT_MODIFIER, event.modifiers, TEST_LOCATION); // check able to set DALI_TEST_EQUALS(true, event.IsAltModifier(), TEST_LOCATION); // IsAltModifier END_TEST; @@ -137,10 +147,9 @@ int UtcDaliWheelEventIsNotShiftModifier(void) { TestApplication application; // Reset all test adapter return codes - Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, CTRL_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u ); - DALI_TEST_CHECK( event ); + WheelEvent event(WheelEvent::MOUSE_WHEEL, 1, CTRL_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); - DALI_TEST_EQUALS(CTRL_MODIFIER, event.GetModifiers(), TEST_LOCATION); // check different modifier used + DALI_TEST_EQUALS(CTRL_MODIFIER, event.modifiers, TEST_LOCATION); // check different modifier used DALI_TEST_EQUALS(false, event.IsShiftModifier(), TEST_LOCATION); END_TEST; @@ -151,10 +160,9 @@ int UtcDaliWheelEventIsNotCtrlModifier(void) { TestApplication application; // Reset all test adapter return codes - Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, ALT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u ); - DALI_TEST_CHECK( event ); + WheelEvent event(WheelEvent::MOUSE_WHEEL, 1, ALT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); - DALI_TEST_EQUALS(ALT_MODIFIER, event.GetModifiers(), TEST_LOCATION); // check different modifier used + DALI_TEST_EQUALS(ALT_MODIFIER, event.modifiers, TEST_LOCATION); // check different modifier used DALI_TEST_EQUALS(false, event.IsCtrlModifier(), TEST_LOCATION); END_TEST; @@ -165,10 +173,9 @@ int UtcDaliWheelEventIsNotAltModifier(void) { TestApplication application; // Reset all test adapter return codes - Dali::WheelEvent event = DevelWheelEvent::New( Dali::WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2( 1.0f, 1.0f ), 1, 1000u ); - DALI_TEST_CHECK( event ); + WheelEvent event(WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); - DALI_TEST_EQUALS(SHIFT_MODIFIER, event.GetModifiers(), TEST_LOCATION); // check different modifier used + DALI_TEST_EQUALS(SHIFT_MODIFIER, event.modifiers, TEST_LOCATION); // check different modifier used DALI_TEST_EQUALS(false, event.IsAltModifier(), TEST_LOCATION); END_TEST; @@ -179,12 +186,12 @@ int UtcDaliWheelEventANDModifer(void) { TestApplication application; // Reset all test adapter return codes - 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 ); + WheelEvent event(WheelEvent::MOUSE_WHEEL, 1, SHIFT_AND_CTRL_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); DALI_TEST_EQUALS(true, 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); + event.modifiers = SHIFT_MODIFIER; + + DALI_TEST_EQUALS(false, event.IsCtrlModifier() && event.IsShiftModifier(), TEST_LOCATION); END_TEST; } @@ -193,12 +200,12 @@ int UtcDaliWheelEventORModifer(void) { TestApplication application; // Reset all test adapter return codes - 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 ); + WheelEvent event(WheelEvent::MOUSE_WHEEL, 1, SHIFT_AND_CTRL_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); DALI_TEST_EQUALS(true, 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); + event.modifiers = SHIFT_MODIFIER; + + DALI_TEST_EQUALS(false, event.IsCtrlModifier() && event.IsAltModifier(), TEST_LOCATION); END_TEST; } @@ -227,12 +234,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.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 + 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 data.Reset(); // Emit a wheel signal where the actor is not present, will hit the root actor though @@ -249,12 +256,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.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 + 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 // Remove actor from the scene application.GetScene().Remove( actor ); diff --git a/dali/devel-api/common/stage.h b/dali/devel-api/common/stage.h index 50ba0def5..743f38e1a 100644 --- a/dali/devel-api/common/stage.h +++ b/dali/devel-api/common/stage.h @@ -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 deleted file mode 100644 index 83ca780e5..000000000 --- a/dali/devel-api/events/wheel-event-devel.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 -#include - -namespace Dali -{ - -namespace DevelWheelEvent -{ - -WheelEvent New( WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp ) -{ - Internal::WheelEventPtr internal = Internal::WheelEvent::New( type, direction, modifiers, point, delta, timeStamp ); - - return WheelEvent( internal.Get() ); -} - -} // namespace DevelKeyEvent - -} // namespace Dali - diff --git a/dali/devel-api/events/wheel-event-devel.h b/dali/devel-api/events/wheel-event-devel.h deleted file mode 100644 index 36f9b79ba..000000000 --- a/dali/devel-api/events/wheel-event-devel.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef DALI_WHEEL_EVENT_DEVEL_H -#define DALI_WHEEL_EVENT_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 - -namespace Dali -{ - -namespace DevelWheelEvent -{ - -/** - * @brief Creates an initialized WheelEvent. - * - * @SINCE_1_9.26 - * @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 handle to a newly allocated Dali resource - */ -DALI_CORE_API WheelEvent New( WheelEvent::Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t delta, uint32_t timeStamp ); - - -} // namespace DevelWheelEvent - -} // namespace Dali - -#endif // DALI_WHEEL_EVENT_DEVEL_H diff --git a/dali/devel-api/file.list b/dali/devel-api/file.list index 5ae82c166..b3f5f4025 100644 --- a/dali/devel-api/file.list +++ b/dali/devel-api/file.list @@ -16,7 +16,6 @@ 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 @@ -72,7 +71,6 @@ 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 ) diff --git a/dali/integration-api/events/wheel-event-integ.cpp b/dali/integration-api/events/wheel-event-integ.cpp index cf0d7ab33..3f99995b7 100644 --- a/dali/integration-api/events/wheel-event-integ.cpp +++ b/dali/integration-api/events/wheel-event-integ.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * 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. @@ -30,18 +30,18 @@ WheelEvent::WheelEvent() direction( 0 ), modifiers( 0 ), point( Vector2::ZERO ), - delta( 0 ), + z( 0 ), timeStamp( 0 ) { } -WheelEvent::WheelEvent( Type type, int direction, unsigned int modifiers, Vector2 point, int delta, unsigned int timeStamp ) +WheelEvent::WheelEvent( Type type, int direction, unsigned int modifiers, Vector2 point, int z, unsigned int timeStamp ) : Event( Wheel ), type( type ), direction( direction ), modifiers( modifiers ), point( point ), - delta( delta ), + z( z ), timeStamp( timeStamp ) { } diff --git a/dali/integration-api/events/wheel-event-integ.h b/dali/integration-api/events/wheel-event-integ.h index eb47e2c34..cf23ffb85 100644 --- a/dali/integration-api/events/wheel-event-integ.h +++ b/dali/integration-api/events/wheel-event-integ.h @@ -2,7 +2,7 @@ #define DALI_INTEGRATION_WHEEL_EVENT_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -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] delta The offset of rolling (positive value means roll down, and negative value means roll up) + * @param[in] z 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 delta, unsigned int timeStamp ); + WheelEvent( Type type, int direction, unsigned int modifiers, Vector2 point, int z, unsigned int timeStamp ); /** * Virtual destructor @@ -73,32 +73,32 @@ struct DALI_CORE_API WheelEvent : public Event // Data /** - *@copydoc Dali::WheelEvent::GetType + *@copydoc Dali::WheelEvent::type */ Type type; /** - *@copydoc Dali::WheelEvent::GetDrection + *@copydoc Dali::WheelEvent::direction */ int direction; /** - *@copydoc Dali::WheelEvent::GetModifiers + *@copydoc Dali::WheelEvent::modifiers */ unsigned int modifiers; /** - *@copydoc Dali::WheelEvent::GetPoint + *@copydoc Dali::WheelEvent::point */ Vector2 point; /** - *@copydoc Dali::WheelEvent::GetDelta + *@copydoc Dali::WheelEvent::z */ - int delta; + int z; /** - *@copydoc Dali::WheelEvent::GetTime + *@copydoc Dali::WheelEvent::timeStamp */ unsigned int timeStamp; diff --git a/dali/integration-api/scene.h b/dali/integration-api/scene.h index 34c25b5d1..acd0daeb2 100755 --- a/dali/integration-api/scene.h +++ b/dali/integration-api/scene.h @@ -35,7 +35,7 @@ struct KeyEvent; class Layer; class RenderTaskList; class TouchEvent; -class WheelEvent; +struct WheelEvent; namespace Internal DALI_INTERNAL { diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp index 91f19d9bc..bd42ddc9c 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -1854,7 +1854,7 @@ bool Actor::EmitHoverEventSignal( const Dali::HoverEvent& event ) return consumed; } -bool Actor::EmitWheelEventSignal( const Dali::WheelEvent& event ) +bool Actor::EmitWheelEventSignal( const WheelEvent& event ) { bool consumed = false; diff --git a/dali/internal/event/actors/actor-impl.h b/dali/internal/event/actors/actor-impl.h index 699cbf8b2..d6065af45 100644 --- a/dali/internal/event/actors/actor-impl.h +++ b/dali/internal/event/actors/actor-impl.h @@ -44,7 +44,7 @@ namespace Dali struct KeyEvent; class TouchData; class TouchEvent; -class WheelEvent; +struct WheelEvent; namespace Internal { @@ -1422,7 +1422,7 @@ public: * @param[in] event The wheel event. * @return True if the event was consumed. */ - bool EmitWheelEventSignal( const Dali::WheelEvent& event ); + bool EmitWheelEventSignal( const WheelEvent& event ); /** * @brief Emits the visibility change signal for this actor and all its children. diff --git a/dali/internal/event/common/scene-impl.cpp b/dali/internal/event/common/scene-impl.cpp index 54301e192..22921d425 100755 --- a/dali/internal/event/common/scene-impl.cpp +++ b/dali/internal/event/common/scene-impl.cpp @@ -329,7 +329,7 @@ void Scene::EmitTouchedSignal( const Dali::TouchEvent& touch ) } } -void Scene::EmitWheelEventSignal(const Dali::WheelEvent& event) +void Scene::EmitWheelEventSignal(const WheelEvent& event) { if ( !mWheelEventSignal.Empty() ) { diff --git a/dali/internal/event/common/scene-impl.h b/dali/internal/event/common/scene-impl.h index 3a8a3b2b4..c7eb73971 100755 --- a/dali/internal/event/common/scene-impl.h +++ b/dali/internal/event/common/scene-impl.h @@ -263,7 +263,7 @@ public: * Used by the EventProcessor to emit wheel event signals. * @param[in] event The wheel event. */ - void EmitWheelEventSignal( const Dali::WheelEvent& event ); + void EmitWheelEventSignal( const 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 deleted file mode 100755 index 25087967d..000000000 --- a/dali/internal/event/events/wheel-event-impl.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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 - -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 deleted file mode 100755 index 91c8152e5..000000000 --- a/dali/internal/event/events/wheel-event-impl.h +++ /dev/null @@ -1,168 +0,0 @@ -#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 -#include - -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 diff --git a/dali/internal/event/events/wheel-event-processor.cpp b/dali/internal/event/events/wheel-event-processor.cpp index a5c93e81d..d2a764555 100644 --- a/dali/internal/event/events/wheel-event-processor.cpp +++ b/dali/internal/event/events/wheel-event-processor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 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,7 +26,6 @@ #include #include #include -#include namespace Dali { @@ -44,7 +43,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 Dali::WheelEvent& event ) +Dali::Actor EmitWheelSignals( Dali::Actor actor, const WheelEvent& event ) { Dali::Actor consumedActor; @@ -134,10 +133,9 @@ WheelEventProcessor::~WheelEventProcessor() void WheelEventProcessor::ProcessWheelEvent( const Integration::WheelEvent& event ) { - 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() ); + WheelEvent wheelEvent( static_cast< WheelEvent::Type >( event.type ), event.direction, event.modifiers, event.point, event.z, event.timeStamp ); - if( wheelEvent->GetType() == Dali::WheelEvent::MOUSE_WHEEL ) + if( wheelEvent.type == WheelEvent::MOUSE_WHEEL ) { Dali::HitTestAlgorithm::Results hitTestResults; HitTestAlgorithm::HitTest( mScene.GetSize(), mScene.GetRenderTaskList(), mScene.GetLayerList(), event.point, hitTestResults, IsActorWheelableFunction ); @@ -149,7 +147,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, wheelEventHandle ); + Dali::Actor consumedActor = EmitWheelSignals( hitTestResults.actor, wheelEvent ); 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() : "" ); @@ -157,7 +155,7 @@ void WheelEventProcessor::ProcessWheelEvent( const Integration::WheelEvent& even else { // if CUSTOM_WHEEL, emit the wheel event signal from the scene. - mScene.EmitWheelEventSignal( wheelEventHandle ); + mScene.EmitWheelEventSignal( wheelEvent ); } } diff --git a/dali/internal/file.list b/dali/internal/file.list index f74893571..b8ca1e2fa 100644 --- a/dali/internal/file.list +++ b/dali/internal/file.list @@ -55,7 +55,6 @@ 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 diff --git a/dali/public-api/actors/actor.h b/dali/public-api/actors/actor.h index 09de0d7c7..18d1c3d0e 100644 --- a/dali/public-api/actors/actor.h +++ b/dali/public-api/actors/actor.h @@ -51,7 +51,7 @@ class Quaternion; class Layer; class TouchEvent; class HoverEvent; -class WheelEvent; +struct WheelEvent; struct Vector2; struct Vector3; struct Vector4; diff --git a/dali/public-api/actors/custom-actor-impl.h b/dali/public-api/actors/custom-actor-impl.h index aab7f0b96..c4eaeb142 100644 --- a/dali/public-api/actors/custom-actor-impl.h +++ b/dali/public-api/actors/custom-actor-impl.h @@ -46,7 +46,7 @@ class CustomActorImpl; class RelayoutContainer; struct KeyEvent; class HoverEvent; -class WheelEvent; +struct WheelEvent; struct Vector2; struct Vector3; diff --git a/dali/public-api/events/wheel-event.cpp b/dali/public-api/events/wheel-event.cpp index c6dd583d6..7494ef02d 100644 --- a/dali/public-api/events/wheel-event.cpp +++ b/dali/public-api/events/wheel-event.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -18,77 +18,69 @@ // CLASS HEADER #include -// INTERNAL INCLUDES -#include - namespace Dali { -WheelEvent::WheelEvent() -: BaseHandle() +namespace { -} - -WheelEvent::WheelEvent( const WheelEvent& rhs ) = default; +const uint32_t MODIFIER_SHIFT = 0x1; +const uint32_t MODIFIER_CTRL = 0x2; +const uint32_t MODIFIER_ALT = 0x4; -WheelEvent::WheelEvent( WheelEvent&& rhs ) = default; - -WheelEvent::~WheelEvent() -{ -} - -WheelEvent& WheelEvent::operator=( const WheelEvent& rhs ) = default; - -WheelEvent& WheelEvent::operator=( WheelEvent&& rhs ) = default; - -bool WheelEvent::IsShiftModifier() const -{ - return GetImplementation( *this ).IsShiftModifier(); } -bool WheelEvent::IsCtrlModifier() const +WheelEvent::WheelEvent() +: type( MOUSE_WHEEL ), + direction( 0 ), + modifiers( 0 ), + point( Vector2::ZERO ), + z( 0 ), + timeStamp( 0 ) { - return GetImplementation( *this ).IsCtrlModifier(); } -bool WheelEvent::IsAltModifier() const +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 ) { - return GetImplementation( *this ).IsAltModifier(); } -WheelEvent::Type WheelEvent::GetType() const +WheelEvent::~WheelEvent() { - return GetImplementation( *this ).GetType(); } -int32_t WheelEvent::GetDirection() const +bool WheelEvent::IsShiftModifier() const { - return GetImplementation( *this ).GetDirection(); -} + if ((MODIFIER_SHIFT & modifiers) == MODIFIER_SHIFT) + { + return true; + } -uint32_t WheelEvent::GetModifiers() const -{ - return GetImplementation( *this ).GetModifiers(); + return false; } -const Vector2& WheelEvent::GetPoint() const +bool WheelEvent::IsCtrlModifier() const { - return GetImplementation( *this ).GetPoint(); -} + if ((MODIFIER_CTRL & modifiers) == MODIFIER_CTRL) + { + return true; + } -int32_t WheelEvent::GetDelta() const -{ - return GetImplementation( *this ).GetDelta(); + return false; } -uint32_t WheelEvent::GetTime() const +bool WheelEvent::IsAltModifier() const { - return GetImplementation( *this ).GetTime(); -} + if ((MODIFIER_ALT & modifiers) == MODIFIER_ALT) + { + return true; + } -WheelEvent::WheelEvent( Internal::WheelEvent* internal ) -: BaseHandle( internal ) -{ + return false; } } // namespace Dali diff --git a/dali/public-api/events/wheel-event.h b/dali/public-api/events/wheel-event.h index 4e6a9859c..7e310ee89 100644 --- a/dali/public-api/events/wheel-event.h +++ b/dali/public-api/events/wheel-event.h @@ -2,7 +2,7 @@ #define DALI_WHEEL_EVENT_H /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,23 +24,17 @@ // INTERNAL INCLUDES #include #include -#include -namespace Dali -{ -namespace Internal DALI_INTERNAL +namespace Dali { -class WheelEvent; -} - /** * @addtogroup dali_core_events * @{ */ /** - * @brief The wheel event class is used to store a wheel rolling, it facilitates + * @brief The wheel event structure 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 @@ -50,11 +44,8 @@ class WheelEvent; * 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 */ -class DALI_CORE_API WheelEvent : public BaseHandle +struct DALI_CORE_API WheelEvent { - -public: - // Enumerations /** @@ -67,31 +58,24 @@ public: CUSTOM_WHEEL ///< Custom wheel event @SINCE_1_0.0 }; - // Construction & Destruction - /** - * @brief An uninitialized WheelEvent instance. - * - * Calling member functions with an uninitialized WheelEvent handle is not allowed. + * @brief Default constructor. * @SINCE_1_0.0 */ WheelEvent(); /** - * @brief Copy constructor. + * @brief Constructor. * - * @SINCE_1_9.26 - * @param[in] rhs The WheelEvent to copy from - */ - WheelEvent( const WheelEvent& rhs ); - - /** - * @brief Move constructor. - * - * @SINCE_1_9.26 - * @param[in] rhs A reference to the moved WheelEvent + * @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 */ - WheelEvent( WheelEvent&& rhs ); + WheelEvent( Type type, int32_t direction, uint32_t modifiers, Vector2 point, int32_t z, uint32_t timeStamp ); /** * @brief Destructor. @@ -99,24 +83,6 @@ public: */ ~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. * @@ -141,68 +107,44 @@ public: */ bool IsAltModifier() const; - // Getters + // Data /** - * @brief Get the type of the wheel event. + * @brief Type of the event. * - * @SINCE_1_9.26 - * @return The type of the wheel event + * @see Type */ - Type GetType() const; + Type type; /** - * @brief Get the direction in which the wheel is being rolled. + * @brief The direction in which the wheel is being rolled. * - * @SINCE_1_9.26 - * @return The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel) + * 0 means the default vertical wheel, and 1 means horizontal wheel. */ - int32_t GetDirection() const; + int32_t direction; /** - * @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 + * @brief Modifier keys pressed during the event (such as shift, alt and control). */ - uint32_t GetModifiers() const; + uint32_t modifiers; /** - * @brief Get the co-ordinates of the cursor relative to the top-left of the screen + * @brief 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 */ - const Vector2& GetPoint() const; + Vector2 point; /** - * @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) + * @brief The offset of the wheel rolling, where positive value means rolling down or clockwise + * and negative value means rolling up or counter-clockwise. */ - int32_t GetDelta() const; + int32_t z; /** - * @brief Get the time when the wheel is being rolled. - * - * @SINCE_1_9.26 - * @return The time when the wheel is being rolled + * @brief The time when the wheel is being rolled. */ - uint32_t GetTime() const; - -public: // Not intended for application developers + uint32_t timeStamp; - /// @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 }; /** -- 2.34.1