From a1637dfc15bb3e701f612834d07bc474f0e0883c Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Fri, 29 May 2015 17:34:47 +0900 Subject: [PATCH] Change WheelEvent - Replace MouseWheelEvent with WheelEvent - Add custom wheel event type Change-Id: I6740fa5a1fe41475de488c117ff442dba39abdcb --- .../src/dali-internal/utc-Dali-Scripting.cpp | 2 +- automated-tests/src/dali/CMakeLists.txt | 2 +- automated-tests/src/dali/utc-Dali-CustomActor.cpp | 22 ++-- automated-tests/src/dali/utc-Dali-TypeRegistry.cpp | 2 +- ...MouseWheelEvent.cpp => utc-Dali-WheelEvent.cpp} | 114 +++++++++++---------- dali/integration-api/events/event.h | 2 +- ...wheel-event-integ.cpp => wheel-event-integ.cpp} | 34 +++--- ...use-wheel-event-integ.h => wheel-event-integ.h} | 49 ++++++--- dali/integration-api/file.list | 4 +- dali/internal/event/actors/actor-impl.cpp | 24 ++--- dali/internal/event/actors/actor-impl.h | 28 ++--- .../event/actors/custom-actor-internal.cpp | 2 +- dali/internal/event/actors/custom-actor-internal.h | 6 +- dali/internal/event/common/stage-impl.cpp | 23 ++++- dali/internal/event/common/stage-impl.h | 14 +++ dali/internal/event/events/event-processor.cpp | 14 +-- dali/internal/event/events/event-processor.h | 6 +- ...ent-processor.cpp => wheel-event-processor.cpp} | 63 +++++++----- ...l-event-processor.h => wheel-event-processor.h} | 32 +++--- dali/internal/file.list | 2 +- dali/public-api/actors/actor.cpp | 4 +- dali/public-api/actors/actor.h | 14 +-- dali/public-api/actors/custom-actor-impl.cpp | 4 +- dali/public-api/actors/custom-actor-impl.h | 16 +-- dali/public-api/common/stage.cpp | 5 + dali/public-api/common/stage.h | 24 ++++- dali/public-api/dali-core.h | 2 +- .../{mouse-wheel-event.cpp => wheel-event.cpp} | 36 ++++--- .../events/{mouse-wheel-event.h => wheel-event.h} | 60 +++++++---- dali/public-api/file.list | 4 +- 30 files changed, 359 insertions(+), 255 deletions(-) rename automated-tests/src/dali/{utc-Dali-MouseWheelEvent.cpp => utc-Dali-WheelEvent.cpp} (60%) rename dali/integration-api/events/{mouse-wheel-event-integ.cpp => wheel-event-integ.cpp} (59%) rename dali/integration-api/events/{mouse-wheel-event-integ.h => wheel-event-integ.h} (56%) rename dali/internal/event/events/{mouse-wheel-event-processor.cpp => wheel-event-processor.cpp} (52%) rename dali/internal/event/events/{mouse-wheel-event-processor.h => wheel-event-processor.h} (52%) rename dali/public-api/events/{mouse-wheel-event.cpp => wheel-event.cpp} (66%) rename dali/public-api/events/{mouse-wheel-event.h => wheel-event.h} (52%) diff --git a/automated-tests/src/dali-internal/utc-Dali-Scripting.cpp b/automated-tests/src/dali-internal/utc-Dali-Scripting.cpp index 981e506..682f5ca 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Scripting.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Scripting.cpp @@ -624,7 +624,7 @@ int UtcDaliScriptingNewActorNegative(void) map[ "signals" ] = Property::MAP; Actor handle = NewActor( map ); DALI_TEST_CHECK( handle ); - DALI_TEST_CHECK( !handle.MouseWheelEventSignal().GetConnectionCount() ); + DALI_TEST_CHECK( !handle.WheelEventSignal().GetConnectionCount() ); DALI_TEST_CHECK( !handle.OffStageSignal().GetConnectionCount() ); DALI_TEST_CHECK( !handle.OnStageSignal().GetConnectionCount() ); DALI_TEST_CHECK( !handle.TouchedSignal().GetConnectionCount() ); diff --git a/automated-tests/src/dali/CMakeLists.txt b/automated-tests/src/dali/CMakeLists.txt index 5bdc6fb..4bd48e4 100644 --- a/automated-tests/src/dali/CMakeLists.txt +++ b/automated-tests/src/dali/CMakeLists.txt @@ -38,7 +38,6 @@ SET(TC_SOURCES utc-Dali-MathUtils.cpp utc-Dali-Matrix.cpp utc-Dali-Matrix3.cpp - utc-Dali-MouseWheelEvent.cpp utc-Dali-NativeImage.cpp utc-Dali-NinePatchImages.cpp utc-Dali-ObjectRegistry.cpp @@ -75,6 +74,7 @@ SET(TC_SOURCES utc-Dali-Vector2.cpp utc-Dali-Vector3.cpp utc-Dali-Vector4.cpp + utc-Dali-WheelEvent.cpp ) LIST(APPEND TC_SOURCES diff --git a/automated-tests/src/dali/utc-Dali-CustomActor.cpp b/automated-tests/src/dali/utc-Dali-CustomActor.cpp index 44b15c7..fb8d631 100644 --- a/automated-tests/src/dali/utc-Dali-CustomActor.cpp +++ b/automated-tests/src/dali/utc-Dali-CustomActor.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include "dali-test-suite-utils/dali-test-suite-utils.h" @@ -57,7 +57,7 @@ struct TestCustomActor : public CustomActorImpl * Constructor */ TestCustomActor() - : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS | REQUIRES_MOUSE_WHEEL_EVENTS | REQUIRES_HOVER_EVENTS | DISABLE_SIZE_NEGOTIATION ) ), + : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS | REQUIRES_WHEEL_EVENTS | REQUIRES_HOVER_EVENTS | DISABLE_SIZE_NEGOTIATION ) ), mDaliProperty( Property::INVALID_INDEX ), mSizeSet( Vector3::ZERO ), mTargetSize( Vector3::ZERO ), @@ -66,7 +66,7 @@ struct TestCustomActor : public CustomActorImpl } TestCustomActor(bool nego) - : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS | REQUIRES_MOUSE_WHEEL_EVENTS | REQUIRES_HOVER_EVENTS ) ), + : CustomActorImpl( ActorFlags( REQUIRES_TOUCH_EVENTS | REQUIRES_WHEEL_EVENTS | REQUIRES_HOVER_EVENTS ) ), mDaliProperty( Property::INVALID_INDEX ), mSizeSet( Vector3::ZERO ), mTargetSize( Vector3::ZERO ), @@ -159,9 +159,9 @@ struct TestCustomActor : public CustomActorImpl AddToCallStacks("OnHoverEvent"); return true; } - virtual bool OnMouseWheelEvent(const MouseWheelEvent& event) + virtual bool OnWheelEvent(const WheelEvent& event) { - AddToCallStacks("OnMouseWheelEvent"); + AddToCallStacks("OnWheelEvent"); return true; } virtual bool OnKeyEvent(const KeyEvent& event) @@ -523,7 +523,7 @@ public: { return true; } - virtual bool OnMouseWheelEvent(const MouseWheelEvent& event) + virtual bool OnWheelEvent(const WheelEvent& event) { return true; } @@ -1697,10 +1697,10 @@ int UtcDaliCustomActorOnHoverEvent(void) END_TEST; } -int UtcDaliCustomActorOnMouseWheelEvent(void) +int UtcDaliCustomActorOnWheelEvent(void) { TestApplication application; - tet_infoline("Testing Dali::CustomActor::OnMouseWheelEvent()"); + tet_infoline("Testing Dali::CustomActor::OnWheelEvent()"); TestCustomActor custom = TestCustomActor::New(); DALI_TEST_EQUALS( 0, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); @@ -1717,13 +1717,13 @@ int UtcDaliCustomActorOnMouseWheelEvent(void) application.SendNotification(); application.Render(); - // simulate a mouse wheel event + // simulate a wheel event Vector2 screenCoordinates( 10.0f, 10.0f ); - Integration::MouseWheelEvent event(0, 0u, screenCoordinates, 1, 1000u); + Integration::WheelEvent event( Integration::WheelEvent::MOUSE_WHEEL, 0, 0u, screenCoordinates, 1, 1000u ); application.ProcessEvent( event ); DALI_TEST_EQUALS( 1, (int)(custom.GetMethodsCalled().size()), TEST_LOCATION ); - DALI_TEST_EQUALS( "OnMouseWheelEvent", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION ); + DALI_TEST_EQUALS( "OnWheelEvent", custom.GetMethodsCalled()[ 0 ], TEST_LOCATION ); END_TEST; } diff --git a/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp b/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp index 71e6cf8..49c8fc4 100644 --- a/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp +++ b/automated-tests/src/dali/utc-Dali-TypeRegistry.cpp @@ -228,7 +228,7 @@ struct MyTestCustomActor : public CustomActorImpl { return true; } - virtual bool OnMouseWheelEvent(const MouseWheelEvent& event) + virtual bool OnWheelEvent(const WheelEvent& event) { return true; } diff --git a/automated-tests/src/dali/utc-Dali-MouseWheelEvent.cpp b/automated-tests/src/dali/utc-Dali-WheelEvent.cpp similarity index 60% rename from automated-tests/src/dali/utc-Dali-MouseWheelEvent.cpp rename to automated-tests/src/dali/utc-Dali-WheelEvent.cpp index 796916b..9722454 100644 --- a/automated-tests/src/dali/utc-Dali-MouseWheelEvent.cpp +++ b/automated-tests/src/dali/utc-Dali-WheelEvent.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include using namespace Dali; @@ -44,30 +44,31 @@ struct SignalData { functorCalled = false; - receivedMouseWheelEvent.direction = 0; - receivedMouseWheelEvent.modifiers = 0; - receivedMouseWheelEvent.point = Vector2::ZERO; - receivedMouseWheelEvent.z = 0; - receivedMouseWheelEvent.timeStamp = 0; + receivedWheelEvent.type = WheelEvent::MOUSE_WHEEL; + receivedWheelEvent.direction = 0; + receivedWheelEvent.modifiers = 0; + receivedWheelEvent.point = Vector2::ZERO; + receivedWheelEvent.z = 0; + receivedWheelEvent.timeStamp = 0; - mouseWheeledActor.Reset(); + wheeledActor.Reset(); } bool functorCalled; - MouseWheelEvent receivedMouseWheelEvent; - Actor mouseWheeledActor; + WheelEvent receivedWheelEvent; + Actor wheeledActor; }; // Functor that sets the data when called -struct MouseWheelEventReceivedFunctor +struct WheelEventReceivedFunctor { - MouseWheelEventReceivedFunctor( SignalData& data ) : signalData( data ) { } + WheelEventReceivedFunctor( SignalData& data ) : signalData( data ) { } - bool operator()( Actor actor, const MouseWheelEvent& mouseWheelEvent ) + bool operator()( Actor actor, const WheelEvent& wheelEvent ) { signalData.functorCalled = true; - signalData.receivedMouseWheelEvent = mouseWheelEvent; - signalData.mouseWheeledActor = actor; + signalData.receivedWheelEvent = wheelEvent; + signalData.wheeledActor = actor; return true; } @@ -77,12 +78,13 @@ struct MouseWheelEventReceivedFunctor } // anonymous namespace -int UtcDaliMouseWheelEventConstructor(void) +int UtcDaliWheelEventConstructor(void) { TestApplication application; // Reset all test adapter return codes - MouseWheelEvent event(1, SHIFT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); // coustruct a mouse wheel event + WheelEvent event(WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); // coustruct a wheel 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 @@ -92,11 +94,11 @@ int UtcDaliMouseWheelEventConstructor(void) } // Positive test case for a method -int UtcDaliMouseWheelEventIsShiftModifier(void) +int UtcDaliWheelEventIsShiftModifier(void) { TestApplication application; // Reset all test adapter return codes - MouseWheelEvent event; + WheelEvent event; DALI_TEST_EQUALS(0u, event.modifiers, TEST_LOCATION); event.modifiers = SHIFT_MODIFIER; // Set to Shift Modifier @@ -109,11 +111,11 @@ int UtcDaliMouseWheelEventIsShiftModifier(void) } // Positive test case for a method -int UtcDaliMouseWheelEventIsCtrlModifier(void) +int UtcDaliWheelEventIsCtrlModifier(void) { TestApplication application; // Reset all test adapter return codes - MouseWheelEvent event; + WheelEvent event; DALI_TEST_EQUALS(0u, event.modifiers, TEST_LOCATION); event.modifiers = CTRL_MODIFIER; // Set to Ctrl Modifier @@ -125,11 +127,11 @@ int UtcDaliMouseWheelEventIsCtrlModifier(void) } // Positive test case for a method -int UtcDaliMouseWheelEventIsAltModifier(void) +int UtcDaliWheelEventIsAltModifier(void) { TestApplication application; // Reset all test adapter return codes - MouseWheelEvent event; + WheelEvent event; DALI_TEST_EQUALS(0u, event.modifiers, TEST_LOCATION); event.modifiers = ALT_MODIFIER; // Set to Alt Modifier @@ -141,11 +143,11 @@ int UtcDaliMouseWheelEventIsAltModifier(void) } // Positive fail test case for a method -int UtcDaliMouseWheelEventIsNotShiftModifier(void) +int UtcDaliWheelEventIsNotShiftModifier(void) { TestApplication application; // Reset all test adapter return codes - MouseWheelEvent event(1, CTRL_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); + WheelEvent event(WheelEvent::MOUSE_WHEEL, 1, CTRL_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); DALI_TEST_EQUALS(CTRL_MODIFIER, event.modifiers, TEST_LOCATION); // check different modifier used @@ -154,11 +156,11 @@ int UtcDaliMouseWheelEventIsNotShiftModifier(void) } // Positive fail test case for a method -int UtcDaliMouseWheelEventIsNotCtrlModifier(void) +int UtcDaliWheelEventIsNotCtrlModifier(void) { TestApplication application; // Reset all test adapter return codes - MouseWheelEvent event(1, ALT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); + WheelEvent event(WheelEvent::MOUSE_WHEEL, 1, ALT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); DALI_TEST_EQUALS(ALT_MODIFIER, event.modifiers, TEST_LOCATION); // check different modifier used @@ -167,11 +169,11 @@ int UtcDaliMouseWheelEventIsNotCtrlModifier(void) } // Positive fail test case for a method -int UtcDaliMouseWheelEventIsNotAltModifier(void) +int UtcDaliWheelEventIsNotAltModifier(void) { TestApplication application; // Reset all test adapter return codes - MouseWheelEvent event(1, SHIFT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); + WheelEvent event(WheelEvent::MOUSE_WHEEL, 1, SHIFT_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); DALI_TEST_EQUALS(SHIFT_MODIFIER, event.modifiers, TEST_LOCATION); // check different modifier used @@ -180,11 +182,11 @@ int UtcDaliMouseWheelEventIsNotAltModifier(void) } // Positive test case for a method -int UtcDaliMouseWheelEventANDModifer(void) +int UtcDaliWheelEventANDModifer(void) { TestApplication application; // Reset all test adapter return codes - MouseWheelEvent event(1, SHIFT_AND_CTRL_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); + 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); event.modifiers = SHIFT_MODIFIER; @@ -194,11 +196,11 @@ int UtcDaliMouseWheelEventANDModifer(void) } // Positive test case for a method -int UtcDaliMouseWheelEventORModifer(void) +int UtcDaliWheelEventORModifer(void) { TestApplication application; // Reset all test adapter return codes - MouseWheelEvent event(1, SHIFT_AND_CTRL_MODIFIER, Vector2(1.0f, 1.0f), 1, 1000u); + 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); event.modifiers = SHIFT_MODIFIER; @@ -207,7 +209,7 @@ int UtcDaliMouseWheelEventORModifer(void) END_TEST; } -int UtcDaliMouseWheelEventSignalling(void) +int UtcDaliWheelEventSignalling(void) { TestApplication application; // Reset all test adapter return codes @@ -220,44 +222,46 @@ int UtcDaliMouseWheelEventSignalling(void) application.SendNotification(); application.Render(); - // Connect to actor's mouse wheel event signal + // Connect to actor's wheel event signal SignalData data; - MouseWheelEventReceivedFunctor functor( data ); - actor.MouseWheelEventSignal().Connect( &application, functor ); + WheelEventReceivedFunctor functor( data ); + actor.WheelEventSignal().Connect( &application, functor ); Vector2 screenCoordinates( 10.0f, 10.0f ); - Integration::MouseWheelEvent event(0, SHIFT_MODIFIER, screenCoordinates, 1, 1000u); + Integration::WheelEvent event(Integration::WheelEvent::MOUSE_WHEEL, 0, SHIFT_MODIFIER, screenCoordinates, 1, 1000u); - // Emit a mouse wheel signal + // Emit a wheel signal application.ProcessEvent( event ); DALI_TEST_EQUALS( true, data.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( actor == data.mouseWheeledActor ); - DALI_TEST_EQUALS(0, data.receivedMouseWheelEvent.direction, TEST_LOCATION); // check direction - DALI_TEST_EQUALS(SHIFT_MODIFIER, data.receivedMouseWheelEvent.modifiers, TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(screenCoordinates, data.receivedMouseWheelEvent.point, TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(1, data.receivedMouseWheelEvent.z, TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(1000u, data.receivedMouseWheelEvent.timeStamp, TEST_LOCATION); // check modifier + 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 data.Reset(); - // Emit a mouse wheel signal where the actor is not present, will hit the root actor though + // Emit a wheel signal where the actor is not present, will hit the root actor though Actor rootActor( Stage::GetCurrent().GetRootLayer() ); - // Connect to root actor's mouse wheel event signal + // Connect to root actor's wheel event signal SignalData rootData; - MouseWheelEventReceivedFunctor rootFunctor( rootData ); // Consumes signal - rootActor.MouseWheelEventSignal().Connect( &application, rootFunctor ); + WheelEventReceivedFunctor rootFunctor( rootData ); // Consumes signal + rootActor.WheelEventSignal().Connect( &application, rootFunctor ); screenCoordinates.x = screenCoordinates.y = 300.0f; - Integration::MouseWheelEvent newEvent(0, SHIFT_MODIFIER, screenCoordinates, 1, 1000u); + Integration::WheelEvent newEvent(Integration::WheelEvent::MOUSE_WHEEL, 0, SHIFT_MODIFIER, screenCoordinates, 1, 1000u); application.ProcessEvent( newEvent ); DALI_TEST_EQUALS( false, data.functorCalled, TEST_LOCATION ); DALI_TEST_EQUALS( true, rootData.functorCalled, TEST_LOCATION ); - DALI_TEST_CHECK( rootActor == rootData.mouseWheeledActor ); - DALI_TEST_EQUALS(0, rootData.receivedMouseWheelEvent.direction, TEST_LOCATION); // check direction - DALI_TEST_EQUALS(SHIFT_MODIFIER, rootData.receivedMouseWheelEvent.modifiers, TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(screenCoordinates, rootData.receivedMouseWheelEvent.point, TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(1, rootData.receivedMouseWheelEvent.z, TEST_LOCATION); // check modifier - DALI_TEST_EQUALS(1000u, rootData.receivedMouseWheelEvent.timeStamp, TEST_LOCATION); // check modifier + 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 // Remove actor from stage Stage::GetCurrent().Remove( actor ); diff --git a/dali/integration-api/events/event.h b/dali/integration-api/events/event.h index 474dec0..66bd92d 100644 --- a/dali/integration-api/events/event.h +++ b/dali/integration-api/events/event.h @@ -47,7 +47,7 @@ struct Event Touch, ///< A touch event, when the user interacts with the screen. Key, ///< A key pressed event, from the virtual or external keyboard. Gesture, ///< A Gesture event has been detected. - MouseWheel, ///< A mouse wheel event, when the mouse wheel is being rolled from an external mouse. + Wheel, ///< A wheel event, when the wheel is being rolled from an external mouse. Hover ///< A hover event, when the user hovers above the screen. }; diff --git a/dali/integration-api/events/mouse-wheel-event-integ.cpp b/dali/integration-api/events/wheel-event-integ.cpp similarity index 59% rename from dali/integration-api/events/mouse-wheel-event-integ.cpp rename to dali/integration-api/events/wheel-event-integ.cpp index 4e71027..3f99995 100644 --- a/dali/integration-api/events/mouse-wheel-event-integ.cpp +++ b/dali/integration-api/events/wheel-event-integ.cpp @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include +#include namespace Dali { @@ -24,27 +24,29 @@ namespace Dali namespace Integration { -MouseWheelEvent::MouseWheelEvent() -: Event(MouseWheel), - direction(0), - modifiers(0), - point(Vector2::ZERO), - z(0), - timeStamp(0) +WheelEvent::WheelEvent() +: Event( Wheel ), + type( MOUSE_WHEEL ), + direction( 0 ), + modifiers( 0 ), + point( Vector2::ZERO ), + z( 0 ), + timeStamp( 0 ) { } -MouseWheelEvent::MouseWheelEvent(int direction, unsigned int modifiers, Vector2 point, int z, unsigned int timeStamp) -: Event(MouseWheel), - direction(direction), - modifiers(modifiers), - point(point), - z(z), - timeStamp(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 ), + z( z ), + timeStamp( timeStamp ) { } -MouseWheelEvent::~MouseWheelEvent() +WheelEvent::~WheelEvent() { } diff --git a/dali/integration-api/events/mouse-wheel-event-integ.h b/dali/integration-api/events/wheel-event-integ.h similarity index 56% rename from dali/integration-api/events/mouse-wheel-event-integ.h rename to dali/integration-api/events/wheel-event-integ.h index f4c57df..5b0e0b2 100644 --- a/dali/integration-api/events/mouse-wheel-event-integ.h +++ b/dali/integration-api/events/wheel-event-integ.h @@ -1,5 +1,5 @@ -#ifndef __DALI_INTEGRATION_MOUSE_WHEEL_EVENT_H__ -#define __DALI_INTEGRATION_MOUSE_WHEEL_EVENT_H__ +#ifndef __DALI_INTEGRATION_WHEEL_EVENT_H__ +#define __DALI_INTEGRATION_WHEEL_EVENT_H__ /* * Copyright (c) 2014 Samsung Electronics Co., Ltd. @@ -32,56 +32,73 @@ namespace Integration { /** - * An instance of this class should be used by the adaptor to send a mouse wheel event to + * An instance of this class should be used by the adaptor to send a wheel event to * the Dali core. * */ -struct MouseWheelEvent : public Event +struct WheelEvent : public Event { + // Enumerations + + /** + * @brief Specifies the type of the wheel event. + */ + enum Type + { + MOUSE_WHEEL, ///< Mouse wheel event + CUSTOM_WHEEL ///< Custom wheel event + }; + /** * Default Constructor */ - MouseWheelEvent(); + WheelEvent(); /** * Constructor - * @param[in] direction The direction of mouse wheel rolling (0 = default vertical wheel, 1 = horizontal wheel) + * @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 mouse cursor relative to the top-left of the screen. + * @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] timeStamp The time the mouse wheel is being rolled. + * @param[in] timeStamp The time the wheel is being rolled. */ - MouseWheelEvent(int direction, unsigned int modifiers, Vector2 point, int z, unsigned int timeStamp); + WheelEvent( Type type, int direction, unsigned int modifiers, Vector2 point, int z, unsigned int timeStamp ); /** * Virtual destructor */ - virtual ~MouseWheelEvent(); + virtual ~WheelEvent(); // Data /** - *@copydoc Dali::MouseWheelEvent::direction + *@copydoc Dali::WheelEvent::type + */ + Type type; + + /** + *@copydoc Dali::WheelEvent::direction */ int direction; /** - *@copydoc Dali::MouseWheelEvent::modifiers + *@copydoc Dali::WheelEvent::modifiers */ unsigned int modifiers; /** - *@copydoc Dali::MouseWheelEvent::point + *@copydoc Dali::WheelEvent::point */ Vector2 point; /** - *@copydoc Dali::MouseWheelEvent::z + *@copydoc Dali::WheelEvent::z */ int z; /** - *@copydoc Dali::MouseWheelEvent::timeStamp + *@copydoc Dali::WheelEvent::timeStamp */ unsigned int timeStamp; @@ -91,4 +108,4 @@ struct MouseWheelEvent : public Event } // namespace Dali -#endif // __DALI_INTEGRATION_MOUSE_WHEEL_EVENT_H__ +#endif // __DALI_INTEGRATION_WHEEL_EVENT_H__ diff --git a/dali/integration-api/file.list b/dali/integration-api/file.list index 374099f..4506bde 100644 --- a/dali/integration-api/file.list +++ b/dali/integration-api/file.list @@ -14,7 +14,7 @@ platform_abstraction_src_files = \ $(platform_abstraction_src_dir)/events/hover-event-integ.cpp \ $(platform_abstraction_src_dir)/events/key-event-integ.cpp \ $(platform_abstraction_src_dir)/events/long-press-gesture-event.cpp \ - $(platform_abstraction_src_dir)/events/mouse-wheel-event-integ.cpp \ + $(platform_abstraction_src_dir)/events/wheel-event-integ.cpp \ $(platform_abstraction_src_dir)/events/multi-point-event-integ.cpp \ $(platform_abstraction_src_dir)/events/pan-gesture-event.cpp \ $(platform_abstraction_src_dir)/events/pinch-gesture-event.cpp \ @@ -63,7 +63,7 @@ platform_abstraction_events_header_files = \ $(platform_abstraction_src_dir)/events/hover-event-integ.h \ $(platform_abstraction_src_dir)/events/key-event-integ.h \ $(platform_abstraction_src_dir)/events/long-press-gesture-event.h \ - $(platform_abstraction_src_dir)/events/mouse-wheel-event-integ.h \ + $(platform_abstraction_src_dir)/events/wheel-event-integ.h \ $(platform_abstraction_src_dir)/events/multi-point-event-integ.h \ $(platform_abstraction_src_dir)/events/pan-gesture-event.h \ $(platform_abstraction_src_dir)/events/pinch-gesture-event.h \ diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp index 530a43b..763f84a 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -239,7 +239,7 @@ DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX ) const char* const SIGNAL_TOUCHED = "touched"; const char* const SIGNAL_HOVERED = "hovered"; -const char* const SIGNAL_MOUSE_WHEEL_EVENT = "mouse-wheel-event"; +const char* const SIGNAL_WHEEL_EVENT = "wheel-event"; const char* const SIGNAL_ON_STAGE = "on-stage"; const char* const SIGNAL_OFF_STAGE = "off-stage"; @@ -2119,9 +2119,9 @@ bool Actor::GetHoverRequired() const return !mHoveredSignal.Empty() || mDerivedRequiresHover; } -bool Actor::GetMouseWheelEventRequired() const +bool Actor::GetWheelEventRequired() const { - return !mMouseWheelEventSignal.Empty() || mDerivedRequiresMouseWheelEvent; + return !mWheelEventSignal.Empty() || mDerivedRequiresWheelEvent; } bool Actor::IsHittable() const @@ -2183,20 +2183,20 @@ bool Actor::EmitHoverEventSignal( const HoverEvent& event ) return consumed; } -bool Actor::EmitMouseWheelEventSignal( const MouseWheelEvent& event ) +bool Actor::EmitWheelEventSignal( const WheelEvent& event ) { bool consumed = false; - if( !mMouseWheelEventSignal.Empty() ) + if( !mWheelEventSignal.Empty() ) { Dali::Actor handle( this ); - consumed = mMouseWheelEventSignal.Emit( handle, event ); + consumed = mWheelEventSignal.Emit( handle, event ); } if( !consumed ) { // Notification for derived classes - consumed = OnMouseWheelEvent( event ); + consumed = OnWheelEvent( event ); } return consumed; @@ -2212,9 +2212,9 @@ Dali::Actor::HoverSignalType& Actor::HoveredSignal() return mHoveredSignal; } -Dali::Actor::MouseWheelEventSignalType& Actor::MouseWheelEventSignal() +Dali::Actor::WheelEventSignalType& Actor::WheelEventSignal() { - return mMouseWheelEventSignal; + return mWheelEventSignal; } Dali::Actor::OnStageSignalType& Actor::OnStageSignal() @@ -2245,9 +2245,9 @@ bool Actor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tra { actor->HoveredSignal().Connect( tracker, functor ); } - else if( 0 == strcmp( signalName.c_str(), SIGNAL_MOUSE_WHEEL_EVENT ) ) + else if( 0 == strcmp( signalName.c_str(), SIGNAL_WHEEL_EVENT ) ) { - actor->MouseWheelEventSignal().Connect( tracker, functor ); + actor->WheelEventSignal().Connect( tracker, functor ); } else if( 0 == strcmp( signalName.c_str(), SIGNAL_ON_STAGE ) ) { @@ -2291,7 +2291,7 @@ Actor::Actor( DerivedType derivedType ) mKeyboardFocusable( false ), mDerivedRequiresTouch( false ), mDerivedRequiresHover( false ), - mDerivedRequiresMouseWheelEvent( false ), + mDerivedRequiresWheelEvent( false ), mOnStageSignalled( false ), mInsideOnSizeSet( false ), mInheritOrientation( true ), diff --git a/dali/internal/event/actors/actor-impl.h b/dali/internal/event/actors/actor-impl.h index 8e7108d..448a462 100644 --- a/dali/internal/event/actors/actor-impl.h +++ b/dali/internal/event/actors/actor-impl.h @@ -45,7 +45,7 @@ namespace Dali struct KeyEvent; struct TouchEvent; struct HoverEvent; -struct MouseWheelEvent; +struct WheelEvent; namespace Internal { @@ -1414,10 +1414,10 @@ public: bool GetHoverRequired() const; /** - * Query whether the application or derived actor type requires mouse wheel events. - * @return True if mouse wheel events are required. + * Query whether the application or derived actor type requires wheel events. + * @return True if wheel events are required. */ - bool GetMouseWheelEventRequired() const; + bool GetWheelEventRequired() const; /** * Query whether the actor is actually hittable. This method checks whether the actor is @@ -1461,11 +1461,11 @@ public: bool EmitHoverEventSignal( const HoverEvent& event ); /** - * Used by the EventProcessor to emit mouse wheel event signals. - * @param[in] event The mouse wheel event. + * Used by the EventProcessor to emit wheel event signals. + * @param[in] event The wheel event. * @return True if the event was consumed. */ - bool EmitMouseWheelEventSignal( const MouseWheelEvent& event ); + bool EmitWheelEventSignal( const WheelEvent& event ); /** * @copydoc Dali::Actor::TouchedSignal() @@ -1478,9 +1478,9 @@ public: Dali::Actor::HoverSignalType& HoveredSignal(); /** - * @copydoc Dali::Actor::MouseWheelEventSignal() + * @copydoc Dali::Actor::WheelEventSignal() */ - Dali::Actor::MouseWheelEventSignalType& MouseWheelEventSignal(); + Dali::Actor::WheelEventSignalType& WheelEventSignal(); /** * @copydoc Dali::Actor::OnStageSignal() @@ -1833,11 +1833,11 @@ private: /** * For use in derived classes. - * This is only called if the mouse wheel signal was not consumed. - * @param[in] event The mouse event. + * This is only called if the wheel signal was not consumed. + * @param[in] event The wheel event. * @return True if the event should be consumed. */ - virtual bool OnMouseWheelEvent( const MouseWheelEvent& event ) + virtual bool OnWheelEvent( const WheelEvent& event ) { return false; } @@ -1878,7 +1878,7 @@ protected: // Signals Dali::Actor::TouchSignalType mTouchedSignal; Dali::Actor::HoverSignalType mHoveredSignal; - Dali::Actor::MouseWheelEventSignalType mMouseWheelEventSignal; + Dali::Actor::WheelEventSignalType mWheelEventSignal; Dali::Actor::OnStageSignalType mOnStageSignal; Dali::Actor::OffStageSignalType mOffStageSignal; Dali::Actor::OnRelayoutSignalType mOnRelayoutSignal; @@ -1899,7 +1899,7 @@ protected: bool mKeyboardFocusable : 1; ///< Whether the actor should be focusable by keyboard navigation bool mDerivedRequiresTouch : 1; ///< Whether the derived actor type requires touch event signals bool mDerivedRequiresHover : 1; ///< Whether the derived actor type requires hover event signals - bool mDerivedRequiresMouseWheelEvent : 1; ///< Whether the derived actor type requires mouse wheel event signals + bool mDerivedRequiresWheelEvent : 1; ///< Whether the derived actor type requires wheel event signals bool mOnStageSignalled : 1; ///< Set to true before OnStageConnection signal is emitted, and false before OnStageDisconnection bool mInsideOnSizeSet : 1; ///< Whether we are inside OnSizeSet bool mInheritOrientation : 1; ///< Cached: Whether the parent's orientation should be inherited. diff --git a/dali/internal/event/actors/custom-actor-internal.cpp b/dali/internal/event/actors/custom-actor-internal.cpp index b0a12bf..acfd82c 100644 --- a/dali/internal/event/actors/custom-actor-internal.cpp +++ b/dali/internal/event/actors/custom-actor-internal.cpp @@ -41,7 +41,7 @@ CustomActor::CustomActor(CustomActorImpl& extension) { mDerivedRequiresTouch = extension.RequiresTouchEvents(); mDerivedRequiresHover = extension.RequiresHoverEvents(); - mDerivedRequiresMouseWheelEvent = extension.RequiresMouseWheelEvents(); + mDerivedRequiresWheelEvent = extension.RequiresWheelEvents(); SetRelayoutEnabled( extension.IsRelayoutEnabled() ); } diff --git a/dali/internal/event/actors/custom-actor-internal.h b/dali/internal/event/actors/custom-actor-internal.h index c195a27..ade7a27 100644 --- a/dali/internal/event/actors/custom-actor-internal.h +++ b/dali/internal/event/actors/custom-actor-internal.h @@ -151,11 +151,11 @@ private: } /** - * @copydoc Internal::Actor::OnMouseWheelEvent + * @copydoc Internal::Actor::OnWheelEvent */ - virtual bool OnMouseWheelEvent(const MouseWheelEvent& event) + virtual bool OnWheelEvent(const WheelEvent& event) { - return mImpl->OnMouseWheelEvent(event); + return mImpl->OnWheelEvent(event); } /** diff --git a/dali/internal/event/common/stage-impl.cpp b/dali/internal/event/common/stage-impl.cpp index 7d80c06..34deb3b 100644 --- a/dali/internal/event/common/stage-impl.cpp +++ b/dali/internal/event/common/stage-impl.cpp @@ -65,6 +65,7 @@ const float DEFAULT_STEREO_BASE( 65.0f ); const char* const SIGNAL_KEY_EVENT = "key-event"; const char* const SIGNAL_EVENT_PROCESSING_FINISHED = "event-processing-finished"; const char* const SIGNAL_TOUCHED = "touched"; +const char* const SIGNAL_WHEEL_EVENT = "wheel-event"; const char* const SIGNAL_CONTEXT_LOST = "context-lost"; const char* const SIGNAL_CONTEXT_REGAINED = "context-regained"; const char* const SIGNAL_SCENE_CREATED = "scene-created"; @@ -74,9 +75,10 @@ TypeRegistration mType( typeid(Dali::Stage), typeid(Dali::BaseHandle), NULL ); SignalConnectorType signalConnector1( mType, SIGNAL_KEY_EVENT, &Stage::DoConnectSignal ); SignalConnectorType signalConnector2( mType, SIGNAL_EVENT_PROCESSING_FINISHED, &Stage::DoConnectSignal ); SignalConnectorType signalConnector3( mType, SIGNAL_TOUCHED, &Stage::DoConnectSignal ); -SignalConnectorType signalConnector4( mType, SIGNAL_CONTEXT_LOST, &Stage::DoConnectSignal ); -SignalConnectorType signalConnector5( mType, SIGNAL_CONTEXT_REGAINED, &Stage::DoConnectSignal ); -SignalConnectorType signalConnector6( mType, SIGNAL_SCENE_CREATED, &Stage::DoConnectSignal ); +SignalConnectorType signalConnector4( mType, SIGNAL_WHEEL_EVENT, &Stage::DoConnectSignal ); +SignalConnectorType signalConnector5( mType, SIGNAL_CONTEXT_LOST, &Stage::DoConnectSignal ); +SignalConnectorType signalConnector6( mType, SIGNAL_CONTEXT_REGAINED, &Stage::DoConnectSignal ); +SignalConnectorType signalConnector7( mType, SIGNAL_SCENE_CREATED, &Stage::DoConnectSignal ); } // unnamed namespace @@ -535,6 +537,10 @@ bool Stage::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tra { stage->TouchedSignal().Connect( tracker, functor ); } + else if( 0 == strcmp( signalName.c_str(), SIGNAL_WHEEL_EVENT ) ) + { + stage->WheelEventSignal().Connect( tracker, functor ); + } else if( 0 == strcmp( signalName.c_str(), SIGNAL_CONTEXT_LOST ) ) { stage->ContextLostSignal().Connect( tracker, functor ); @@ -573,6 +579,12 @@ void Stage::EmitTouchedSignal( const TouchEvent& touch ) mTouchedSignal.Emit( touch ); } +void Stage::EmitWheelEventSignal(const WheelEvent& event) +{ + // Emit the wheel event signal when no actor in the stage has gained the wheel input focus + + mWheelEventSignal.Emit( event ); +} void Stage::EmitSceneCreatedSignal() { @@ -594,6 +606,11 @@ Dali::Stage::TouchedSignalType& Stage::TouchedSignal() return mTouchedSignal; } +Dali::Stage::WheelEventSignalType& Stage::WheelEventSignal() +{ + return mWheelEventSignal; +} + Dali::Stage::ContextStatusSignal& Stage::ContextLostSignal() { return mContextLostSignal; diff --git a/dali/internal/event/common/stage-impl.h b/dali/internal/event/common/stage-impl.h index 1c07cb8..fa16d70 100644 --- a/dali/internal/event/common/stage-impl.h +++ b/dali/internal/event/common/stage-impl.h @@ -337,6 +337,12 @@ public: void EmitTouchedSignal( const TouchEvent& touch ); /** + * Used by the EventProcessor to emit wheel event signals. + * @param[in] event The wheel event. + */ + void EmitWheelEventSignal( const WheelEvent& event ); + + /** * Emits the scene created. */ void EmitSceneCreatedSignal(); @@ -357,6 +363,11 @@ public: Dali::Stage::TouchedSignalType& TouchedSignal(); /** + * @copydoc Dali::Stage::WheelEventSignal() + */ + Dali::Stage::WheelEventSignalType& WheelEventSignal(); + + /** * @copydoc Dali::Stage::ContextLostSignal() */ Dali::Stage::ContextStatusSignal& ContextLostSignal(); @@ -497,6 +508,9 @@ private: // The touched signal Dali::Stage::TouchedSignalType mTouchedSignal; + // The wheel event signal + Dali::Stage::WheelEventSignalType mWheelEventSignal; + Dali::Stage::ContextStatusSignal mContextLostSignal; Dali::Stage::ContextStatusSignal mContextRegainedSignal; diff --git a/dali/internal/event/events/event-processor.cpp b/dali/internal/event/events/event-processor.cpp index 9d63a3c..560b48a 100644 --- a/dali/internal/event/events/event-processor.cpp +++ b/dali/internal/event/events/event-processor.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include @@ -47,7 +47,7 @@ namespace // unnamed namespace static const std::size_t MAX_MESSAGE_SIZE = std::max( sizeof(Integration::TouchEvent), std::max( sizeof(Integration::KeyEvent), - std::max( sizeof(Integration::MouseWheelEvent), sizeof(Integration::GestureEvent) ) ) ); + std::max( sizeof(Integration::WheelEvent), sizeof(Integration::GestureEvent) ) ) ); static const std::size_t INITIAL_MIN_CAPACITY = 4; @@ -60,7 +60,7 @@ EventProcessor::EventProcessor(Stage& stage, NotificationManager& /* notificatio mHoverEventProcessor(stage), mGestureEventProcessor(gestureEventProcessor), mKeyEventProcessor(stage), - mMouseWheelEventProcessor(stage), + mWheelEventProcessor(stage), mEventQueue0( INITIAL_BUFFER_SIZE ), mEventQueue1( INITIAL_BUFFER_SIZE ), mCurrentEventQueue( &mEventQueue0 ) @@ -127,9 +127,9 @@ void EventProcessor::QueueEvent( const Event& event ) break; } - case Event::MouseWheel: + case Event::Wheel: { - typedef Integration::MouseWheelEvent DerivedType; + typedef Integration::WheelEvent DerivedType; // Reserve some memory inside the message queue unsigned int* slot = mCurrentEventQueue->ReserveMessageSlot( sizeof( DerivedType ) ); @@ -238,9 +238,9 @@ void EventProcessor::ProcessEvents() break; } - case Event::MouseWheel: + case Event::Wheel: { - mMouseWheelEventProcessor.ProcessMouseWheelEvent( static_cast(*event) ); + mWheelEventProcessor.ProcessWheelEvent( static_cast(*event) ); break; } diff --git a/dali/internal/event/events/event-processor.h b/dali/internal/event/events/event-processor.h index 45ea643..bc5300e 100644 --- a/dali/internal/event/events/event-processor.h +++ b/dali/internal/event/events/event-processor.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include namespace Dali @@ -43,7 +43,7 @@ class NotificationManager; /** * The EventProcessor processes any events that are received by Dali. Such events include - * touch events, key events, mouse wheel events, and notification events. + * touch events, key events, wheel events, and notification events. * * When the EventProcessor receives an event, it determines its type and passes it on to the * appropriate processor. @@ -91,7 +91,7 @@ private: HoverEventProcessor mHoverEventProcessor; ///< Processes hover events. GestureEventProcessor& mGestureEventProcessor; ///< Processes gesture events. KeyEventProcessor mKeyEventProcessor; ///< Processes key events. - MouseWheelEventProcessor mMouseWheelEventProcessor; ///< Processes mouse wheel events. + WheelEventProcessor mWheelEventProcessor; ///< Processes wheel events. // Allow messages to be added safely to one queue, while processing (iterating through) the second queue. MessageBuffer mEventQueue0; ///< An event queue. diff --git a/dali/internal/event/events/mouse-wheel-event-processor.cpp b/dali/internal/event/events/wheel-event-processor.cpp similarity index 52% rename from dali/internal/event/events/mouse-wheel-event-processor.cpp rename to dali/internal/event/events/wheel-event-processor.cpp index a4de453..6d08325 100644 --- a/dali/internal/event/events/mouse-wheel-event-processor.cpp +++ b/dali/internal/event/events/wheel-event-processor.cpp @@ -16,13 +16,13 @@ */ // CLASS HEADER -#include +#include // INTERNAL INCLUDES -#include +#include #include #include -#include +#include #include #include @@ -36,13 +36,13 @@ namespace { #if defined(DEBUG_ENABLED) -Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_MOUSE_WHEEL_PROCESSOR"); +Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_WHEEL_PROCESSOR"); #endif /** * Recursively deliver events to the actor and its parents, until the event is consumed or the stage is reached. */ -Dali::Actor EmitMouseWheelSignals( Dali::Actor actor, const MouseWheelEvent& event ) +Dali::Actor EmitWheelSignals( Dali::Actor actor, const WheelEvent& event ) { Dali::Actor consumedActor; @@ -54,11 +54,11 @@ Dali::Actor EmitMouseWheelSignals( Dali::Actor actor, const MouseWheelEvent& eve bool consumed( false ); - // Only do the conversion and emit the signal if the actor's mouse wheel signal has connections. - if ( actorImpl.GetMouseWheelEventRequired() ) + // Only do the conversion and emit the signal if the actor's wheel signal has connections. + if ( actorImpl.GetWheelEventRequired() ) { // Emit the signal to the parent - consumed = actorImpl.EmitMouseWheelEventSignal( event ); + consumed = actorImpl.EmitWheelEventSignal( event ); } if ( consumed ) @@ -75,7 +75,7 @@ Dali::Actor EmitMouseWheelSignals( Dali::Actor actor, const MouseWheelEvent& eve (parent == oldParent) ) { // One of the actor's parents may consumed the event and they should be set as the consumed actor. - consumedActor = EmitMouseWheelSignals( parent, event ); + consumedActor = EmitWheelSignals( parent, event ); } } } @@ -84,9 +84,9 @@ Dali::Actor EmitMouseWheelSignals( Dali::Actor actor, const MouseWheelEvent& eve } /** - * The function to be used in the hit-test algorithm to check whether the actor is mouse wheelable. + * The function to be used in the hit-test algorithm to check whether the actor is wheelable. */ -bool IsActorMouseWheelableFunction(Dali::Actor actor, Dali::HitTestAlgorithm::TraverseType type) +bool IsActorWheelableFunction(Dali::Actor actor, Dali::HitTestAlgorithm::TraverseType type) { bool hittable = false; @@ -94,7 +94,7 @@ bool IsActorMouseWheelableFunction(Dali::Actor actor, Dali::HitTestAlgorithm::Tr { case Dali::HitTestAlgorithm::CHECK_ACTOR: { - if( GetImplementation(actor).GetMouseWheelEventRequired() && // Does the Application or derived actor type require a mouse wheel event? + if( GetImplementation(actor).GetWheelEventRequired() && // Does the Application or derived actor type require a wheel event? GetImplementation(actor).IsHittable() ) { hittable = true; @@ -121,35 +121,42 @@ bool IsActorMouseWheelableFunction(Dali::Actor actor, Dali::HitTestAlgorithm::Tr } // unnamed namespace -MouseWheelEventProcessor::MouseWheelEventProcessor(Stage& stage) +WheelEventProcessor::WheelEventProcessor(Stage& stage) : mStage(stage) { } -MouseWheelEventProcessor::~MouseWheelEventProcessor() +WheelEventProcessor::~WheelEventProcessor() { } -void MouseWheelEventProcessor::ProcessMouseWheelEvent(const Integration::MouseWheelEvent& event) +void WheelEventProcessor::ProcessWheelEvent(const Integration::WheelEvent& event) { Stage& stage = mStage; - MouseWheelEvent mouseWheelEvent( event.direction, event.modifiers, event.point, event.z, event.timeStamp ); + WheelEvent wheelEvent( static_cast< WheelEvent::Type >(event.type), event.direction, event.modifiers, event.point, event.z, event.timeStamp ); - HitTestAlgorithm::Results hitTestResults; - HitTestAlgorithm::HitTest( Dali::Stage(&stage), event.point, hitTestResults, IsActorMouseWheelableFunction ); - - DALI_LOG_INFO( gLogFilter, Debug::General, " Screen(%.0f, %.0f), HitActor(%p, %s), Local(%.2f, %.2f)\n", - event.point.x, event.point.y, - ( hitTestResults.actor ? (void*)&hitTestResults.actor.GetBaseObject() : NULL ), - ( hitTestResults.actor ? hitTestResults.actor.GetName().c_str() : "" ), - hitTestResults.actorCoordinates.x, hitTestResults.actorCoordinates.y ); + if( wheelEvent.type == WheelEvent::MOUSE_WHEEL ) + { + HitTestAlgorithm::Results hitTestResults; + HitTestAlgorithm::HitTest( Dali::Stage(&stage), event.point, hitTestResults, IsActorWheelableFunction ); - // Recursively deliver events to the actor and its parents, until the event is consumed or the stage is reached. - Dali::Actor consumedActor = EmitMouseWheelSignals( hitTestResults.actor, mouseWheelEvent ); + DALI_LOG_INFO( gLogFilter, Debug::General, " Screen(%.0f, %.0f), HitActor(%p, %s), Local(%.2f, %.2f)\n", + event.point.x, event.point.y, + ( hitTestResults.actor ? (void*)&hitTestResults.actor.GetBaseObject() : NULL ), + ( hitTestResults.actor ? hitTestResults.actor.GetName().c_str() : "" ), + hitTestResults.actorCoordinates.x, hitTestResults.actorCoordinates.y ); - DALI_LOG_INFO( gLogFilter, Debug::Concise, "HitActor: (%p) %s\n", hitTestResults.actor ? (void*)&hitTestResults.actor.GetBaseObject() : NULL, hitTestResults.actor ? hitTestResults.actor.GetName().c_str() : "" ); - DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? (void*)&consumedActor.GetBaseObject() : NULL, consumedActor ? consumedActor.GetName().c_str() : "" ); + // 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_LOG_INFO( gLogFilter, Debug::Concise, "HitActor: (%p) %s\n", hitTestResults.actor ? (void*)&hitTestResults.actor.GetBaseObject() : NULL, hitTestResults.actor ? hitTestResults.actor.GetName().c_str() : "" ); + DALI_LOG_INFO( gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? (void*)&consumedActor.GetBaseObject() : NULL, consumedActor ? consumedActor.GetName().c_str() : "" ); + } + else + { + // if CUSTOM_WHEEL, emit the key event signal from stage. + mStage.EmitWheelEventSignal( wheelEvent ); + } } } // namespace Internal diff --git a/dali/internal/event/events/mouse-wheel-event-processor.h b/dali/internal/event/events/wheel-event-processor.h similarity index 52% rename from dali/internal/event/events/mouse-wheel-event-processor.h rename to dali/internal/event/events/wheel-event-processor.h index eca6d53..bc26322 100644 --- a/dali/internal/event/events/mouse-wheel-event-processor.h +++ b/dali/internal/event/events/wheel-event-processor.h @@ -1,5 +1,5 @@ -#ifndef __DALI_INTERNAL_MOUSE_WHEEL_EVENT_PROCESSOR_H__ -#define __DALI_INTERNAL_MOUSE_WHEEL_EVENT_PROCESSOR_H__ +#ifndef __DALI_INTERNAL_WHEEL_EVENT_PROCESSOR_H__ +#define __DALI_INTERNAL_WHEEL_EVENT_PROCESSOR_H__ /* * Copyright (c) 2014 Samsung Electronics Co., Ltd. @@ -23,7 +23,7 @@ namespace Dali namespace Integration { -struct MouseWheelEvent; +struct WheelEvent; } namespace Internal @@ -32,48 +32,48 @@ namespace Internal class Stage; /** - * MouseWheelEventProcessor receives the mouse wheel events from the Dali Event processor. + * WheelEventProcessor receives the wheel events from the Dali Event processor. * - * When a mouse wheel event is received the MouseWheelEvent Processor emits the MouseWheeled signal + * When a wheel event is received the WheelEvent Processor emits the Wheeled signal * on the hit actor (and its parents). * * - Hit Testing is described in Dali::Actor. */ -class MouseWheelEventProcessor +class WheelEventProcessor { public: /** - * Create a Mouse wheel event processor. + * Create a wheel event processor. */ - MouseWheelEventProcessor(Stage& stage); + WheelEventProcessor(Stage& stage); /** - * Non-virtual destructor; MouseWheelEventProcessor is not a base class + * Non-virtual destructor; WheelEventProcessor is not a base class */ - ~MouseWheelEventProcessor(); + ~WheelEventProcessor(); /** * This function is called by the event processor whenever a nouse wheel event occurs. - * @param[in] event The mouse wheel event that has occurred. + * @param[in] event The wheel event that has occurred. */ - void ProcessMouseWheelEvent(const Integration::MouseWheelEvent& event); + void ProcessWheelEvent(const Integration::WheelEvent& event); private: // Undefined - MouseWheelEventProcessor(const MouseWheelEventProcessor&); + WheelEventProcessor(const WheelEventProcessor&); // Undefined - MouseWheelEventProcessor& operator=(const MouseWheelEventProcessor& rhs); + WheelEventProcessor& operator=(const WheelEventProcessor& rhs); private: - Stage& mStage; ///< Used to deliver the mouse wheel events + Stage& mStage; ///< Used to deliver the wheel events }; } // namespace Internal } // namespace Dali -#endif // __DALI_INTERNAL_MOUSE_WHEEL_EVENT_PROCESSOR_H__ +#endif // __DALI_INTERNAL_WHEEL_EVENT_PROCESSOR_H__ diff --git a/dali/internal/file.list b/dali/internal/file.list index 46f58f3..c9d3df4 100644 --- a/dali/internal/file.list +++ b/dali/internal/file.list @@ -57,7 +57,7 @@ internal_src_files = \ $(internal_src_dir)/event/events/hover-event-processor.cpp \ $(internal_src_dir)/event/events/long-press-gesture-detector-impl.cpp \ $(internal_src_dir)/event/events/long-press-gesture-processor.cpp \ - $(internal_src_dir)/event/events/mouse-wheel-event-processor.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/pan-gesture-detector-impl.cpp \ $(internal_src_dir)/event/events/pan-gesture-processor.cpp \ diff --git a/dali/public-api/actors/actor.cpp b/dali/public-api/actors/actor.cpp index 0cdc19a..38d0e75 100644 --- a/dali/public-api/actors/actor.cpp +++ b/dali/public-api/actors/actor.cpp @@ -543,9 +543,9 @@ Actor::HoverSignalType& Actor::HoveredSignal() return GetImplementation(*this).HoveredSignal(); } -Actor::MouseWheelEventSignalType& Actor::MouseWheelEventSignal() +Actor::WheelEventSignalType& Actor::WheelEventSignal() { - return GetImplementation(*this).MouseWheelEventSignal(); + return GetImplementation(*this).WheelEventSignal(); } Actor::OnStageSignalType& Actor::OnStageSignal() diff --git a/dali/public-api/actors/actor.h b/dali/public-api/actors/actor.h index 8a9cadd..1d6035b 100644 --- a/dali/public-api/actors/actor.h +++ b/dali/public-api/actors/actor.h @@ -44,7 +44,7 @@ class Layer; struct KeyEvent; struct TouchEvent; struct HoverEvent; -struct MouseWheelEvent; +struct WheelEvent; struct Vector2; struct Vector3; struct Vector4; @@ -223,7 +223,7 @@ typedef Rect Padding; ///< Padding definition * |-------------------|------------------------------| * | touched | @ref TouchedSignal() | * | hovered | @ref HoveredSignal() | - * | mouse-wheel-event | @ref MouseWheelEventSignal() | + * | wheel-event | @ref WheelEventSignal() | * | on-stage | @ref OnStageSignal() | * | off-stage | @ref OffStageSignal() | * @@ -303,7 +303,7 @@ public: typedef Signal< bool (Actor, const TouchEvent&)> TouchSignalType; ///< Touch signal type typedef Signal< bool (Actor, const HoverEvent&)> HoverSignalType; ///< Hover signal type - typedef Signal< bool (Actor, const MouseWheelEvent&) > MouseWheelEventSignalType; ///< Mousewheel signal type + typedef Signal< bool (Actor, const WheelEvent&) > WheelEventSignalType; ///< Wheel signal type typedef Signal< void (Actor) > OnStageSignalType; ///< Stage connection signal type typedef Signal< void (Actor) > OffStageSignalType; ///< Stage disconnection signal type typedef Signal< void (Actor) > OnRelayoutSignalType; ///< Called when the actor is relaid out @@ -1291,18 +1291,18 @@ public: // Signals HoverSignalType& HoveredSignal(); /** - * @brief This signal is emitted when mouse wheel event is received. + * @brief This signal is emitted when wheel event is received. * * A callback of the following type may be connected: * @code - * bool YourCallbackName(Actor actor, const MouseWheelEvent& event); + * bool YourCallbackName(Actor actor, const WheelEvent& event); * @endcode - * The return value of True, indicates that the mouse wheel event should be consumed. + * The return value of True, indicates that the wheel event should be consumed. * Otherwise the signal will be emitted on the next sensitive parent of the actor. * @pre The Actor has been initialized. * @return The signal to connect to. */ - MouseWheelEventSignalType& MouseWheelEventSignal(); + WheelEventSignalType& WheelEventSignal(); /** * @brief This signal is emitted after the actor has been connected to the stage. diff --git a/dali/public-api/actors/custom-actor-impl.cpp b/dali/public-api/actors/custom-actor-impl.cpp index f084c96..08022ba 100644 --- a/dali/public-api/actors/custom-actor-impl.cpp +++ b/dali/public-api/actors/custom-actor-impl.cpp @@ -66,9 +66,9 @@ bool CustomActorImpl::RequiresHoverEvents() const return ( mFlags & REQUIRES_HOVER_EVENTS ); } -bool CustomActorImpl::RequiresMouseWheelEvents() const +bool CustomActorImpl::RequiresWheelEvents() const { - return ( mFlags & REQUIRES_MOUSE_WHEEL_EVENTS ); + return ( mFlags & REQUIRES_WHEEL_EVENTS ); } bool CustomActorImpl::IsRelayoutEnabled() const diff --git a/dali/public-api/actors/custom-actor-impl.h b/dali/public-api/actors/custom-actor-impl.h index c29d1cb..32cf1b5 100644 --- a/dali/public-api/actors/custom-actor-impl.h +++ b/dali/public-api/actors/custom-actor-impl.h @@ -40,7 +40,7 @@ class RelayoutContainer; struct KeyEvent; struct TouchEvent; struct HoverEvent; -struct MouseWheelEvent; +struct WheelEvent; struct Vector2; struct Vector3; @@ -175,13 +175,13 @@ public: virtual bool OnKeyEvent(const KeyEvent& event) = 0; /** - * @brief Called after a mouse-wheel-event is received by the owning actor. + * @brief Called after a wheel-event is received by the owning actor. * - * @note This must be enabled during construction; see CustomActorImpl::SetRequiresMouseWheelEvents(bool) - * @param[in] event The mouse wheel event. + * @note This must be enabled during construction; see CustomActorImpl::SetRequiresWheelEvents(bool) + * @param[in] event The wheel event. * @return True if the event should be consumed. */ - virtual bool OnMouseWheelEvent(const MouseWheelEvent& event) = 0; + virtual bool OnWheelEvent(const WheelEvent& event) = 0; /** * @brief Called after the size negotiation has been finished for this control. @@ -289,7 +289,7 @@ protected: // For derived classes DISABLE_SIZE_NEGOTIATION = 1 << 0, ///< True if control does not need size negotiation, i.e. it can be skipped in the algorithm REQUIRES_TOUCH_EVENTS = 1 << 1, ///< True if the OnTouchEvent() callback is required. REQUIRES_HOVER_EVENTS = 1 << 2, ///< True if the OnHoverEvent() callback is required. - REQUIRES_MOUSE_WHEEL_EVENTS = 1 << 3, ///< True if the OnMouseWheelEvent() callback is required. + REQUIRES_WHEEL_EVENTS = 1 << 3, ///< True if the OnWheelEvent() callback is required. LAST_ACTOR_FLAG ///< Special marker for last actor flag }; @@ -380,9 +380,9 @@ public: // Not intended for application developers /** * @brief Called when ownership of the CustomActorImpl is passed to a CustomActor. - * @return True if the OnMouseWheelEvent() callback is required. + * @return True if the OnWheelEvent() callback is required. */ - bool RequiresMouseWheelEvents() const; + bool RequiresWheelEvents() const; /** * @brief Called when ownership of the CustomActorImpl is passed to a CustomActor. diff --git a/dali/public-api/common/stage.cpp b/dali/public-api/common/stage.cpp index 01f037b..abf0b11 100644 --- a/dali/public-api/common/stage.cpp +++ b/dali/public-api/common/stage.cpp @@ -183,6 +183,11 @@ Stage::TouchedSignalType& Stage::TouchedSignal() return GetImplementation(*this).TouchedSignal(); } +Stage::WheelEventSignalType& Stage::WheelEventSignal() +{ + return GetImplementation(*this).WheelEventSignal(); +} + Stage::ContextStatusSignal& Stage::ContextLostSignal() { return GetImplementation(*this).ContextLostSignal(); diff --git a/dali/public-api/common/stage.h b/dali/public-api/common/stage.h index c9fb03a..5ea7d94 100644 --- a/dali/public-api/common/stage.h +++ b/dali/public-api/common/stage.h @@ -41,6 +41,7 @@ class DynamicsWorld; class DynamicsWorldConfig; struct KeyEvent; struct TouchEvent; +struct WheelEvent; /** * @brief The Stage is a top-level object used for displaying a tree of Actors. @@ -53,6 +54,7 @@ struct TouchEvent; * | key-event | @ref KeyEventSignal() | * | event-processing-finished | @ref EventProcessingFinishedSignal() | * | touched | @ref TouchedSignal() | + * | wheel-event | @ref WheelEventSignal() | * | context-lost | @ref ContextLostSignal() | * | context-regained | @ref ContextRegainedSignal() | * | scene-created | @ref SceneCreatedSignal() | @@ -61,11 +63,12 @@ class DALI_IMPORT_API Stage : public BaseHandle { public: - typedef Signal< void (const KeyEvent&)> KeyEventSignalType; ///< Key event signal type - typedef Signal< void () > EventProcessingFinishedSignalType; ///< Event Processing finished signal type - typedef Signal< void (const TouchEvent&)> TouchedSignalType; ///< Touched signal type - typedef Signal< void () > ContextStatusSignal; ///< Context status signal type - typedef Signal< void () > SceneCreatedSignalType; ///< Scene created signal type + typedef Signal< void (const KeyEvent&)> KeyEventSignalType; ///< Key event signal type + typedef Signal< void () > EventProcessingFinishedSignalType; ///< Event Processing finished signal type + typedef Signal< void (const TouchEvent&)> TouchedSignalType; ///< Touched signal type + typedef Signal< void (const WheelEvent&)> WheelEventSignalType; ///< Touched signal type + typedef Signal< void () > ContextStatusSignal; ///< Context status signal type + typedef Signal< void () > SceneCreatedSignalType; ///< Scene created signal type static const Vector4 DEFAULT_BACKGROUND_COLOR; ///< Default black background. static const Vector4 DEBUG_BACKGROUND_COLOR; ///< Green background, useful when debugging. @@ -287,6 +290,17 @@ public: TouchedSignalType& TouchedSignal(); /** + * @brief This signal is emitted when wheel event is received. + * + * A callback of the following type may be connected: + * @code + * void YourCallbackName(const WheelEvent& event); + * @endcode + * @return The signal to connect to. + */ + WheelEventSignalType& WheelEventSignal(); + + /** * @brief This signal is emitted when the GL context is lost (Platform specific behaviour). * * If the application is responsible for handling context loss, it should listen to diff --git a/dali/public-api/dali-core.h b/dali/public-api/dali-core.h index fd4ca80..c406b6d 100644 --- a/dali/public-api/dali-core.h +++ b/dali/public-api/dali-core.h @@ -56,7 +56,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/dali/public-api/events/mouse-wheel-event.cpp b/dali/public-api/events/wheel-event.cpp similarity index 66% rename from dali/public-api/events/mouse-wheel-event.cpp rename to dali/public-api/events/wheel-event.cpp index 9c991df..5bbb271 100644 --- a/dali/public-api/events/mouse-wheel-event.cpp +++ b/dali/public-api/events/wheel-event.cpp @@ -16,7 +16,7 @@ */ // CLASS HEADER -#include +#include namespace Dali { @@ -29,29 +29,31 @@ const unsigned int MODIFIER_ALT = 0x4; } -MouseWheelEvent::MouseWheelEvent() -: direction(0), - modifiers(0), - point(Vector2::ZERO), - z(0), - timeStamp(0) +WheelEvent::WheelEvent() +: type( MOUSE_WHEEL ), + direction( 0 ), + modifiers( 0 ), + point( Vector2::ZERO ), + z( 0 ), + timeStamp( 0 ) { } -MouseWheelEvent::MouseWheelEvent(int direction, unsigned int modifiers, Vector2 point, int z, unsigned int timeStamp) -: direction(direction), - modifiers(modifiers), - point(point), - z(z), - timeStamp(timeStamp) +WheelEvent::WheelEvent( Type type, int direction, unsigned int modifiers, Vector2 point, int z, unsigned int timeStamp ) +: type( type ), + direction( direction ), + modifiers( modifiers ), + point( point ), + z( z ), + timeStamp( timeStamp ) { } -MouseWheelEvent::~MouseWheelEvent() +WheelEvent::~WheelEvent() { } -bool MouseWheelEvent::IsShiftModifier() const +bool WheelEvent::IsShiftModifier() const { if ((MODIFIER_SHIFT & modifiers) == MODIFIER_SHIFT) { @@ -61,7 +63,7 @@ bool MouseWheelEvent::IsShiftModifier() const return false; } -bool MouseWheelEvent::IsCtrlModifier() const +bool WheelEvent::IsCtrlModifier() const { if ((MODIFIER_CTRL & modifiers) == MODIFIER_CTRL) { @@ -71,7 +73,7 @@ bool MouseWheelEvent::IsCtrlModifier() const return false; } -bool MouseWheelEvent::IsAltModifier() const +bool WheelEvent::IsAltModifier() const { if ((MODIFIER_ALT & modifiers) == MODIFIER_ALT) { diff --git a/dali/public-api/events/mouse-wheel-event.h b/dali/public-api/events/wheel-event.h similarity index 52% rename from dali/public-api/events/mouse-wheel-event.h rename to dali/public-api/events/wheel-event.h index 984e84d..7fb4c45 100644 --- a/dali/public-api/events/mouse-wheel-event.h +++ b/dali/public-api/events/wheel-event.h @@ -1,5 +1,5 @@ -#ifndef __DALI_MOUSE_WHEEL_EVENT_H__ -#define __DALI_MOUSE_WHEEL_EVENT_H__ +#ifndef __DALI_WHEEL_EVENT_H__ +#define __DALI_WHEEL_EVENT_H__ /* * Copyright (c) 2015 Samsung Electronics Co., Ltd. @@ -27,34 +27,49 @@ namespace Dali { /** - * @brief The mouse wheel event structure is used to store a mouse wheel rolling, it facilitates - * processing of the mouse wheel rolling and passing to other libraries like Toolkit. + * @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 - * supplied to check if they have been pressed when the mouse wheel is being rolled. + * supplied to check if they have been pressed when the wheel is being rolled. + * + * We support a mouse device and there may be another custom device that support the wheel event. The device type is specified as \e type. + * The mouse wheel event can be sent to the specific actor but the custom wheel event will be sent to the stage. */ -struct DALI_IMPORT_API MouseWheelEvent +struct DALI_IMPORT_API WheelEvent { + // Enumerations + + /** + * @brief Specifies the type of the wheel event. + */ + enum Type + { + MOUSE_WHEEL, ///< Mouse wheel event + CUSTOM_WHEEL ///< Custom wheel event + }; + /** * @brief Default constructor. */ - MouseWheelEvent(); + WheelEvent(); /** * @brief Constructor. * - * @param[in] direction The direction of mouse wheel rolling (0 = default vertical wheel, 1 = horizontal wheel) + * @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 mouse 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] timeStamp The time the mouse wheel is being rolled. + * @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. */ - MouseWheelEvent(int direction, unsigned int modifiers, Vector2 point, int z, unsigned int timeStamp); + WheelEvent( Type type, int direction, unsigned int modifiers, Vector2 point, int z, unsigned int timeStamp ); /** * @brief Destructor. */ - ~MouseWheelEvent(); + ~WheelEvent(); /** * @brief Check to see if Shift key modifier has been supplied. @@ -80,7 +95,14 @@ struct DALI_IMPORT_API MouseWheelEvent // Data /** - * @brief The direction in which the mouse wheel is being rolled. + * @brief Type of the event + * + * @see Type + */ + Type type; + + /** + * @brief The direction in which the wheel is being rolled. * * 0 means the default vertical wheel, and 1 means horizontal wheel */ @@ -92,19 +114,19 @@ struct DALI_IMPORT_API MouseWheelEvent unsigned int modifiers; /** - * @brief The co-ordinates of the mouse 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. */ Vector2 point; /** - * @brief The offset of the mouse wheel rolling, where positive value means rolling down - * and negative value means rolling up. + * @brief The offset of the wheel rolling, where positive value means rolling down or clockwise + * and negative value means rolling up or counter-clockwise. */ int z; /** - * @brief The time when the mouse wheel is being rolled. + * @brief The time when the wheel is being rolled. */ unsigned int timeStamp; @@ -112,4 +134,4 @@ struct DALI_IMPORT_API MouseWheelEvent } // namespace Dali -#endif // __DALI_MOUSE_WHEEL_EVENT_H__ +#endif // __DALI_WHEEL_EVENT_H__ diff --git a/dali/public-api/file.list b/dali/public-api/file.list index 5363c25..0d1fe88 100644 --- a/dali/public-api/file.list +++ b/dali/public-api/file.list @@ -29,7 +29,7 @@ public_api_src_files = \ $(public_api_src_dir)/events/key-event.cpp \ $(public_api_src_dir)/events/long-press-gesture.cpp \ $(public_api_src_dir)/events/long-press-gesture-detector.cpp \ - $(public_api_src_dir)/events/mouse-wheel-event.cpp \ + $(public_api_src_dir)/events/wheel-event.cpp \ $(public_api_src_dir)/events/pan-gesture.cpp \ $(public_api_src_dir)/events/pan-gesture-detector.cpp \ $(public_api_src_dir)/events/pinch-gesture.cpp \ @@ -134,7 +134,7 @@ public_api_core_events_header_files = \ $(public_api_src_dir)/events/key-event.h \ $(public_api_src_dir)/events/long-press-gesture.h \ $(public_api_src_dir)/events/long-press-gesture-detector.h \ - $(public_api_src_dir)/events/mouse-wheel-event.h \ + $(public_api_src_dir)/events/wheel-event.h \ $(public_api_src_dir)/events/pan-gesture.h \ $(public_api_src_dir)/events/pan-gesture-detector.h \ $(public_api_src_dir)/events/pinch-gesture.h \ -- 2.7.4