1 #ifndef __DALI_PINCH_GESTURE_DETECTOR_H__
2 #define __DALI_PINCH_GESTURE_DETECTOR_H__
5 * Copyright (c) 2014 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/gesture-detector.h>
23 #include <dali/public-api/signals/dali-signal-v2.h>
25 namespace Dali DALI_IMPORT_API
28 namespace Internal DALI_INTERNAL
30 class PinchGestureDetector;
36 * @brief This class looks for pinching gestures involving two touches.
38 * It tries to detect when the user moves two touch points towards or
39 * away from each other. Please see PinchGesture for more
42 * The application programmer can use this gesture detector as follows:
44 * PinchGestureDetector detector = PinchGestureDetector::New();
45 * detector.Attach(myActor);
46 * detector.DetectedSignal().Connect(this, &MyApplication::OnPinch);
51 class PinchGestureDetector : public GestureDetector
58 typedef SignalV2< void (Actor, PinchGesture) > DetectedSignalV2;
61 static const char* const SIGNAL_PINCH_DETECTED; ///< name "pinch-detected"
63 public: // Creation & Destruction
66 * @brief Create an uninitialized PinchGestureDetector; this can be initialized with PinchGestureDetector::New().
68 * Calling member functions with an uninitialized Dali::Object is not allowed.
70 PinchGestureDetector();
73 * @brief Create an initialized PinchGestureDetector.
75 * @return A handle to a newly allocated Dali resource.
77 static PinchGestureDetector New();
80 * @brief Downcast an Object handle to PinchGestureDetector handle.
82 * If handle points to a PinchGestureDetector object the
83 * downcast produces valid handle. If not the returned handle is left uninitialized.
84 * @param[in] handle to An object
85 * @return handle to a PinchGestureDetector object or an uninitialized handle
87 static PinchGestureDetector DownCast( BaseHandle handle );
92 * This is non-virtual since derived Handle types must not contain data or virtual methods.
94 ~PinchGestureDetector();
97 * @brief This copy constructor is required for (smart) pointer semantics.
99 * @param [in] handle A reference to the copied handle
101 PinchGestureDetector(const PinchGestureDetector& handle);
104 * @brief This assignment operator is required for (smart) pointer semantics.
106 * @param [in] rhs A reference to the copied handle
107 * @return A reference to this
109 PinchGestureDetector& operator=(const PinchGestureDetector& rhs);
112 * @brief This method is defined to allow assignment of the NULL value,
113 * and will throw an exception if passed any other value.
115 * Assigning to NULL is an alias for Reset().
116 * @param [in] rhs A NULL pointer
117 * @return A reference to this handle
119 PinchGestureDetector& operator=(BaseHandle::NullType* rhs);
124 * @brief This signal is emitted when the pinch gesture is detected on the attached actor.
126 * A callback of the following type may be connected:
128 * void YourCallbackName(Actor actor, PinchGesture gesture);
130 * @pre The gesture detector has been initialized.
131 * @return The signal to connect to.
133 DetectedSignalV2& DetectedSignal();
135 public: // Not intended for Application developers
138 * @brief This constructor is used by Dali New() methods.
140 * @param [in] internal A pointer to a newly allocated Dali resource.
142 explicit DALI_INTERNAL PinchGestureDetector(Internal::PinchGestureDetector* internal);
148 #endif // __DALI_PINCH_GESTURE_DETECTOR_H__