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

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

#include <tap-gesture-detector.h>

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

Public Member Functions

 TapGestureDetector (CoreEventInterface &coreEventInterface, Vector2 screenSize, const Integration::TapGestureRequest &request)
 Constructor. More...
 
virtual ~TapGestureDetector ()
 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, Registered, Failed }
 Internal state machine. More...
 

Private Member Functions

void EmitGesture (Gesture::State state, unsigned int time)
 Checks if registered taps are within required bounds and emits tap gesture if they are. More...
 
void SetupForTouchDown (const Integration::TouchEvent &event, const TouchPoint &point)
 Initialises tap gesture detector for next tap sequence. More...
 
void EmitPossibleState (const Integration::TouchEvent &event)
 Emit a touch down event for hit testing. More...
 
void EmitSingleTap (unsigned int time, const TouchPoint &point)
 Force a touch event sequence to be treated as a single tap. More...
 
void EmitTap (unsigned int time, Integration::TapGestureEvent &event)
 Emit a tap event. More...
 

Private Attributes

CoreEventInterfacemCoreEventInterface
 Used to send events to Core. More...
 
State mState
 Current state of the detector. More...
 
int mMinimumTapsRequired
 Minimum number of taps required. More...
 
int mMaximumTapsRequired
 Maximum number of taps required. More...
 
int mTapsRegistered
 In current detection, the number of taps registered. More...
 
Vector2 mTouchPosition
 The initial touch down position. More...
 
unsigned long mTouchTime
 The initial touch down time. More...
 
unsigned long mLastTapTime
 Time last tap gesture was registered. More...
 

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 tap gesture has taken place.

Definition at line 49 of file tap-gesture-detector.h.

Member Enumeration Documentation

Internal state machine.

Enumerator
Clear 

No gesture detected.

Touched 

User is touching the screen.

Registered 

At least one tap has been registered.

Failed 

Gesture has failed.

Definition at line 124 of file tap-gesture-detector.h.

Constructor & Destructor Documentation

Dali::Internal::Adaptor::TapGestureDetector::TapGestureDetector ( CoreEventInterface coreEventInterface,
Vector2  screenSize,
const Integration::TapGestureRequest &  request 
)

Constructor.

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

Definition at line 48 of file tap-gesture-detector.cpp.

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

Virtual destructor.

Definition at line 61 of file tap-gesture-detector.cpp.

Member Function Documentation

void Dali::Internal::Adaptor::TapGestureDetector::EmitGesture ( Gesture::State  state,
unsigned int  time 
)
private

Checks if registered taps are within required bounds and emits tap gesture if they are.

Parameters
[in]statecurrent state of incomplete gesture
[in]timetime of this latest touch event

Definition at line 201 of file tap-gesture-detector.cpp.

References Dali::Gesture::Cancelled, EmitTap(), mMaximumTapsRequired, mMinimumTapsRequired, and mTapsRegistered.

Referenced by SendEvent().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Adaptor::TapGestureDetector::EmitPossibleState ( const Integration::TouchEvent &  event)
private

Emit a touch down event for hit testing.

Parameters
[in]eventregistered touch event

Definition at line 184 of file tap-gesture-detector.cpp.

References mCoreEventInterface, mTouchPosition, Dali::Gesture::Possible, and Dali::Internal::Adaptor::CoreEventInterface::QueueCoreEvent().

Referenced by SendEvent(), and SetupForTouchDown().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Adaptor::TapGestureDetector::EmitSingleTap ( unsigned int  time,
const TouchPoint point 
)
private

Force a touch event sequence to be treated as a single tap.

Parameters
[in]timetime of this latest touch event
[in]pointposition touch event occurred

Definition at line 212 of file tap-gesture-detector.cpp.

References Dali::Gesture::Cancelled, EmitTap(), Dali::Internal::Adaptor::anonymous_namespace{long-press-gesture-detector.cpp}::MAXIMUM_MOTION_ALLOWED, mTapsRegistered, mTouchPosition, Dali::TouchPoint::screen, Dali::Gesture::Started, Dali::Vector2::x, and Dali::Vector2::y.

Referenced by SendEvent().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Adaptor::TapGestureDetector::EmitTap ( unsigned int  time,
Integration::TapGestureEvent &  event 
)
private

Emit a tap event.

Parameters
[in]timetime of this latest touch event
[in]eventregistered touch event

Definition at line 227 of file tap-gesture-detector.cpp.

References mCoreEventInterface, mTapsRegistered, mTouchPosition, and Dali::Internal::Adaptor::CoreEventInterface::QueueCoreEvent().

Referenced by EmitGesture(), and EmitSingleTap().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Adaptor::TapGestureDetector::SendEvent ( const Integration::TouchEvent &  event)
virtual
void Dali::Internal::Adaptor::TapGestureDetector::SetupForTouchDown ( const Integration::TouchEvent &  event,
const TouchPoint point 
)
private

Initialises tap gesture detector for next tap sequence.

Parameters
[in]eventregistered touch event
[in]pointposition touch event occurred

Definition at line 173 of file tap-gesture-detector.cpp.

References EmitPossibleState(), mLastTapTime, mState, mTapsRegistered, mTouchPosition, mTouchTime, Dali::TouchPoint::screen, Touched, Dali::Vector2::x, and Dali::Vector2::y.

Referenced by SendEvent().

Here is the call graph for this function:

Here is the caller graph for this function:

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

Member Data Documentation

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

Used to send events to Core.

Definition at line 132 of file tap-gesture-detector.h.

Referenced by EmitPossibleState(), and EmitTap().

unsigned long Dali::Internal::Adaptor::TapGestureDetector::mLastTapTime
private

Time last tap gesture was registered.

Definition at line 141 of file tap-gesture-detector.h.

Referenced by SendEvent(), and SetupForTouchDown().

int Dali::Internal::Adaptor::TapGestureDetector::mMaximumTapsRequired
private

Maximum number of taps required.

Definition at line 136 of file tap-gesture-detector.h.

Referenced by EmitGesture(), and Update().

int Dali::Internal::Adaptor::TapGestureDetector::mMinimumTapsRequired
private

Minimum number of taps required.

Definition at line 135 of file tap-gesture-detector.h.

Referenced by EmitGesture(), and Update().

State Dali::Internal::Adaptor::TapGestureDetector::mState
private

Current state of the detector.

Definition at line 133 of file tap-gesture-detector.h.

Referenced by SendEvent(), and SetupForTouchDown().

int Dali::Internal::Adaptor::TapGestureDetector::mTapsRegistered
private

In current detection, the number of taps registered.

Definition at line 137 of file tap-gesture-detector.h.

Referenced by EmitGesture(), EmitSingleTap(), EmitTap(), SendEvent(), and SetupForTouchDown().

Vector2 Dali::Internal::Adaptor::TapGestureDetector::mTouchPosition
private

The initial touch down position.

Definition at line 139 of file tap-gesture-detector.h.

Referenced by EmitPossibleState(), EmitSingleTap(), EmitTap(), SendEvent(), and SetupForTouchDown().

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

The initial touch down time.

Definition at line 140 of file tap-gesture-detector.h.

Referenced by SendEvent(), and SetupForTouchDown().


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