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 Flora License, Version 1.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://floralicense.org/license/
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.
21 #include <dali/public-api/render-tasks/render-task.h>
22 #include <dali/internal/event/events/long-press-gesture-detector-impl.h>
23 #include <dali/internal/event/events/gesture-processor.h>
32 struct LongPressGestureEvent;
41 * Long Press Gesture Event Processing:
43 * When we receive a long press gesture event, we do the following:
44 * - Determine the hit actor underneath the long press gesture event.
45 * - Determine whether this actor is attached to any of the detectors or is a child of an actor
46 * attached to one of the detectors.
47 * - Ensure the touches in the long press event match the requirements of the detector.
48 * - Emit the gesture when all the above conditions are met.
50 class LongPressGestureProcessor : public GestureProcessor
55 * Create a long press gesture processor.
56 * @param[in] stage The stage.
57 * @param[in] gestureManager The gesture manager.
59 LongPressGestureProcessor( Stage& stage, Integration::GestureManager& gestureManager );
62 * Non-virtual destructor; LongPressGestureProcessor is not a base class
64 ~LongPressGestureProcessor();
66 public: // To be called by GestureEventProcessor
69 * This method is called whenever a long press gesture event occurs.
70 * @param[in] longPressEvent The event that has occurred.
72 void Process( const Integration::LongPressGestureEvent& longPressEvent );
75 * Adds a gesture detector to this gesture processor.
76 * If this is the first gesture detector being added, then this method registers the required
77 * gesture with the adaptor.
78 * @param[in] gestureDetector The gesture detector being added.
80 void AddGestureDetector( LongPressGestureDetector* gestureDetector );
83 * Removes the specified gesture detector from this gesture processor. If, after removing this
84 * gesture detector, there are no more gesture detectors registered, then this method unregisters
85 * the gesture from the adaptor.
86 * @param[in] gestureDetector The gesture detector being removed.
88 void RemoveGestureDetector( LongPressGestureDetector* gestureDetector );
91 * This method updates the gesture detection parameters.
92 * @param[in] gestureDetector The gesture detector that has been updated.
94 void GestureDetectorUpdated(LongPressGestureDetector* gestureDetector);
99 LongPressGestureProcessor( const LongPressGestureProcessor& );
100 LongPressGestureProcessor& operator=( const LongPressGestureProcessor& rhs );
105 * Iterates through our GestureDetectors and determines if we need to ask the adaptor to update
106 * its detection policy. If it does, it sends the appropriate gesture update request to adaptor.
108 void UpdateDetection();
110 // GestureProcessor overrides
113 * @copydoc GestureProcessor::OnGesturedActorStageDisconnection()
115 void OnGesturedActorStageDisconnection();
120 Integration::GestureManager& mGestureManager;
121 LongPressGestureDetectorContainer mGestureDetectors;
123 LongPressGestureDetectorContainer mCurrentEmitters;
124 Dali::RenderTask mCurrentRenderTask;
126 unsigned int mMinTouchesRequired;
127 unsigned int mMaxTouchesRequired;
129 struct LongPressEventFunctor;
132 } // namespace Internal
136 #endif // __DALI_INTERNAL_LONG_PRESS_GESTURE_EVENT_PROCESSOR_H__