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() );
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
utc-Dali-Vector2.cpp
utc-Dali-Vector3.cpp
utc-Dali-Vector4.cpp
+ utc-Dali-WheelEvent.cpp
)
LIST(APPEND TC_SOURCES
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/events/hover-event-integ.h>
-#include <dali/integration-api/events/mouse-wheel-event-integ.h>
+#include <dali/integration-api/events/wheel-event-integ.h>
#include <dali/integration-api/events/key-event-integ.h>
#include "dali-test-suite-utils/dali-test-suite-utils.h"
* 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 ),
}
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 ),
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)
{
return true;
}
- virtual bool OnMouseWheelEvent(const MouseWheelEvent& event)
+ virtual bool OnWheelEvent(const WheelEvent& event)
{
return true;
}
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 );
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;
}
{
return true;
}
- virtual bool OnMouseWheelEvent(const MouseWheelEvent& event)
+ virtual bool OnWheelEvent(const WheelEvent& event)
{
return true;
}
#include <iostream>
#include <stdlib.h>
#include <dali/public-api/dali-core.h>
-#include <dali/integration-api/events/mouse-wheel-event-integ.h>
+#include <dali/integration-api/events/wheel-event-integ.h>
#include <dali-test-suite-utils.h>
using namespace Dali;
{
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;
}
} // 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
}
// 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
}
// 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
}
// 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
}
// 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
}
// 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
}
// 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
}
// 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;
}
// 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;
END_TEST;
}
-int UtcDaliMouseWheelEventSignalling(void)
+int UtcDaliWheelEventSignalling(void)
{
TestApplication application; // Reset all test adapter return codes
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 );
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.
};
*/
// CLASS HEADER
-#include <dali/integration-api/events/mouse-wheel-event-integ.h>
+#include <dali/integration-api/events/wheel-event-integ.h>
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()
{
}
-#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.
{
/**
- * 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;
} // namespace Dali
-#endif // __DALI_INTEGRATION_MOUSE_WHEEL_EVENT_H__
+#endif // __DALI_INTEGRATION_WHEEL_EVENT_H__
$(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 \
$(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 \
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";
return !mHoveredSignal.Empty() || mDerivedRequiresHover;
}
-bool Actor::GetMouseWheelEventRequired() const
+bool Actor::GetWheelEventRequired() const
{
- return !mMouseWheelEventSignal.Empty() || mDerivedRequiresMouseWheelEvent;
+ return !mWheelEventSignal.Empty() || mDerivedRequiresWheelEvent;
}
bool Actor::IsHittable() const
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;
return mHoveredSignal;
}
-Dali::Actor::MouseWheelEventSignalType& Actor::MouseWheelEventSignal()
+Dali::Actor::WheelEventSignalType& Actor::WheelEventSignal()
{
- return mMouseWheelEventSignal;
+ return mWheelEventSignal;
}
Dali::Actor::OnStageSignalType& Actor::OnStageSignal()
{
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 ) )
{
mKeyboardFocusable( false ),
mDerivedRequiresTouch( false ),
mDerivedRequiresHover( false ),
- mDerivedRequiresMouseWheelEvent( false ),
+ mDerivedRequiresWheelEvent( false ),
mOnStageSignalled( false ),
mInsideOnSizeSet( false ),
mInheritOrientation( true ),
struct KeyEvent;
struct TouchEvent;
struct HoverEvent;
-struct MouseWheelEvent;
+struct WheelEvent;
namespace Internal
{
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
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()
Dali::Actor::HoverSignalType& HoveredSignal();
/**
- * @copydoc Dali::Actor::MouseWheelEventSignal()
+ * @copydoc Dali::Actor::WheelEventSignal()
*/
- Dali::Actor::MouseWheelEventSignalType& MouseWheelEventSignal();
+ Dali::Actor::WheelEventSignalType& WheelEventSignal();
/**
* @copydoc Dali::Actor::OnStageSignal()
/**
* 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;
}
// 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;
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.
{
mDerivedRequiresTouch = extension.RequiresTouchEvents();
mDerivedRequiresHover = extension.RequiresHoverEvents();
- mDerivedRequiresMouseWheelEvent = extension.RequiresMouseWheelEvents();
+ mDerivedRequiresWheelEvent = extension.RequiresWheelEvents();
SetRelayoutEnabled( extension.IsRelayoutEnabled() );
}
}
/**
- * @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);
}
/**
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";
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
{
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 );
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()
{
return mTouchedSignal;
}
+Dali::Stage::WheelEventSignalType& Stage::WheelEventSignal()
+{
+ return mWheelEventSignal;
+}
+
Dali::Stage::ContextStatusSignal& Stage::ContextLostSignal()
{
return mContextLostSignal;
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();
Dali::Stage::TouchedSignalType& TouchedSignal();
/**
+ * @copydoc Dali::Stage::WheelEventSignal()
+ */
+ Dali::Stage::WheelEventSignalType& WheelEventSignal();
+
+ /**
* @copydoc Dali::Stage::ContextLostSignal()
*/
Dali::Stage::ContextStatusSignal& ContextLostSignal();
// The touched signal
Dali::Stage::TouchedSignalType mTouchedSignal;
+ // The wheel event signal
+ Dali::Stage::WheelEventSignalType mWheelEventSignal;
+
Dali::Stage::ContextStatusSignal mContextLostSignal;
Dali::Stage::ContextStatusSignal mContextRegainedSignal;
#include <dali/integration-api/events/event.h>
#include <dali/integration-api/events/gesture-event.h>
#include <dali/integration-api/events/key-event-integ.h>
-#include <dali/integration-api/events/mouse-wheel-event-integ.h>
+#include <dali/integration-api/events/wheel-event-integ.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/events/hover-event-integ.h>
#include <dali/integration-api/events/pinch-gesture-event.h>
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;
mHoverEventProcessor(stage),
mGestureEventProcessor(gestureEventProcessor),
mKeyEventProcessor(stage),
- mMouseWheelEventProcessor(stage),
+ mWheelEventProcessor(stage),
mEventQueue0( INITIAL_BUFFER_SIZE ),
mEventQueue1( INITIAL_BUFFER_SIZE ),
mCurrentEventQueue( &mEventQueue0 )
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 ) );
break;
}
- case Event::MouseWheel:
+ case Event::Wheel:
{
- mMouseWheelEventProcessor.ProcessMouseWheelEvent( static_cast<const Integration::MouseWheelEvent&>(*event) );
+ mWheelEventProcessor.ProcessWheelEvent( static_cast<const Integration::WheelEvent&>(*event) );
break;
}
#include <dali/internal/event/events/touch-event-processor.h>
#include <dali/internal/event/events/hover-event-processor.h>
#include <dali/internal/event/events/key-event-processor.h>
-#include <dali/internal/event/events/mouse-wheel-event-processor.h>
+#include <dali/internal/event/events/wheel-event-processor.h>
#include <dali/internal/common/message-buffer.h>
namespace Dali
/**
* 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.
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.
*/
// CLASS HEADER
-#include <dali/internal/event/events/mouse-wheel-event-processor.h>
+#include <dali/internal/event/events/wheel-event-processor.h>
// INTERNAL INCLUDES
-#include <dali/public-api/events/mouse-wheel-event.h>
+#include <dali/public-api/events/wheel-event.h>
#include <dali/devel-api/events/hit-test-algorithm.h>
#include <dali/public-api/math/vector2.h>
-#include <dali/integration-api/events/mouse-wheel-event-integ.h>
+#include <dali/integration-api/events/wheel-event-integ.h>
#include <dali/internal/event/common/stage-impl.h>
#include <dali/internal/event/actors/actor-impl.h>
{
#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;
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 )
(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 );
}
}
}
}
/**
- * 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;
{
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;
} // 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
-#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.
namespace Integration
{
-struct MouseWheelEvent;
+struct WheelEvent;
}
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__
$(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 \
return GetImplementation(*this).HoveredSignal();
}
-Actor::MouseWheelEventSignalType& Actor::MouseWheelEventSignal()
+Actor::WheelEventSignalType& Actor::WheelEventSignal()
{
- return GetImplementation(*this).MouseWheelEventSignal();
+ return GetImplementation(*this).WheelEventSignal();
}
Actor::OnStageSignalType& Actor::OnStageSignal()
struct KeyEvent;
struct TouchEvent;
struct HoverEvent;
-struct MouseWheelEvent;
+struct WheelEvent;
struct Vector2;
struct Vector3;
struct Vector4;
* |-------------------|------------------------------|
* | touched | @ref TouchedSignal() |
* | hovered | @ref HoveredSignal() |
- * | mouse-wheel-event | @ref MouseWheelEventSignal() |
+ * | wheel-event | @ref WheelEventSignal() |
* | on-stage | @ref OnStageSignal() |
* | off-stage | @ref OffStageSignal() |
*
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
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.
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
struct KeyEvent;
struct TouchEvent;
struct HoverEvent;
-struct MouseWheelEvent;
+struct WheelEvent;
struct Vector2;
struct Vector3;
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.
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
};
/**
* @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.
return GetImplementation(*this).TouchedSignal();
}
+Stage::WheelEventSignalType& Stage::WheelEventSignal()
+{
+ return GetImplementation(*this).WheelEventSignal();
+}
+
Stage::ContextStatusSignal& Stage::ContextLostSignal()
{
return GetImplementation(*this).ContextLostSignal();
class DynamicsWorldConfig;
struct KeyEvent;
struct TouchEvent;
+struct WheelEvent;
/**
* @brief The Stage is a top-level object used for displaying a tree of Actors.
* | 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() |
{
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.
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
#include <dali/public-api/events/key-event.h>
#include <dali/public-api/events/long-press-gesture-detector.h>
#include <dali/public-api/events/long-press-gesture.h>
-#include <dali/public-api/events/mouse-wheel-event.h>
+#include <dali/public-api/events/wheel-event.h>
#include <dali/public-api/events/pan-gesture-detector.h>
#include <dali/public-api/events/pan-gesture.h>
#include <dali/public-api/events/pinch-gesture-detector.h>
*/
// CLASS HEADER
-#include <dali/public-api/events/mouse-wheel-event.h>
+#include <dali/public-api/events/wheel-event.h>
namespace Dali
{
}
-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)
{
return false;
}
-bool MouseWheelEvent::IsCtrlModifier() const
+bool WheelEvent::IsCtrlModifier() const
{
if ((MODIFIER_CTRL & modifiers) == MODIFIER_CTRL)
{
return false;
}
-bool MouseWheelEvent::IsAltModifier() const
+bool WheelEvent::IsAltModifier() const
{
if ((MODIFIER_ALT & modifiers) == MODIFIER_ALT)
{
-#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.
{
/**
- * @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.
// 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
*/
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;
} // namespace Dali
-#endif // __DALI_MOUSE_WHEEL_EVENT_H__
+#endif // __DALI_WHEEL_EVENT_H__
$(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 \
$(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 \