Remove a dead virtual method from proxy object
[platform/core/uifw/dali-core.git] / dali / internal / event / events / pan-gesture-detector-impl.h
1 #ifndef __DALI_INTERNAL_PAN_GESTURE_DETECTOR_H__
2 #define __DALI_INTERNAL_PAN_GESTURE_DETECTOR_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/public-api/events/gesture.h>
23 #include <dali/public-api/events/pan-gesture-detector.h>
24 #include <dali/public-api/math/vector2.h>
25 #include <dali/internal/event/events/gesture-detector-impl.h>
26
27 namespace Dali
28 {
29
30 struct TouchEvent;
31 struct Radian;
32
33 namespace Internal
34 {
35
36 class PanGestureDetector;
37 typedef IntrusivePtr<PanGestureDetector> PanGestureDetectorPtr;
38 typedef DerivedGestureDetectorContainer<PanGestureDetector>::type PanGestureDetectorContainer;
39
40 namespace SceneGraph
41 {
42 class PanGesture;
43 }
44
45 /**
46  * @copydoc Dali::PanGestureDetector
47  */
48 class PanGestureDetector : public GestureDetector
49 {
50 public: // Typedefs
51
52   typedef Dali::PanGestureDetector::AngleContainer AngleContainer;
53   typedef Dali::PanGestureDetector::AngleThresholdPair AngleThresholdPair;
54
55 public: // Creation
56
57   /**
58    * Create a new gesture detector.
59    * @return A smart-pointer to the newly allocated detector.
60    */
61   static PanGestureDetectorPtr New();
62
63   /**
64    * Construct a new PanGestureDetector.
65    */
66   PanGestureDetector();
67
68 public:
69
70   /**
71    * @copydoc Dali::PanGestureDetector::SetMinimumTouchesRequired(unsigned int)
72    */
73   void SetMinimumTouchesRequired(unsigned int minimum);
74
75   /**
76    * @copydoc Dali::PanGestureDetector::SetMaximumTouchesRequired(unsigned int)
77    */
78   void SetMaximumTouchesRequired(unsigned int maximum);
79
80   /**
81    * @copydoc Dali::PanGestureDetector::GetMinimumTouchesRequired() const
82    */
83   unsigned int GetMinimumTouchesRequired() const;
84
85   /**
86    * @copydoc Dali::PanGestureDetector::GetMaximumTouchesRequired() const
87    */
88   unsigned int GetMaximumTouchesRequired() const;
89
90   /**
91    * @copydoc Dali::PanGestureDetector::AddAngle()
92    */
93   void AddAngle( Radian angle, Radian threshold );
94
95   /**
96    * @copydoc Dali::PanGestureDetector::AddDirection()
97    */
98   void AddDirection( Radian direction, Radian threshold );
99
100   /**
101    * @copydoc Dali::PanGestureDetector::GetAngles()
102    */
103   const AngleContainer& GetAngles() const;
104
105   /**
106    * @copydoc Dali::PanGestureDetector::ClearAngles()
107    */
108   void ClearAngles();
109
110   /**
111    * @copydoc Dali::PanGestureDetector::RemoveAngle()
112    */
113   void RemoveAngle( Radian angle );
114
115   /**
116    * @copydoc Dali::PanGestureDetector::RemoveDirection()
117    */
118   void RemoveDirection( Radian direction );
119
120   /**
121    * Checks whether the pan gesture detector requires a directional pan for emission.
122    * @return true, if directional panning required, false otherwise.
123    */
124   bool RequiresDirectionalPan() const;
125
126   /**
127    * Checks whether the given pan angle is allowed for this gesture detector.
128    * @param[in]  angle  The angle to check.
129    */
130   bool CheckAngleAllowed( Radian angle ) const;
131
132 public:
133
134   /**
135    * Called by the PanGestureProcessor when a pan gesture event occurs within the bounds of our
136    * attached actor.
137    * @param[in]  actor  The panned actor.
138    * @param[in]  pan    The pan gesture.
139    */
140   void EmitPanGestureSignal(Dali::Actor actor, const PanGesture& pan);
141
142   /**
143    * Called by the PanGestureProcessor to set the scene object.
144    * @param[in]  object  The scene object.
145    */
146   void SetSceneObject( const SceneGraph::PanGesture* object );
147
148 public: // Signals
149
150   /**
151    * @copydoc Dali::PanGestureDetector::DetectedSignal()
152    */
153   Dali::PanGestureDetector::DetectedSignalV2& DetectedSignal()
154   {
155     return mDetectedSignalV2;
156   }
157
158   /**
159    * Connects a callback function with the object's signals.
160    * @param[in] object The object providing the signal.
161    * @param[in] tracker Used to disconnect the signal.
162    * @param[in] signalName The signal to connect to.
163    * @param[in] functor A newly allocated FunctorDelegate.
164    * @return True if the signal was connected.
165    * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
166    */
167   static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
168
169 public: // Override Pan Gesture
170
171   /**
172    * @copydoc Dali::PanGestureDetector::SetPanGestureProperties()
173    */
174   static void SetPanGestureProperties( const PanGesture& pan );
175
176 protected:
177
178   /**
179    * A reference counted object may only be deleted by calling Unreference()
180    */
181   virtual ~PanGestureDetector();
182
183 private:
184
185   // Undefined
186   PanGestureDetector(const PanGestureDetector&);
187
188   // Undefined
189   PanGestureDetector& operator=(const PanGestureDetector& rhs);
190
191   // From GestureDetector
192
193   /**
194    * @copydoc Dali::Internal::GestureDetector::OnActorAttach(Actor&)
195    */
196   virtual void OnActorAttach(Actor& actor);
197
198   /**
199    * @copydoc Dali::Internal::GestureDetector::OnActorDetach(Actor&)
200    */
201   virtual void OnActorDetach(Actor& actor);
202
203   /**
204    * @copydoc Dali::Internal::GestureDetector::OnActorDestroyed(Object&)
205    */
206   virtual void OnActorDestroyed(Object& object);
207
208
209   // Default property extensions from ProxyObject
210
211   /**
212    * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyCount()
213    */
214   virtual unsigned int GetDefaultPropertyCount() const;
215
216   /**
217    * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyIndices()
218    */
219   virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
220
221   /**
222    * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyName()
223    */
224   virtual const char* GetDefaultPropertyName(Property::Index index) const;
225
226   /**
227    * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyIndex()
228    */
229   virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
230
231   /**
232    * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyWritable()
233    */
234   virtual bool IsDefaultPropertyWritable(Property::Index index) const;
235
236   /**
237    * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyAnimatable()
238    */
239   virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
240
241   /**
242    * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyAConstraintInput()
243    */
244   virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
245
246   /**
247    * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyType()
248    */
249   virtual Property::Type GetDefaultPropertyType(Property::Index index) const;
250
251   /**
252    * @copydoc Dali::Internal::ProxyObject::SetDefaultProperty()
253    */
254   virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
255
256   /**
257    * @copydoc Dali::Internal::ProxyObject::SetCustomProperty()
258    */
259   virtual void SetCustomProperty( Property::Index index, const CustomProperty& entry, const Property::Value& value );
260
261   /**
262    * @copydoc Dali::Internal::ProxyObject::GetDefaultProperty()
263    */
264   virtual Property::Value GetDefaultProperty( Property::Index index ) const;
265
266   /**
267    * @copydoc Dali::Internal::ProxyObject::InstallSceneObjectProperty()
268    */
269   virtual void InstallSceneObjectProperty( SceneGraph::PropertyBase& newProperty, const std::string& name, unsigned int index );
270
271   /**
272    * @copydoc Dali::Internal::ProxyObject::GetSceneObject()
273    */
274   virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
275
276   /**
277    * @copydoc Dali::Internal::ProxyObject::GetSceneObjectAnimatableProperty()
278    */
279   virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
280
281   /**
282    * @copydoc Dali::Internal::ProxyObject::GetSceneObjectInputProperty()
283    */
284   virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
285
286 private:
287
288   Dali::PanGestureDetector::DetectedSignalV2 mDetectedSignalV2;
289
290   unsigned int mMinimumTouches; ///< The minimum number of fingers required to be touching for pan.
291   unsigned int mMaximumTouches; ///< The maximum number of fingers required to be touching for pan.
292
293   AngleContainer mAngleContainer; ///< A container of all angles allowed for pan to occur.
294
295   const SceneGraph::PanGesture* mSceneObject; ///< Not owned
296
297 };
298
299 } // namespace Internal
300
301 // Helpers for public-api forwarding methods
302
303 inline Internal::PanGestureDetector& GetImplementation(Dali::PanGestureDetector& detector)
304 {
305   DALI_ASSERT_ALWAYS( detector && "PanGestureDetector handle is empty" );
306
307   BaseObject& handle = detector.GetBaseObject();
308
309   return static_cast<Internal::PanGestureDetector&>(handle);
310 }
311
312 inline const Internal::PanGestureDetector& GetImplementation(const Dali::PanGestureDetector& detector)
313 {
314   DALI_ASSERT_ALWAYS( detector && "PanGestureDetector handle is empty" );
315
316   const BaseObject& handle = detector.GetBaseObject();
317
318   return static_cast<const Internal::PanGestureDetector&>(handle);
319 }
320
321 } // namespace Dali
322
323 #endif // __DALI_INTERNAL_PAN_GESTURE_DETECTOR_H__