1 #ifndef __DALI_GESTURE_DETECTOR_H__
2 #define __DALI_GESTURE_DETECTOR_H__
5 * Copyright (c) 2015 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/common/vector-wrapper.h>
23 #include <dali/public-api/object/handle.h>
28 * @addtogroup dali_core_events
32 namespace Internal DALI_INTERNAL
34 class GestureDetector;
40 * @brief GestureDetectors analyse a stream of touch events and attempt to determine the intention of the user.
42 * An actor is attached to a gesture detector and if the detector recognises a pattern in its analysis, it will
43 * emit a detected signal to the application.
45 * This is the base class for different gesture detectors available and provides functionality that is common
46 * to all the gesture detectors.
50 class DALI_IMPORT_API GestureDetector : public Handle
52 public: // Creation & Destruction
55 * @brief Create an uninitialized GestureDetector; this can be initialized with one of the derived gestures' New() methods.
57 * Calling member functions with an uninitialized Dali::Object is not allowed.
62 * @brief Downcast an Object handle to GestureDetector handle.
64 * If handle points to a GestureDetector object the
65 * downcast produces valid handle. If not the returned handle is left uninitialized.
66 * @param[in] handle to An object
67 * @return handle to a GestureDetector object or an uninitialized handle
69 static GestureDetector DownCast( BaseHandle handle );
72 * @brief Dali::GestureDetector is intended as a base class
74 * This is non-virtual since derived Handle types must not contain data or virtual methods.
79 * @brief This copy constructor is required for (smart) pointer semantics.
81 * @param [in] handle A reference to the copied handle
83 GestureDetector(const GestureDetector& handle);
86 * @brief This assignment operator is required for (smart) pointer semantics.
88 * @param [in] rhs A reference to the copied handle
89 * @return A reference to this
91 GestureDetector& operator=(const GestureDetector& rhs);
93 public: // Actor related
96 * @brief Attaches an actor to the gesture.
98 * The detected signal will be dispatched when the gesture occurs on
100 * @note You can attach several actors to a gesture detector.
101 * @param[in] actor The actor to attach to the gesture detector
102 * @pre The gesture detector has been initialized.
104 void Attach(Actor actor);
107 * @brief Detaches the attached actor from the gesture detector.
109 * @param[in] actor The actor to detach from the gesture detector.
110 * @pre The gesture detector has been initialized.
111 * @pre The specified actor has been attached to the gesture detector.
113 void Detach(Actor actor);
116 * @brief Detaches all the actors that have been attached to the gesture detector.
118 * @pre The gesture detector has been initialized.
119 * @pre At least one actor has been attached to the gesture detector.
124 * @brief Returns the number of actors attached to the gesture detector.
127 * @pre The gesture detector has been initialized.
129 size_t GetAttachedActorCount() const;
132 * @brief Returns an actor by index. An empty handle if the index is not valid.
134 * @return The attached actor or an empty handle.
135 * @pre The gesture detector has been initialized.
137 Actor GetAttachedActor(size_t index) const;
142 * @brief This constructor is used by Dali New() methods of derived classes.
144 * @param [in] internal A pointer to a newly allocated Dali resource.
146 explicit DALI_INTERNAL GestureDetector(Internal::GestureDetector* internal);
154 #endif // __DALI_GESTURE_DETECTOR_H__