4647801e4323d7e890c1b2b7bcab9ac4e6d82176
[platform/core/uifw/dali-core.git] / dali / public-api / events / rotation-gesture-detector.h
1 #ifndef DALI_ROTATION_GESTURE_DETECTOR_H
2 #define DALI_ROTATION_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/gesture-detector.h>
23 #include <dali/public-api/signals/dali-signal.h>
24
25 namespace Dali
26 {
27
28 namespace Internal DALI_INTERNAL
29 {
30 class RotationGestureDetector;
31 }
32
33 class RotationGesture;
34
35 /**
36  * @brief This class looks for a rotation gesture involving two touches.
37  *
38  * It measures the relative rotation of two touch points & emits a signal
39  * when this changes. Please see RotationGesture for more information.
40  *
41  * The application programmer can use this gesture detector as follows:
42  * @code
43  * RotationGestureDetector detector = RotationGestureDetector::New();
44  * detector.Attach( myActor );
45  * detector.DetectedSignal().Connect( this, &MyApplication::OnRotation );
46  * @endcode
47  *
48  * @see RotationGesture
49  *
50  * Signals
51  * | %Signal Name      | Method                |
52  * |-------------------|-----------------------|
53  * | rotationDetected  | @ref DetectedSignal() |
54  *
55  * @SINCE_1_9.27
56  */
57 class DALI_CORE_API RotationGestureDetector : public GestureDetector
58 {
59 public: // Typedefs
60
61   /**
62    * @brief Signal type.
63    */
64   typedef Signal< void ( Actor, const RotationGesture& ) > DetectedSignalType;
65
66 public: // Creation & Destruction
67
68   /**
69    * @brief Creates an uninitialized RotationGestureDetector; this can be initialized with RotationGestureDetector::New().
70    *
71    * @SINCE_1_9.27
72    * Calling member functions with an uninitialized RotationGestureDetector handle is not allowed.
73    */
74   RotationGestureDetector();
75
76   /**
77    * @brief Creates an initialized RotationGestureDetector.
78    *
79    * @SINCE_1_9.27
80    * @return A handle to a newly allocated Dali resource
81    */
82   static RotationGestureDetector New();
83
84   /**
85    * @brief Downcasts a handle to RotationGestureDetector handle.
86    *
87    * @SINCE_1_9.27
88    * If handle points to a RotationGestureDetector object, the
89    * downcast produces valid handle. If not, the returned handle is left uninitialized.
90    * @param[in] handle Handle to an object
91    * @return Handle to a RotationGestureDetector object or an uninitialized handle
92    */
93   static RotationGestureDetector DownCast( BaseHandle handle );
94
95   /**
96    * @brief Destructor.
97    *
98    * @SINCE_1_9.27
99    * This is non-virtual since derived Handle types must not contain data or virtual methods.
100    */
101   ~RotationGestureDetector();
102
103   /**
104    * @brief This copy constructor is required for (smart) pointer semantics.
105    *
106    * @SINCE_1_9.27
107    * @param[in] handle A reference to the copied handle
108    */
109   RotationGestureDetector(const RotationGestureDetector& handle);
110
111   /**
112    * @brief This assignment operator is required for (smart) pointer semantics.
113    *
114    * @SINCE_1_9.27
115    * @param[in] rhs A reference to the copied handle
116    * @return A reference to this
117    */
118   RotationGestureDetector& operator=(const RotationGestureDetector& rhs);
119
120 public: // Signals
121
122   /**
123    * @brief This signal is emitted when the rotation gesture is detected on the attached actor.
124    *
125    * A callback of the following type may be connected:
126    * @code
127    *   void YourCallbackName( Actor actor, const RotationGesture& gesture );
128    * @endcode
129    * @SINCE_1_9.27
130    * @return The signal to connect to
131    * @pre The gesture detector has been initialized.
132    */
133   DetectedSignalType& DetectedSignal();
134
135 public: // Not intended for Application developers
136
137   /// @cond internal
138   /**
139    * @brief This constructor is used by RotationGestureDetector::New() methods.
140    *
141    * @SINCE_1_9.27
142    * @param[in] internal A pointer to a newly allocated Dali resource
143    */
144   explicit DALI_INTERNAL RotationGestureDetector(Internal::RotationGestureDetector* internal);
145   /// @endcond
146
147 };
148
149 } // namespace Dali
150
151 #endif // DALI_ROTATION_GESTURE_DETECTOR_H