Revert "License conversion from Flora to Apache 2.0"
[platform/core/uifw/dali-core.git] / dali / internal / event / events / pinch-gesture-processor.h
1 #ifndef __DALI_INTERNAL_PINCH_GESTURE_EVENT_PROCESSOR_H__
2 #define __DALI_INTERNAL_PINCH_GESTURE_EVENT_PROCESSOR_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
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
10 //
11 //     http://floralicense.org/license/
12 //
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.
18 //
19
20 // INTERNAL INCLUDES
21 #include <dali/public-api/render-tasks/render-task.h>
22 #include <dali/internal/event/events/pinch-gesture-detector-impl.h>
23 #include <dali/internal/event/events/gesture-processor.h>
24
25 namespace Dali
26 {
27
28 namespace Integration
29 {
30 class GestureManager;
31 struct GestureEvent;
32 struct PinchGestureEvent;
33 }
34
35 namespace Internal
36 {
37
38 class Stage;
39
40 /**
41  * Pinch Gesture Event Processing:
42  *
43  * When we receive a pinch gesture event, we do the following:
44  * - Determine the hit actor underneath the center of the pinch gesture event.
45  * - Determine whether this actor is, or is a child of, the actor attached to any of the detectors.
46  * - Emit the gesture when all the above conditions are met.
47  *
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.
50  */
51 class PinchGestureProcessor : public GestureProcessor
52 {
53 public:
54
55   /**
56    * Create a pinch gesture processor.
57    * @param[in] stage The stage.
58    * @param[in] gestureManager The gesture manager
59    */
60   PinchGestureProcessor(Stage& stage, Integration::GestureManager& gestureManager);
61
62   /**
63    * Non-virtual destructor; PinchGestureProcessor is not a base class
64    */
65   ~PinchGestureProcessor();
66
67 public: // To be called by GestureEventProcessor
68
69   /**
70    * This method is called whenever a pinch gesture event occurs.
71    * @param[in] pinchEvent The event that has occurred.
72    */
73   void Process(const Integration::PinchGestureEvent& pinchEvent);
74
75   /**
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.
80    */
81   void AddGestureDetector(PinchGestureDetector* gestureDetector);
82
83   /**
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.
88    */
89   void RemoveGestureDetector(PinchGestureDetector* gestureDetector);
90
91   /**
92    * This method updates the gesture detection parameters.
93    * @param[in]  gestureDetector  The gesture detector that has been updated.
94    */
95   void GestureDetectorUpdated(PinchGestureDetector* gestureDetector);
96
97 private:
98
99   // Undefined
100   PinchGestureProcessor(const PinchGestureProcessor&);
101   PinchGestureProcessor& operator=(const PinchGestureProcessor& rhs);
102
103 private:
104
105   // GestureProcessor overrides
106
107   /**
108    * @copydoc GestureProcessor::OnGesturedActorStageDisconnection()
109    */
110   void OnGesturedActorStageDisconnection();
111
112 private:
113
114   Stage& mStage;
115   Integration::GestureManager& mGestureManager;
116   PinchGestureDetectorContainer mGestureDetectors;
117   PinchGestureDetectorContainer mCurrentPinchEmitters;
118   Dali::RenderTask mCurrentRenderTask;
119
120   struct PinchEventFunctor;
121 };
122
123 } // namespace Internal
124
125 } // namespace Dali
126
127 #endif // __DALI_INTERNAL_PINCH_GESTURE_EVENT_PROCESSOR_H__