1 #ifndef DALI_INTERNAL_GESTURE_H
2 #define DALI_INTERNAL_GESTURE_H
5 * Copyright (c) 2020 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.h>
23 #include <dali/integration-api/events/event.h>
24 #include <dali/public-api/object/base-object.h>
33 typedef IntrusivePtr<Gesture> GesturePtr;
36 * This is the abstract base structure for any gestures that the adaptor detects and wishes to send
39 class Gesture : public BaseObject
43 using State = Dali::Gesture::State;
44 using Type = Dali::Gesture::Type;
49 * @brief Get the gesture type.
51 * @return The gesture type.
53 inline Type GetType() const
59 * @brief Set the state of the gesture.
60 * @param[in] state The state of the gesture to set
62 inline void SetState( State state )
68 * @brief Get the state of the gesture.
70 * @return The state of the gesture.
72 inline State GetState() const
78 * @brief Set The time the gesture took place.
79 * @param[in] time The time the gesture took place. to set
81 inline void SetTime( uint32_t time )
87 * @brief Get the time the gesture took place.
89 * @return The time the gesture took place.
91 inline uint32_t GetTime() const
96 Gesture(const Gesture&) = delete; ///< Deleted copy constructor
97 Gesture(Gesture&&) = delete; ///< Deleted move constructor
98 Gesture& operator=(const Gesture&) = delete; ///< Deleted copy assignment operator
99 Gesture& operator=(Gesture&&) = delete; ///< Deleted move assignment operator
104 * This constructor is only used by derived classes.
105 * @param[in] gestureType The type of gesture event.
106 * @param[in] gestureState The state of the gesture event.
108 Gesture(Type gestureType, State gestureState)
109 : mGestureType( gestureType ),
110 mState( gestureState )
115 * @brief Virtual destructor.
117 * A reference counted object may only be deleted by calling Unreference()
119 virtual ~Gesture() = default;
127 } // namespace Internal
130 * Helper methods for public API.
132 inline Internal::Gesture& GetImplementation(Dali::Gesture& gesture)
134 DALI_ASSERT_ALWAYS( gesture && "gesture handle is empty" );
136 BaseObject& handle = gesture.GetBaseObject();
138 return static_cast<Internal::Gesture&>(handle);
141 inline const Internal::Gesture& GetImplementation(const Dali::Gesture& gesture)
143 DALI_ASSERT_ALWAYS( gesture && "gesture handle is empty" );
145 const BaseObject& handle = gesture.GetBaseObject();
147 return static_cast<const Internal::Gesture&>(handle);
152 #endif // DALI_INTERNAL_GESTURE_H