1 #ifndef __DALI_INTERNAL_TAP_GESTURE_DETECTOR_H__
2 #define __DALI_INTERNAL_TAP_GESTURE_DETECTOR_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/events/tap-gesture-detector.h>
22 #include <dali/internal/event/events/gesture-detector-impl.h>
32 class TapGestureDetector;
34 typedef IntrusivePtr<TapGestureDetector> TapGestureDetectorPtr;
35 typedef DerivedGestureDetectorContainer<TapGestureDetector>::type TapGestureDetectorContainer;
38 * @copydoc Dali::TapGestureDetector
40 class TapGestureDetector : public GestureDetector
45 * Create a new gesture detector.
46 * @return A smart-pointer to the newly allocated detector.
48 static TapGestureDetectorPtr New();
51 * Create a new gesture detector with the specified parameters.
52 * @param[in] tapsRequired The number of taps required.
53 * @param[in] touchesRequired The number of touches required.
54 * @return A smart-pointer to the newly allocated detector.
56 static TapGestureDetectorPtr New(unsigned int tapsRequired, unsigned int touchesRequired);
59 * Construct a new GestureDetector.
64 * Construct a new GestureDetector with the specified parameters.
65 * @param[in] tapsRequired The number of taps required.
66 * @param[in] touchesRequired The number of touches required.
68 TapGestureDetector(unsigned int tapsRequired, unsigned int touchesRequired);
73 * @copydoc Dali::TapGestureDetector::SetTapsRequired(unsigned int)
75 void SetTapsRequired(unsigned int taps);
77 * @copydoc Dali::TapGestureDetector::SetTouchesRequired(unsigned int)
79 void SetTouchesRequired(unsigned int touches);
82 * @copydoc Dali::TapGestureDetector::GetTapsRequired()
84 unsigned int GetTapsRequired() const;
87 * @copydoc Dali::TapGestureDetector::GetTouchesRequired()
89 unsigned int GetTouchesRequired() const;
94 * Called by the TapGestureProcessor when a tap gesture event occurs within the bounds of our
96 * @param[in] tappedActor The tapped actor.
97 * @param[in] tap The tap gesture.
99 void EmitTapGestureSignal(Dali::Actor tappedActor, const TapGesture& tap);
104 * @copydoc Dali::TapGestureDetector::DetectedSignal()
106 Dali::TapGestureDetector::DetectedSignalV2& DetectedSignal()
108 return mDetectedSignalV2;
112 * Connects a callback function with the object's signals.
113 * @param[in] object The object providing the signal.
114 * @param[in] tracker Used to disconnect the signal.
115 * @param[in] signalName The signal to connect to.
116 * @param[in] functor A newly allocated FunctorDelegate.
117 * @return True if the signal was connected.
118 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
120 static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
125 * A reference counted object may only be deleted by calling Unreference()
127 virtual ~TapGestureDetector();
132 TapGestureDetector(const TapGestureDetector&);
133 TapGestureDetector& operator=(const TapGestureDetector& rhs);
135 private: // GestureDetector overrides
138 * @copydoc Dali::Internal::GestureDetector::OnActorAttach(Actor&)
140 virtual void OnActorAttach(Actor& actor);
143 * @copydoc Dali::Internal::GestureDetector::OnActorDetach(Actor&)
145 virtual void OnActorDetach(Actor& actor);
148 * @copydoc Dali::Internal::GestureDetector::OnActorDestroyed(Object&)
150 virtual void OnActorDestroyed(Object& object);
154 Dali::TapGestureDetector::DetectedSignalV2 mDetectedSignalV2;
156 unsigned int mTapsRequired;
157 unsigned int mTouchesRequired;
160 } // namespace Internal
162 // Helpers for public-api forwarding methods
164 inline Internal::TapGestureDetector& GetImplementation(Dali::TapGestureDetector& detector)
166 DALI_ASSERT_ALWAYS( detector && "TapGestureDetector handle is empty" );
168 BaseObject& handle = detector.GetBaseObject();
170 return static_cast<Internal::TapGestureDetector&>(handle);
173 inline const Internal::TapGestureDetector& GetImplementation(const Dali::TapGestureDetector& detector)
175 DALI_ASSERT_ALWAYS( detector && "TapGestureDetector handle is empty" );
177 const BaseObject& handle = detector.GetBaseObject();
179 return static_cast<const Internal::TapGestureDetector&>(handle);
184 #endif // __DALI_INTERNAL_TAP_GESTURE_DETECTOR_H__