1 #ifndef __DALI_INTERNAL_TAP_GESTURE_DETECTOR_H__
2 #define __DALI_INTERNAL_TAP_GESTURE_DETECTOR_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
23 #include <dali/public-api/adaptor-framework/common/timer.h>
26 #include <internal/common/events/gesture-detector.h>
34 struct TapGestureRequest;
43 class CoreEventInterface;
46 * When given a set of touch events, this detector attempts to determine if a tap gesture has taken place.
48 class TapGestureDetector : public GestureDetector
54 * @param[in] coreEventInterface Used to send events to Core.
55 * @param[in] screenSize The size of the screen.
56 * @param[in] request The tap gesture request.
58 TapGestureDetector(CoreEventInterface& coreEventInterface, Vector2 screenSize, const Integration::TapGestureRequest& request);
63 virtual ~TapGestureDetector();
68 * @copydoc Dali::Internal::GestureDetector::SendEvent(const Integration::TouchEvent&)
70 virtual void SendEvent(const Integration::TouchEvent& event);
73 * @copydoc Dali::Internal::GestureDetector::Update(const Integration::GestureRequest&)
75 virtual void Update(const Integration::GestureRequest& request);
81 * @return will return false; one-shot timer.
86 * Checks if registered taps are within required bounds and emits tap gesture if they are.
88 void EmitGesture( Gesture::State state, unsigned int time );
93 * Internal state machine.
97 Clear, ///< No gesture detected.
98 Touched, ///< User is touching the screen.
99 Registered, ///< At least one tap has been registered.
100 Failed, ///< Gesture has failed.
103 CoreEventInterface& mCoreEventInterface; ///< Used to send events to Core.
104 State mState; ///< Current state of the detector.
106 int mMinimumTapsRequired; ///< Minimum number of taps required.
107 int mMaximumTapsRequired; ///< Maximum number of taps required.
108 int mTapsRegistered; ///< In current detection, the number of taps registered.
110 Vector2 mTouchPosition; ///< The initial touch down position.
111 unsigned long mTouchTime; ///< The initial touch down time.
113 Dali::Timer mTimer; ///< The timer to start when we have registered the tap. We have to register all taps within a certain time frame.
114 SlotDelegate< TapGestureDetector > mTimerSlot;
117 } // namespace Adaptor
119 } // namespace Internal
123 #endif // __DALI_INTERNAL_TAP_GESTURE_DETECTOR_H__