1 #ifndef __DALI_INTERNAL_TAP_GESTURE_EVENT_PROCESSOR_H__
2 #define __DALI_INTERNAL_TAP_GESTURE_EVENT_PROCESSOR_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.
22 #include <dali/internal/event/events/tap-gesture-detector-impl.h>
23 #include <dali/internal/event/events/gesture-processor.h>
32 struct TapGestureEvent;
42 * Tap Gesture Event Processing:
44 * When we receive a tap gesture event, we do the following:
45 * - Determine the hit actor underneath the tap gesture event.
46 * - Determine whether this actor is attached to any of the detectors or is a child of an actor
47 * attached to one of the detectors.
48 * - Ensure the taps and the touches in the tap event match the requirements of the detector.
49 * - Emit the gesture when all the above conditions are met.
51 class TapGestureProcessor : public GestureProcessor
56 * Create a tap gesture processor.
57 * @param[in] stage The stage.
58 * @param[in] gestureManager The gesture manager.
60 TapGestureProcessor(Stage& stage, Integration::GestureManager& gestureManager);
63 * Non-virtual destructor; TapGestureProcessor is not a base class
65 ~TapGestureProcessor();
67 public: // To be called by GestureEventProcessor
70 * This method is called whenever a tap gesture event occurs.
71 * @param[in] tapEvent The event that has occurred.
73 void Process(const Integration::TapGestureEvent& tapEvent);
76 * Adds a gesture detector to this gesture processor.
77 * If this is the first gesture detector being added, then this method registers the required
78 * gesture with the adaptor.
79 * @param[in] gestureDetector The gesture detector being added.
81 void AddGestureDetector(TapGestureDetector* gestureDetector);
84 * Removes the specified gesture detector from this gesture processor. If, after removing this
85 * gesture detector, there are no more gesture detectors registered, then this method unregisters
86 * the gesture from the adaptor.
87 * @param[in] gestureDetector The gesture detector being removed.
89 void RemoveGestureDetector(TapGestureDetector* gestureDetector);
92 * This method updates the gesture detection parameters.
93 * @param[in] gestureDetector The gesture detector that has been updated.
95 void GestureDetectorUpdated(TapGestureDetector* gestureDetector);
100 TapGestureProcessor(const TapGestureProcessor&);
101 TapGestureProcessor& operator=(const TapGestureProcessor& rhs);
106 * Iterates through our GestureDetectors and determines if we need to ask the adaptor to update
107 * its detection policy. If it does, it sends the appropriate gesture update request to adaptor.
109 void UpdateDetection();
111 // GestureProcessor overrides
114 * @copydoc GestureProcessor::OnGesturedActorStageDisconnection()
116 void OnGesturedActorStageDisconnection() { /* Nothing to do */ }
121 Integration::GestureManager& mGestureManager;
122 TapGestureDetectorContainer mGestureDetectors;
124 unsigned int mMinTapsRequired;
125 unsigned int mMaxTapsRequired;
126 unsigned int mMinTouchesRequired;
127 unsigned int mMaxTouchesRequired;
129 struct TapEventFunctor;
132 } // namespace Internal
136 #endif // __DALI_INTERNAL_PINCH_GESTURE_EVENT_PROCESSOR_H__