1 #ifndef DALI_INTERNAL_PINCH_GESTURE_DETECTOR_H
2 #define DALI_INTERNAL_PINCH_GESTURE_DETECTOR_H
5 * Copyright (c) 2021 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/internal/event/events/gesture-detector-impl.h>
23 #include <dali/public-api/events/pinch-gesture-detector.h>
24 #include <dali/public-api/events/pinch-gesture.h>
30 class PinchGestureDetector;
32 using PinchGestureDetectorPtr = IntrusivePtr<PinchGestureDetector>;
33 using PinchGestureDetectorContainer = DerivedGestureDetectorContainer<PinchGestureDetector>::type;
36 * @copydoc Dali::PinchGestureDetector
38 class PinchGestureDetector : public GestureDetector
42 * Create a new gesture detector.
43 * @return A smart-pointer to the newly allocated detector.
45 static PinchGestureDetectorPtr New();
48 * Construct a new GestureDetector.
50 PinchGestureDetector();
54 * Called by the PinchGestureProcessor when a pinch gesture event occurs within the bounds of our
56 * @param[in] actor The pinched actor.
57 * @param[in] pinch The pinch gesture.
59 void EmitPinchGestureSignal(Dali::Actor actor, const Dali::PinchGesture& pinch);
63 * @copydoc Dali::PinchGestureDetector::DetectedSignal()
65 Dali::PinchGestureDetector::DetectedSignalType& DetectedSignal()
67 return mDetectedSignal;
71 * Connects a callback function with the object's signals.
72 * @param[in] object The object providing the signal.
73 * @param[in] tracker Used to disconnect the signal.
74 * @param[in] signalName The signal to connect to.
75 * @param[in] functor A newly allocated FunctorDelegate.
76 * @return True if the signal was connected.
77 * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
79 static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
83 * A reference counted object may only be deleted by calling Unreference()
85 ~PinchGestureDetector() override;
89 PinchGestureDetector(const PinchGestureDetector&);
90 PinchGestureDetector& operator=(const PinchGestureDetector& rhs);
92 private: // GestureDetector overrides
94 * @copydoc Dali::Internal::GestureDetector::OnActorAttach(Actor&)
96 void OnActorAttach(Actor& actor) override;
99 * @copydoc Dali::Internal::GestureDetector::OnActorDetach(Actor&)
101 void OnActorDetach(Actor& actor) override;
104 * @copydoc Dali::Internal::GestureDetector::OnActorDestroyed(Object&)
106 void OnActorDestroyed(Object& object) override;
109 Dali::PinchGestureDetector::DetectedSignalType mDetectedSignal;
112 } // namespace Internal
114 // Helpers for public-api forwarding methods
116 inline Internal::PinchGestureDetector& GetImplementation(Dali::PinchGestureDetector& detector)
118 DALI_ASSERT_ALWAYS(detector && "PinchGestureDetector handle is empty");
120 BaseObject& handle = detector.GetBaseObject();
122 return static_cast<Internal::PinchGestureDetector&>(handle);
125 inline const Internal::PinchGestureDetector& GetImplementation(const Dali::PinchGestureDetector& detector)
127 DALI_ASSERT_ALWAYS(detector && "PinchGestureDetector handle is empty");
129 const BaseObject& handle = detector.GetBaseObject();
131 return static_cast<const Internal::PinchGestureDetector&>(handle);
136 #endif // DALI_INTERNAL_PINCH_GESTURE_DETECTOR_H