1 #ifndef __DALI_INTERNAL_LONG_PRESS_GESTURE_EVENT_PROCESSOR_H__
2 #define __DALI_INTERNAL_LONG_PRESS_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/public-api/render-tasks/render-task.h>
23 #include <dali/internal/event/events/long-press-gesture-detector-impl.h>
24 #include <dali/internal/event/events/gesture-processor.h>
33 struct LongPressGestureEvent;
42 * Long Press Gesture Event Processing:
44 * When we receive a long press gesture event, we do the following:
45 * - Find the actor that requires a long-press at the long press position.
46 * - Emit the gesture if the event satisfies the detector conditions.
48 class LongPressGestureProcessor : public GestureProcessor
53 * Create a long press gesture processor.
54 * @param[in] stage The stage.
55 * @param[in] gestureManager The gesture manager.
57 LongPressGestureProcessor( Stage& stage, Integration::GestureManager& gestureManager );
60 * Non-virtual destructor; LongPressGestureProcessor is not a base class
62 ~LongPressGestureProcessor();
64 public: // To be called by GestureEventProcessor
67 * This method is called whenever a long press gesture event occurs.
68 * @param[in] longPressEvent The event that has occurred.
70 void Process( const Integration::LongPressGestureEvent& longPressEvent );
73 * Adds a gesture detector to this gesture processor.
74 * If this is the first gesture detector being added, then this method registers the required
75 * gesture with the adaptor.
76 * @param[in] gestureDetector The gesture detector being added.
78 void AddGestureDetector( LongPressGestureDetector* gestureDetector );
81 * Removes the specified gesture detector from this gesture processor. If, after removing this
82 * gesture detector, there are no more gesture detectors registered, then this method unregisters
83 * the gesture from the adaptor.
84 * @param[in] gestureDetector The gesture detector being removed.
86 void RemoveGestureDetector( LongPressGestureDetector* gestureDetector );
89 * This method updates the gesture detection parameters.
90 * @param[in] gestureDetector The gesture detector that has been updated.
92 void GestureDetectorUpdated(LongPressGestureDetector* gestureDetector);
97 LongPressGestureProcessor( const LongPressGestureProcessor& );
98 LongPressGestureProcessor& operator=( const LongPressGestureProcessor& rhs );
103 * Iterates through our GestureDetectors and determines if we need to ask the adaptor to update
104 * its detection policy. If it does, it sends the appropriate gesture update request to adaptor.
106 void UpdateDetection();
108 // GestureProcessor overrides
111 * @copydoc GestureProcessor::OnGesturedActorStageDisconnection()
113 void OnGesturedActorStageDisconnection();
116 * @copydoc GestureProcessor::CheckGestureDetector()
118 bool CheckGestureDetector( GestureDetector* detector, Actor* actor );
121 * @copydoc GestureProcessor::EmitGestureSignal()
123 void EmitGestureSignal( Actor* actor, const GestureDetectorContainer& gestureDetectors, Vector2 actorCoordinates );
128 Integration::GestureManager& mGestureManager;
129 LongPressGestureDetectorContainer mGestureDetectors;
131 GestureDetectorContainer mCurrentEmitters;
132 Dali::RenderTask mCurrentRenderTask;
134 unsigned int mMinTouchesRequired;
135 unsigned int mMaxTouchesRequired;
137 const Integration::LongPressGestureEvent* mCurrentLongPressEvent; ///< Pointer to current longPressEvent, used when calling ProcessAndEmit()
140 } // namespace Internal
144 #endif // __DALI_INTERNAL_LONG_PRESS_GESTURE_EVENT_PROCESSOR_H__