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