1 #ifndef DALI_INTERNAL_GESTURE_H
2 #define DALI_INTERNAL_GESTURE_H
5 * Copyright (c) 2021 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
88 Gesture(const Gesture&) = delete; ///< Deleted copy constructor
89 Gesture(Gesture&&) = delete; ///< Deleted move constructor
90 Gesture& operator=(const Gesture&) = delete; ///< Deleted copy assignment operator
91 Gesture& operator=(Gesture&&) = delete; ///< Deleted move assignment operator
95 * This constructor is only used by derived classes.
96 * @param[in] gestureType The type of gesture event.
97 * @param[in] gestureState The state of the gesture event.
99 Gesture(GestureType::Value gestureType, GestureState gestureState)
100 : mGestureType(gestureType),
106 * @brief Virtual destructor.
108 * A reference counted object may only be deleted by calling Unreference()
110 ~Gesture() override = default;
113 GestureType::Value mGestureType;
118 } // namespace Internal
121 * Helper methods for public API.
123 inline Internal::Gesture& GetImplementation(Dali::Gesture& gesture)
125 DALI_ASSERT_ALWAYS(gesture && "gesture handle is empty");
127 BaseObject& handle = gesture.GetBaseObject();
129 return static_cast<Internal::Gesture&>(handle);
132 inline const Internal::Gesture& GetImplementation(const Dali::Gesture& gesture)
134 DALI_ASSERT_ALWAYS(gesture && "gesture handle is empty");
136 const BaseObject& handle = gesture.GetBaseObject();
138 return static_cast<const Internal::Gesture&>(handle);
143 #endif // DALI_INTERNAL_GESTURE_H