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 * - Determine the hit actor underneath the long press 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 touches in the long press event match the requirements of the detector.
49 * - Emit the gesture when all the above conditions are met.
51 class LongPressGestureProcessor : public GestureProcessor
56 * Create a long press gesture processor.
57 * @param[in] stage The stage.
58 * @param[in] gestureManager The gesture manager.
60 LongPressGestureProcessor( Stage& stage, Integration::GestureManager& gestureManager );
63 * Non-virtual destructor; LongPressGestureProcessor is not a base class
65 ~LongPressGestureProcessor();
67 public: // To be called by GestureEventProcessor
70 * This method is called whenever a long press gesture event occurs.
71 * @param[in] longPressEvent The event that has occurred.
73 void Process( const Integration::LongPressGestureEvent& longPressEvent );
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( LongPressGestureDetector* 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( LongPressGestureDetector* gestureDetector );
92 * This method updates the gesture detection parameters.
93 * @param[in] gestureDetector The gesture detector that has been updated.
95 void GestureDetectorUpdated(LongPressGestureDetector* gestureDetector);
100 LongPressGestureProcessor( const LongPressGestureProcessor& );
101 LongPressGestureProcessor& operator=( const LongPressGestureProcessor& 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();
121 Integration::GestureManager& mGestureManager;
122 LongPressGestureDetectorContainer mGestureDetectors;
124 GestureDetectorContainer mCurrentEmitters;
125 Dali::RenderTask mCurrentRenderTask;
127 unsigned int mMinTouchesRequired;
128 unsigned int mMaxTouchesRequired;
130 struct LongPressEventFunctor;
133 } // namespace Internal
137 #endif // __DALI_INTERNAL_LONG_PRESS_GESTURE_EVENT_PROCESSOR_H__