Revert "[Tizen] Restore Uploaded signal for BufferImage and ResourceImage"
[platform/core/uifw/dali-core.git] / dali / internal / event / events / tap-gesture-processor.h
1 #ifndef __DALI_INTERNAL_TAP_GESTURE_EVENT_PROCESSOR_H__
2 #define __DALI_INTERNAL_TAP_GESTURE_EVENT_PROCESSOR_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
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
21 // INTERNAL INCLUDES
22 #include <dali/internal/event/events/tap-gesture-detector-impl.h>
23 #include <dali/internal/event/events/gesture-processor.h>
24 #include "actor-observer.h"
25
26 namespace Dali
27 {
28
29 namespace Integration
30 {
31 class GestureManager;
32 struct GestureEvent;
33 struct TapGestureEvent;
34 }
35
36 namespace Internal
37 {
38
39 class Stage;
40 class Actor;
41
42 /**
43  * Tap Gesture Event Processing:
44  *
45  * When we receive a tap gesture event, we do the following:
46  * - Find the actor that requires a tap where the tap occurred.
47  * - Emit the gesture if the tap gesture event satisfies the detector conditions.
48  */
49 class TapGestureProcessor : public GestureProcessor
50 {
51 public:
52
53   /**
54    * Create a tap gesture processor.
55    * @param[in] stage The stage.
56    * @param[in] gestureManager The gesture manager.
57    */
58   TapGestureProcessor(Stage& stage, Integration::GestureManager& gestureManager);
59
60   /**
61    * Non-virtual destructor; TapGestureProcessor is not a base class
62    */
63   ~TapGestureProcessor();
64
65 public: // To be called by GestureEventProcessor
66
67   /**
68    * This method is called whenever a tap gesture event occurs.
69    * @param[in] tapEvent The event that has occurred.
70    */
71   void Process(const Integration::TapGestureEvent& tapEvent);
72
73   /**
74    * Adds a gesture detector to this gesture processor.
75    * If this is the first gesture detector being added, then this method registers the required
76    * gesture with the adaptor.
77    * @param[in]  gestureDetector  The gesture detector being added.
78    */
79   void AddGestureDetector(TapGestureDetector* gestureDetector);
80
81   /**
82    * Removes the specified gesture detector from this gesture processor.  If, after removing this
83    * gesture detector, there are no more gesture detectors registered, then this method unregisters
84    * the gesture from the adaptor.
85    * @param[in]  gestureDetector  The gesture detector being removed.
86    */
87   void RemoveGestureDetector(TapGestureDetector* gestureDetector);
88
89   /**
90    * This method updates the gesture detection parameters.
91    * @param[in]  gestureDetector  The gesture detector that has been updated.
92    */
93   void GestureDetectorUpdated(TapGestureDetector* gestureDetector);
94
95 private:
96
97   // Undefined
98   TapGestureProcessor(const TapGestureProcessor&);
99   TapGestureProcessor& operator=(const TapGestureProcessor& rhs);
100
101 private:
102
103   /**
104    * Iterates through our GestureDetectors and determines if we need to ask the adaptor to update
105    * its detection policy.  If it does, it sends the appropriate gesture update request to adaptor.
106    */
107   void UpdateDetection();
108
109   // GestureProcessor overrides
110
111   /**
112    * @copydoc GestureProcessor::OnGesturedActorStageDisconnection()
113    */
114   void OnGesturedActorStageDisconnection() { /* Nothing to do */ }
115
116   /**
117    * @copydoc GestureProcessor::CheckGestureDetector()
118    */
119   bool CheckGestureDetector( GestureDetector* detector, Actor* actor );
120
121   /**
122    * @copydoc GestureProcessor::EmitGestureSignal()
123    */
124   void EmitGestureSignal( Actor* actor, const GestureDetectorContainer& gestureDetectors, Vector2 actorCoordinates );
125
126 private:
127
128   Stage& mStage;
129   Integration::GestureManager& mGestureManager;
130   TapGestureDetectorContainer mGestureDetectors;
131
132   unsigned int mMinTapsRequired;
133   unsigned int mMaxTapsRequired;
134   unsigned int mMinTouchesRequired;
135   unsigned int mMaxTouchesRequired;
136
137   ActorObserver mCurrentTapActor; ///< Observer for the current gesture actor
138   const Integration::TapGestureEvent* mCurrentTapEvent; ///< Pointer to current TapEvent, used when calling ProcessAndEmit()
139   bool mPossibleProcessed; ///< Indication of whether we've processed a touch down for this gestuee
140 };
141
142 } // namespace Internal
143
144 } // namespace Dali
145
146 #endif // __DALI_INTERNAL_TAP_GESTURE_EVENT_PROCESSOR_H__