1 #ifndef DALI_INTERNAL_TAP_GESTURE_EVENT_PROCESSOR_H
2 #define DALI_INTERNAL_TAP_GESTURE_EVENT_PROCESSOR_H
5 * Copyright (c) 2019 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.
22 #include <dali/internal/event/events/tap-gesture-detector-impl.h>
23 #include <dali/internal/event/events/gesture-processor.h>
24 #include "actor-observer.h"
37 struct TapGestureEvent;
40 * Tap Gesture Event Processing:
42 * When we receive a tap gesture event, we do the following:
43 * - Find the actor that requires a tap where the tap occurred.
44 * - Emit the gesture if the tap gesture event satisfies the detector conditions.
46 class TapGestureProcessor : public GestureProcessor, public RecognizerObserver<TapGestureEvent>
51 * Create a tap gesture processor.
52 * @param[in] gestureManager The gesture manager.
54 TapGestureProcessor();
57 * Non-virtual destructor; TapGestureProcessor is not a base class
59 ~TapGestureProcessor();
61 public: // To be called by GestureEventProcessor
64 * This method is called whenever a tap gesture event occurs.
65 * @param[in] scene The scene the tap gesture event occurs in.
66 * @param[in] tapEvent The event that has occurred.
68 void Process( Scene& scene, const TapGestureEvent& event);
71 * Adds a gesture detector to this gesture processor.
72 * If this is the first gesture detector being added, then this method registers the required
73 * gesture with the adaptor.
74 * @param[in] gestureDetector The gesture detector being added.
76 void AddGestureDetector(TapGestureDetector* gestureDetector, Scene& scene);
79 * Removes the specified gesture detector from this gesture processor. If, after removing this
80 * gesture detector, there are no more gesture detectors registered, then this method unregisters
81 * the gesture from the adaptor.
82 * @param[in] gestureDetector The gesture detector being removed.
84 void RemoveGestureDetector(TapGestureDetector* gestureDetector);
87 * This method updates the gesture detection parameters.
88 * @param[in] gestureDetector The gesture detector that has been updated.
90 void GestureDetectorUpdated(TapGestureDetector* gestureDetector);
95 TapGestureProcessor(const TapGestureProcessor&);
96 TapGestureProcessor& operator=(const TapGestureProcessor& rhs);
101 * Iterates through our GestureDetectors and determines if we need to ask the adaptor to update
102 * its detection policy. If it does, it sends the appropriate gesture update request to adaptor.
104 void UpdateDetection();
106 // GestureProcessor overrides
109 * @copydoc GestureProcessor::OnGesturedActorStageDisconnection()
111 void OnGesturedActorStageDisconnection() { /* Nothing to do */ }
114 * @copydoc GestureProcessor::CheckGestureDetector()
116 bool CheckGestureDetector( GestureDetector* detector, Actor* actor );
119 * @copydoc GestureProcessor::EmitGestureSignal()
121 void EmitGestureSignal( Actor* actor, const GestureDetectorContainer& gestureDetectors, Vector2 actorCoordinates );
125 TapGestureDetectorContainer mTapGestureDetectors;
127 unsigned int mMinTapsRequired;
128 unsigned int mMaxTapsRequired;
129 unsigned int mMinTouchesRequired;
130 unsigned int mMaxTouchesRequired;
132 ActorObserver mCurrentTapActor; ///< Observer for the current gesture actor
133 const TapGestureEvent* mCurrentTapEvent; ///< Pointer to current TapEvent, used when calling ProcessAndEmit()
134 bool mPossibleProcessed; ///< Indication of whether we've processed a touch down for this gestuee
137 } // namespace Internal
141 #endif // DALI_INTERNAL_TAP_GESTURE_EVENT_PROCESSOR_H