Dali 3D User Interface Engine
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
Dali::Internal::Adaptor::LongPressGestureDetector Class Reference

When given a set of touch events, this detector attempts to determine if a long press gesture has taken place. More...

#include <long-press-gesture-detector.h>

Inheritance diagram for Dali::Internal::Adaptor::LongPressGestureDetector:
Inheritance graph
[legend]
Collaboration diagram for Dali::Internal::Adaptor::LongPressGestureDetector:
Collaboration graph
[legend]

Public Member Functions

 LongPressGestureDetector (CoreEventInterface &coreEventInterface, Vector2 screenSize, const Integration::LongPressGestureRequest &request)
 Constructor. More...
 
virtual ~LongPressGestureDetector ()
 Virtual destructor. More...
 
virtual void SendEvent (const Integration::TouchEvent &event)
  More...
 
virtual void Update (const Integration::GestureRequest &request)
  More...
 
- Public Member Functions inherited from Dali::Internal::Adaptor::GestureDetector
Gesture::Type GetType () const
 Returns the type of gesture detector. More...
 
- Public Member Functions inherited from Dali::RefObject
void Reference ()
 Increment the object's reference count. More...
 
void Unreference ()
 Decrement the object's reference count. More...
 
int ReferenceCount ()
 Retrieve the object's reference count. More...
 

Private Types

enum  State { Clear, Touched, Failed, Finished }
 Internal state machine. More...
 

Private Member Functions

bool TimerCallback ()
 Timer Callback. More...
 
void EmitGesture (Gesture::State state)
 Emits the long press gesture if all conditions are applicable. More...
 
int GetSystemValue ()
 Get current system setting value for tap and hold gesture. More...
 

Private Attributes

CoreEventInterfacemCoreEventInterface
 Used to send events to Core. More...
 
State mState
 The current state of the detector. More...
 
unsigned int mMinimumTouchesRequired
 The minimum touches required before emitting a long press. More...
 
unsigned int mMaximumTouchesRequired
 The maximum touches allowable. Any more and a long press is not emitted. More...
 
std::map< int, Vector2mTouchPositions
 A map with all the touch down positions. More...
 
unsigned long mTouchTime
 The time we first pressed down. More...
 
Dali::Timer mTimer
 The timer used to determine a long press. More...
 
SlotDelegate
< LongPressGestureDetector
mTimerSlot
 

Additional Inherited Members

- Protected Member Functions inherited from Dali::Internal::Adaptor::GestureDetector
 GestureDetector (Vector2 screenSize, Gesture::Type detectorType)
 Protected Constructor. More...
 
virtual ~GestureDetector ()
 Virtual destructor. More...
 
- Protected Attributes inherited from Dali::Internal::Adaptor::GestureDetector
Vector2 mScreenSize
 
Gesture::Type mType
 

Detailed Description

When given a set of touch events, this detector attempts to determine if a long press gesture has taken place.

Emits a LongPressGestureEvent (state = Started) when a long press has been detected (Touch held down for more than duration). Emits a further LongPressGestureEvent (state = Finished) when a long press has been completed (Touch Release).

Definition at line 50 of file long-press-gesture-detector.h.

Member Enumeration Documentation

Internal state machine.

Enumerator
Clear 

No gesture detected.

Touched 

User is touching the screen.

Failed 

Gesture has failed.

Finished 

Gesture has been detected and sent.

Definition at line 104 of file long-press-gesture-detector.h.

Constructor & Destructor Documentation

Dali::Internal::Adaptor::LongPressGestureDetector::LongPressGestureDetector ( CoreEventInterface coreEventInterface,
Vector2  screenSize,
const Integration::LongPressGestureRequest &  request 
)

Constructor.

Parameters
[in]coreEventInterfaceUsed to send events to Core.
[in]screenSizeThe size of the screen.
[in]requestThe long press gesture request.

Definition at line 53 of file long-press-gesture-detector.cpp.

References GetSystemValue(), mTimer, mTimerSlot, Dali::Timer::New(), Dali::Timer::TickSignal(), and TimerCallback().

Here is the call graph for this function:

Dali::Internal::Adaptor::LongPressGestureDetector::~LongPressGestureDetector ( )
virtual

