1 #ifndef __DALI_INTERNAL_PINCH_GESTURE_EVENT_PROCESSOR_H__
2 #define __DALI_INTERNAL_PINCH_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/pinch-gesture-detector-impl.h>
24 #include <dali/internal/event/events/gesture-processor.h>
33 struct PinchGestureEvent;
42 * Pinch Gesture Event Processing:
44 * When we receive a pinch gesture event, we do the following:
45 * - Find the hit actor that requires a pinch underneath the center-point of the pinch.
46 * - Emit the gesture if the event satisfies the detector conditions.
48 * The above is only checked when our gesture starts. We continue sending the pinch gesture to this
49 * detector until the pinch ends or is cancelled.
51 class PinchGestureProcessor : public GestureProcessor
56 * Create a pinch gesture processor.
57 * @param[in] stage The stage.
58 * @param[in] gestureManager The gesture manager
60 PinchGestureProcessor(Stage& stage, Integration::GestureManager& gestureManager);
63 * Non-virtual destructor; PinchGestureProcessor is not a base class
65 ~PinchGestureProcessor();
67 public: // To be called by GestureEventProcessor
70 * This method is called whenever a pinch gesture event occurs.
71 * @param[in] pinchEvent The event that has occurred.
73 void Process(const Integration::PinchGestureEvent& pinchEvent);
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(PinchGestureDetector* 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(PinchGestureDetector* gestureDetector);
92 * This method updates the gesture detection parameters.
93 * @param[in] gestureDetector The gesture detector that has been updated.
95 void GestureDetectorUpdated(PinchGestureDetector* gestureDetector);
100 PinchGestureProcessor(const PinchGestureProcessor&);
101 PinchGestureProcessor& operator=(const PinchGestureProcessor& rhs);
105 // GestureProcessor overrides
108 * @copydoc GestureProcessor::OnGesturedActorStageDisconnection()
110 void OnGesturedActorStageDisconnection();
113 * @copydoc GestureProcessor::CheckGestureDetector()
115 bool CheckGestureDetector( GestureDetector* detector, Actor* actor );
118 * @copydoc GestureProcessor::EmitGestureSignal()
120 void EmitGestureSignal( Actor* actor, const GestureDetectorContainer& gestureDetectors, Vector2 actorCoordinates );
125 Integration::GestureManager& mGestureManager;
126 PinchGestureDetectorContainer mGestureDetectors;
127 GestureDetectorContainer mCurrentPinchEmitters;
128 Dali::RenderTask mCurrentRenderTask;
130 const Integration::PinchGestureEvent* mCurrentPinchEvent; ///< Pointer to current PinchEvent, used when calling ProcessAndEmit()
133 } // namespace Internal
137 #endif // __DALI_INTERNAL_PINCH_GESTURE_EVENT_PROCESSOR_H__