1 #ifndef DALI_INTERNAL_GESTURE_H
2 #define DALI_INTERNAL_GESTURE_H
5 * Copyright (c) 2022 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/integration-api/events/event.h>
23 #include <dali/public-api/events/gesture.h>
24 #include <dali/public-api/object/base-object.h>
31 using GesturePtr = IntrusivePtr<Gesture>;
34 * This is the abstract base structure for any gestures that the adaptor detects and wishes to send
37 class Gesture : public BaseObject
41 * @brief Get the gesture type.
43 * @return The gesture type.
45 inline GestureType::Value GetType() const
51 * @brief Set the state of the gesture.
52 * @param[in] state The state of the gesture to set
54 inline void SetState(GestureState state)
60 * @brief Get the state of the gesture.
62 * @return The state of the gesture.
64 inline GestureState GetState() const
70 * @brief Set The time the gesture took place.
71 * @param[in] time The time the gesture took place. to set
73 inline void SetTime(uint32_t time)
79 * @brief Get the time the gesture took place.
81 * @return The time the gesture took place.
83 inline uint32_t GetTime() const
89 * @brief Sets the value of which source the gesture was started with. (ex : mouse)
90 * @param[in] source The gesture source type.
92 inline void SetSourceType(GestureSourceType source)
98 * @brief Gets the value of which source the gesture was started with.
99 * @return The gesture source type.
101 inline GestureSourceType GetSourceType() const
107 * @brief Sets the value of source data.
108 * @param[in] data The gesture source data.
110 inline void SetSourceData(GestureSourceData data)
116 * @brief Gets the data of source type.
117 * @return The gesture source data.
119 inline GestureSourceData GetSourceData() const
124 Gesture(const Gesture&) = delete; ///< Deleted copy constructor
125 Gesture(Gesture&&) = delete; ///< Deleted move constructor
126 Gesture& operator=(const Gesture&) = delete; ///< Deleted copy assignment operator
127 Gesture& operator=(Gesture&&) = delete; ///< Deleted move assignment operator
131 * This constructor is only used by derived classes.
132 * @param[in] gestureType The type of gesture event.
133 * @param[in] gestureState The state of the gesture event.
135 Gesture(GestureType::Value gestureType, GestureState gestureState)
136 : mGestureType(gestureType),
137 mState(gestureState),
138 mSourceType(GestureSourceType::INVALID),
139 mSourceData(GestureSourceData::INVALID)
144 * @brief Virtual destructor.
146 * A reference counted object may only be deleted by calling Unreference()
148 ~Gesture() override = default;
151 GestureType::Value mGestureType;
154 GestureSourceType mSourceType;
155 GestureSourceData mSourceData;
158 } // namespace Internal
161 * Helper methods for public API.
163 inline Internal::Gesture& GetImplementation(Dali::Gesture& gesture)
165 DALI_ASSERT_ALWAYS(gesture && "gesture handle is empty");
167 BaseObject& handle = gesture.GetBaseObject();
169 return static_cast<Internal::Gesture&>(handle);
172 inline const Internal::Gesture& GetImplementation(const Dali::Gesture& gesture)
174 DALI_ASSERT_ALWAYS(gesture && "gesture handle is empty");
176 const BaseObject& handle = gesture.GetBaseObject();
178 return static_cast<const Internal::Gesture&>(handle);
183 #endif // DALI_INTERNAL_GESTURE_H