1 #ifndef __DALI_INTERNAL_PINCH_GESTURE_DETECTOR_H__
2 #define __DALI_INTERNAL_PINCH_GESTURE_DETECTOR_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/events/pinch-gesture-detector.h>
23 #include <dali/internal/event/events/gesture-detector-impl.h>
33 class PinchGestureDetector;
35 typedef IntrusivePtr<PinchGestureDetector> PinchGestureDetectorPtr;
36 typedef DerivedGestureDetectorContainer<PinchGestureDetector>::type PinchGestureDetectorContainer;
39 * @copydoc Dali::PinchGestureDetector
41 class PinchGestureDetector : public GestureDetector
46 * Create a new gesture detector.
47 * @return A smart-pointer to the newly allocated detector.
49 static PinchGestureDetectorPtr New();
52 * Construct a new GestureDetector.
54 PinchGestureDetector();
59 * Called by the PinchGestureProcessor when a pinch gesture event occurs within the bounds of our
61 * @param[in] actor The pinched actor.
62 * @param[in] pinch The pinch gesture.
64 void EmitPinchGestureSignal(Dali::Actor actor, const PinchGesture& pinch);
69 * @copydoc Dali::PinchGestureDetector::DetectedSignal()
71 Dali::PinchGestureDetector::DetectedSignalType& DetectedSignal()
73 return mDetectedSignal;
77 * Connects a callback function with the object's signals.
78 * @param[in] object The object providing the signal.
79 * @param[in] tracker Used to disconnect the signal.
80 * @param[in] signalName The signal to connect to.
81 * @param[in] functor A newly allocated FunctorDelegate.
82 * @return True if the signal was connected.
83 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
85 static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
90 * A reference counted object may only be deleted by calling Unreference()
92 virtual ~PinchGestureDetector();
97 PinchGestureDetector(const PinchGestureDetector&);
98 PinchGestureDetector& operator=(const PinchGestureDetector& rhs);
100 private: // GestureDetector overrides
103 * @copydoc Dali::Internal::GestureDetector::OnActorAttach(Actor&)
105 virtual void OnActorAttach(Actor& actor);
108 * @copydoc Dali::Internal::GestureDetector::OnActorDetach(Actor&)
110 virtual void OnActorDetach(Actor& actor);
113 * @copydoc Dali::Internal::GestureDetector::OnActorDestroyed(Object&)
115 virtual void OnActorDestroyed(Object& object);
119 Dali::PinchGestureDetector::DetectedSignalType mDetectedSignal;
122 } // namespace Internal
124 // Helpers for public-api forwarding methods
126 inline Internal::PinchGestureDetector& GetImplementation(Dali::PinchGestureDetector& detector)
128 DALI_ASSERT_ALWAYS( detector && "PinchGestureDetector handle is empty" );
130 BaseObject& handle = detector.GetBaseObject();
132 return static_cast<Internal::PinchGestureDetector&>(handle);
135 inline const Internal::PinchGestureDetector& GetImplementation(const Dali::PinchGestureDetector& detector)
137 DALI_ASSERT_ALWAYS( detector && "PinchGestureDetector handle is empty" );
139 const BaseObject& handle = detector.GetBaseObject();
141 return static_cast<const Internal::PinchGestureDetector&>(handle);
146 #endif // __DALI_INTERNAL_PINCH_GESTURE_DETECTOR_H__