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 using GesturePtr = IntrusivePtr<Gesture>;
36 * This is the abstract base structure for any gestures that the adaptor detects and wishes to send
39 class Gesture : public BaseObject
44 * @brief Get the gesture type.
46 * @return The gesture type.
48 inline GestureType::Value GetType() const
54 * @brief Set the state of the gesture.
55 * @param[in] state The state of the gesture to set
57 inline void SetState( GestureState state )
63 * @brief Get the state of the gesture.
65 * @return The state of the gesture.
67 inline GestureState GetState() const
73 * @brief Set The time the gesture took place.
74 * @param[in] time The time the gesture took place. to set
76 inline void SetTime( uint32_t time )
82 * @brief Get the time the gesture took place.
84 * @return The time the gesture took place.
86 inline uint32_t GetTime() const
91 Gesture(const Gesture&) = delete; ///< Deleted copy constructor
92 Gesture(Gesture&&) = delete; ///< Deleted move constructor
93 Gesture& operator=(const Gesture&) = delete; ///< Deleted copy assignment operator
94 Gesture& operator=(Gesture&&) = delete; ///< Deleted move assignment operator
99 * This constructor is only used by derived classes.
100 * @param[in] gestureType The type of gesture event.
101 * @param[in] gestureState The state of the gesture event.
103 Gesture(GestureType::Value gestureType, GestureState gestureState)
104 : mGestureType( gestureType ),
105 mState( gestureState )
110 * @brief Virtual destructor.
112 * A reference counted object may only be deleted by calling Unreference()
114 ~Gesture() override = default;
117 GestureType::Value mGestureType;
122 } // namespace Internal
125 * Helper methods for public API.
127 inline Internal::Gesture& GetImplementation(Dali::Gesture& gesture)
129 DALI_ASSERT_ALWAYS( gesture && "gesture handle is empty" );
131 BaseObject& handle = gesture.GetBaseObject();
133 return static_cast<Internal::Gesture&>(handle);
136 inline const Internal::Gesture& GetImplementation(const Dali::Gesture& gesture)
138 DALI_ASSERT_ALWAYS( gesture && "gesture handle is empty" );
140 const BaseObject& handle = gesture.GetBaseObject();
142 return static_cast<const Internal::Gesture&>(handle);
147 #endif // DALI_INTERNAL_GESTURE_H