1 #ifndef DALI_INTERNAL_PINCH_GESTURE_DETECTOR_H
2 #define DALI_INTERNAL_PINCH_GESTURE_DETECTOR_H
5 * Copyright (c) 2020 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/public-api/events/pinch-gesture.h>
24 #include <dali/internal/event/events/gesture-detector-impl.h>
32 class PinchGestureDetector;
34 using PinchGestureDetectorPtr = IntrusivePtr<PinchGestureDetector>;
35 using PinchGestureDetectorContainer = DerivedGestureDetectorContainer<PinchGestureDetector>::type;
38 * @copydoc Dali::PinchGestureDetector
40 class PinchGestureDetector : public GestureDetector
45 * Create a new gesture detector.
46 * @return A smart-pointer to the newly allocated detector.
48 static PinchGestureDetectorPtr New();
51 * Construct a new GestureDetector.
53 PinchGestureDetector();
58 * Called by the PinchGestureProcessor when a pinch gesture event occurs within the bounds of our
60 * @param[in] actor The pinched actor.
61 * @param[in] pinch The pinch gesture.
63 void EmitPinchGestureSignal(Dali::Actor actor, const Dali::PinchGesture& pinch);
68 * @copydoc Dali::PinchGestureDetector::DetectedSignal()
70 Dali::PinchGestureDetector::DetectedSignalType& DetectedSignal()
72 return mDetectedSignal;
76 * Connects a callback function with the object's signals.
77 * @param[in] object The object providing the signal.
78 * @param[in] tracker Used to disconnect the signal.
79 * @param[in] signalName The signal to connect to.
80 * @param[in] functor A newly allocated FunctorDelegate.
81 * @return True if the signal was connected.
82 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
84 static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
89 * A reference counted object may only be deleted by calling Unreference()
91 ~PinchGestureDetector() override;
96 PinchGestureDetector(const PinchGestureDetector&);
97 PinchGestureDetector& operator=(const PinchGestureDetector& rhs);
99 private: // GestureDetector overrides
102 * @copydoc Dali::Internal::GestureDetector::OnActorAttach(Actor&)
104 void OnActorAttach(Actor& actor) override;
107 * @copydoc Dali::Internal::GestureDetector::OnActorDetach(Actor&)
109 void OnActorDetach(Actor& actor) override;
112 * @copydoc Dali::Internal::GestureDetector::OnActorDestroyed(Object&)
114 void OnActorDestroyed(Object& object) override;
118 Dali::PinchGestureDetector::DetectedSignalType mDetectedSignal;
121 } // namespace Internal
123 // Helpers for public-api forwarding methods
125 inline Internal::PinchGestureDetector& GetImplementation(Dali::PinchGestureDetector& detector)
127 DALI_ASSERT_ALWAYS( detector && "PinchGestureDetector handle is empty" );
129 BaseObject& handle = detector.GetBaseObject();
131 return static_cast<Internal::PinchGestureDetector&>(handle);
134 inline const Internal::PinchGestureDetector& GetImplementation(const Dali::PinchGestureDetector& detector)
136 DALI_ASSERT_ALWAYS( detector && "PinchGestureDetector handle is empty" );
138 const BaseObject& handle = detector.GetBaseObject();
140 return static_cast<const Internal::PinchGestureDetector&>(handle);
145 #endif // DALI_INTERNAL_PINCH_GESTURE_DETECTOR_H