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>
24 #include "actor-observer.h"
33 struct TapGestureEvent;
43 * Tap Gesture Event Processing:
45 * When we receive a tap gesture event, we do the following:
46 * - Find the actor that requires a tap where the tap occurred.
47 * - Emit the gesture if the tap gesture event satisfies the detector conditions.
49 class TapGestureProcessor : public GestureProcessor
54 * Create a tap gesture processor.
55 * @param[in] stage The stage.
56 * @param[in] gestureManager The gesture manager.
58 TapGestureProcessor(Stage& stage, Integration::GestureManager& gestureManager);
61 * Non-virtual destructor; TapGestureProcessor is not a base class
63 ~TapGestureProcessor();
65 public: // To be called by GestureEventProcessor
68 * This method is called whenever a tap gesture event occurs.
69 * @param[in] tapEvent The event that has occurred.
71 void Process(const Integration::TapGestureEvent& tapEvent);
74 * Adds a gesture detector to this gesture processor.
75 * If this is the first gesture detector being added, then this method registers the required
76 * gesture with the adaptor.
77 * @param[in] gestureDetector The gesture detector being added.
79 void AddGestureDetector(TapGestureDetector* gestureDetector);
82 * Removes the specified gesture detector from this gesture processor. If, after removing this
83 * gesture detector, there are no more gesture detectors registered, then this method unregisters
84 * the gesture from the adaptor.
85 * @param[in] gestureDetector The gesture detector being removed.
87 void RemoveGestureDetector(TapGestureDetector* gestureDetector);
90 * This method updates the gesture detection parameters.
91 * @param[in] gestureDetector The gesture detector that has been updated.
93 void GestureDetectorUpdated(TapGestureDetector* gestureDetector);
98 TapGestureProcessor(const TapGestureProcessor&);
99 TapGestureProcessor& operator=(const TapGestureProcessor& rhs);
104 * Iterates through our GestureDetectors and determines if we need to ask the adaptor to update
105 * its detection policy. If it does, it sends the appropriate gesture update request to adaptor.
107 void UpdateDetection();
109 // GestureProcessor overrides
112 * @copydoc GestureProcessor::OnGesturedActorStageDisconnection()
114 void OnGesturedActorStageDisconnection() { /* Nothing to do */ }
117 * @copydoc GestureProcessor::CheckGestureDetector()
119 bool CheckGestureDetector( GestureDetector* detector, Actor* actor );
122 * @copydoc GestureProcessor::EmitGestureSignal()
124 void EmitGestureSignal( Actor* actor, const GestureDetectorContainer& gestureDetectors, Vector2 actorCoordinates );
129 Integration::GestureManager& mGestureManager;
130 TapGestureDetectorContainer mGestureDetectors;
132 unsigned int mMinTapsRequired;
133 unsigned int mMaxTapsRequired;
134 unsigned int mMinTouchesRequired;
135 unsigned int mMaxTouchesRequired;
137 ActorObserver mCurrentTapActor; ///< Observer for the current gesture actor
138 const Integration::TapGestureEvent* mCurrentTapEvent; ///< Pointer to current TapEvent, used when calling ProcessAndEmit()
139 bool mPossibleProcessed; ///< Indication of whether we've processed a touch down for this gestuee
142 } // namespace Internal
146 #endif // __DALI_INTERNAL_TAP_GESTURE_EVENT_PROCESSOR_H__