Virtual destructor.

Definition at line 66 of file long-press-gesture-detector.cpp.

Member Function Documentation

void Dali::Internal::Adaptor::LongPressGestureDetector::EmitGesture ( Gesture::State  state)
private

Emits the long press gesture if all conditions are applicable.

Parameters
[in]stateThe state of this gesture event.

Definition at line 211 of file long-press-gesture-detector.cpp.

References Dali::Gesture::Cancelled, GetSystemValue(), mCoreEventInterface, mMinimumTouchesRequired, mTouchPositions, mTouchTime, Dali::Gesture::Possible, and Dali::Internal::Adaptor::CoreEventInterface::QueueCoreEvent().

Referenced by SendEvent(), and TimerCallback().

Here is the call graph for this function:

Here is the caller graph for this function:

int Dali::Internal::Adaptor::LongPressGestureDetector::GetSystemValue ( )
private

Get current system setting value for tap and hold gesture.

Returns
system value for tap and hold gesture [ms]

Definition at line 240 of file long-press-gesture-detector.cpp.

References Dali::Internal::Adaptor::GetLongPressTime(), and Dali::Internal::Adaptor::anonymous_namespace{long-press-gesture-detector.cpp}::LONG_PRESS_TIME.

Referenced by EmitGesture(), LongPressGestureDetector(), and SendEvent().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Adaptor::LongPressGestureDetector::SendEvent ( const Integration::TouchEvent &  event)
virtual
bool Dali::Internal::Adaptor::LongPressGestureDetector::TimerCallback ( )
private

Timer Callback.

Returns
will return false; one-shot timer.

Definition at line 199 of file long-press-gesture-detector.cpp.

References EmitGesture(), Finished, mCoreEventInterface, mState, Dali::Internal::Adaptor::CoreEventInterface::ProcessCoreEvents(), and Dali::Gesture::Started.

Referenced by LongPressGestureDetector().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Adaptor::LongPressGestureDetector::Update ( const Integration::GestureRequest &  request)
virtual

Member Data Documentation

CoreEventInterface& Dali::Internal::Adaptor::LongPressGestureDetector::mCoreEventInterface
private

Used to send events to Core.

Definition at line 112 of file long-press-gesture-detector.h.

Referenced by EmitGesture(), and TimerCallback().

unsigned int Dali::Internal::Adaptor::LongPressGestureDetector::mMaximumTouchesRequired
private

The maximum touches allowable. Any more and a long press is not emitted.

Definition at line 116 of file long-press-gesture-detector.h.

Referenced by SendEvent(), and Update().

unsigned int Dali::Internal::Adaptor::LongPressGestureDetector::mMinimumTouchesRequired
private

The minimum touches required before emitting a long press.

Definition at line 115 of file long-press-gesture-detector.h.

Referenced by EmitGesture(), and Update().

State Dali::Internal::Adaptor::LongPressGestureDetector::mState
private

The current state of the detector.

Definition at line 113 of file long-press-gesture-detector.h.

Referenced by SendEvent(), and TimerCallback().

Dali::Timer Dali::Internal::Adaptor::LongPressGestureDetector::mTimer
private

The timer used to determine a long press.

Definition at line 121 of file long-press-gesture-detector.h.

Referenced by LongPressGestureDetector(), and SendEvent().

SlotDelegate< LongPressGestureDetector > Dali::Internal::Adaptor::LongPressGestureDetector::mTimerSlot
private

Definition at line 122 of file long-press-gesture-detector.h.

Referenced by LongPressGestureDetector().

std::map<int, Vector2> Dali::Internal::Adaptor::LongPressGestureDetector::mTouchPositions
private

A map with all the touch down positions.

Definition at line 118 of file long-press-gesture-detector.h.

Referenced by EmitGesture(), and SendEvent().

unsigned long Dali::Internal::Adaptor::LongPressGestureDetector::mTouchTime
private

The time we first pressed down.

Definition at line 119 of file long-press-gesture-detector.h.

Referenced by EmitGesture(), and SendEvent().


The documentation for this class was generated from the following files:
Dali Docs Home
Read more about Dali