use modern construct 'override' in the derive class.
[platform/core/uifw/dali-core.git] / dali / internal / event / events / pinch-gesture / pinch-gesture-detector-impl.h
1 #ifndef DALI_INTERNAL_PINCH_GESTURE_DETECTOR_H
2 #define DALI_INTERNAL_PINCH_GESTURE_DETECTOR_H
3
4 /*
5  * Copyright (c) 2020 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/pinch-gesture-detector.h>
23 #include <dali/public-api/events/pinch-gesture.h>
24 #include <dali/internal/event/events/gesture-detector-impl.h>
25
26 namespace Dali
27 {
28
29 namespace Internal
30 {
31
32 class PinchGestureDetector;
33
34 using PinchGestureDetectorPtr       = IntrusivePtr<PinchGestureDetector>;
35 using PinchGestureDetectorContainer = DerivedGestureDetectorContainer<PinchGestureDetector>::type;
36
37 /**
38  * @copydoc Dali::PinchGestureDetector
39  */
40 class PinchGestureDetector : public GestureDetector
41 {
42 public: // Creation
43
44   /**
45    * Create a new gesture detector.
46    * @return A smart-pointer to the newly allocated detector.
47    */
48   static PinchGestureDetectorPtr New();
49
50   /**
51    * Construct a new GestureDetector.
52    */
53   PinchGestureDetector();
54
55 public:
56
57   /**
58    * Called by the PinchGestureProcessor when a pinch gesture event occurs within the bounds of our
59    * attached actor.
60    * @param[in]  actor  The pinched actor.
61    * @param[in]  pinch  The pinch gesture.
62    */
63   void EmitPinchGestureSignal(Dali::Actor actor, const Dali::PinchGesture& pinch);
64
65 public: // Signals
66
67   /**
68    * @copydoc Dali::PinchGestureDetector::DetectedSignal()
69    */
70   Dali::PinchGestureDetector::DetectedSignalType& DetectedSignal()
71   {
72     return mDetectedSignal;
73   }
74
75   /**
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.
83    */
84   static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
85
86 protected:
87
88   /**
89    * A reference counted object may only be deleted by calling Unreference()
90    */
91   ~PinchGestureDetector() override;
92
93 private:
94
95   // Undefined
96   PinchGestureDetector(const PinchGestureDetector&);
97   PinchGestureDetector& operator=(const PinchGestureDetector& rhs);
98
99 private: // GestureDetector overrides
100
101   /**
102    * @copydoc Dali::Internal::GestureDetector::OnActorAttach(Actor&)
103    */
104   void OnActorAttach(Actor& actor) override;
105
106   /**
107    * @copydoc Dali::Internal::GestureDetector::OnActorDetach(Actor&)
108    */
109   void OnActorDetach(Actor& actor) override;
110
111   /**
112    * @copydoc Dali::Internal::GestureDetector::OnActorDestroyed(Object&)
113    */
114   void OnActorDestroyed(Object& object) override;
115
116 private:
117
118   Dali::PinchGestureDetector::DetectedSignalType mDetectedSignal;
119 };
120
121 } // namespace Internal
122
123 // Helpers for public-api forwarding methods
124
125 inline Internal::PinchGestureDetector& GetImplementation(Dali::PinchGestureDetector& detector)
126 {
127   DALI_ASSERT_ALWAYS( detector && "PinchGestureDetector handle is empty" );
128
129   BaseObject& handle = detector.GetBaseObject();
130
131   return static_cast<Internal::PinchGestureDetector&>(handle);
132 }
133
134 inline const Internal::PinchGestureDetector& GetImplementation(const Dali::PinchGestureDetector& detector)
135 {
136   DALI_ASSERT_ALWAYS( detector && "PinchGestureDetector handle is empty" );
137
138   const BaseObject& handle = detector.GetBaseObject();
139
140   return static_cast<const Internal::PinchGestureDetector&>(handle);
141 }
142
143 } // namespace Dali
144
145 #endif // DALI_INTERNAL_PINCH_GESTURE_DETECTOR_H