1 #ifndef DALI_INTERNAL_TAP_GESTURE_H
2 #define DALI_INTERNAL_TAP_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/math/vector2.h>
23 #include <dali/public-api/object/base-object.h>
24 #include <dali/public-api/events/tap-gesture.h>
25 #include <dali/internal/event/events/gesture-impl.h>
34 typedef IntrusivePtr< TapGesture > TapGesturePtr;
37 * @copydoc Dali::TapGesture
39 class TapGesture final : public Gesture
44 * @brief Default constructor
46 TapGesture( GestureState state )
47 : Gesture(GestureType::TAP, state)
51 TapGesture(const TapGesture&) = delete; ///< Deleted copy constructor
52 TapGesture(TapGesture&&) = delete; ///< Deleted move constructor
53 TapGesture& operator=(const TapGesture&) = delete; ///< Deleted copy assignment operator
54 TapGesture& operator=(TapGesture&&) = delete; ///< Deleted move assignment operator
57 * @brief The number of taps in this tap gesture.
58 * @param[in] numberOfTaps The number of taps to set.
60 inline void SetNumberOfTaps( uint32_t numberOfTaps )
62 mNumberOfTaps = numberOfTaps;
66 * @copydoc Dali::TapGesture::GetNumberOfTaps()
68 inline uint32_t GetNumberOfTaps() const
74 * @brief The number of touch points in this tap gesture, i.e. the number of fingers the user had on the screen to generate the tap gesture.
75 * @param[in] numberOfTouches The number of touch points in this tap gesture to set.
77 inline void SetNumberOfTouches( uint32_t numberOfTouches )
79 mNumberOfTouches = numberOfTouches;
83 * @copydoc Dali::TapGesture::GetPointCount()
85 inline uint32_t GetNumberOfTouches() const
87 return mNumberOfTouches;
91 * @brief This is the point, in screen coordinates, where the tap occurred.
92 * @param[in] screenPoint The point in screen coordinates to set.
94 inline void SetScreenPoint( const Vector2& screenPoint )
96 mScreenPoint = screenPoint;
100 * @copydoc Dali::TapGesture::GetDeviceId()
102 inline const Vector2& GetScreenPoint() const
108 * @brief This is the point, in local actor coordinates, where the tap occurred.
109 * @param[in] localPoint The point in local actor coordinates to set.
111 inline void SetLocalPoint( const Vector2& localPoint )
113 mLocalPoint = localPoint;
117 * @copydoc Dali::TapGesture::GetGetState()
119 inline const Vector2& GetLocalPoint() const
127 * @brief Virtual destructor
129 * A reference counted object may only be deleted by calling Unreference()
131 virtual ~TapGesture() = default;
134 Vector2 mScreenPoint;
136 uint32_t mNumberOfTaps{1u};
137 uint32_t mNumberOfTouches{1u};
140 } // namespace Internal
142 // Helpers for public-api forwarding methods
144 inline Internal::TapGesture& GetImplementation( Dali::TapGesture& tapGesture )
146 DALI_ASSERT_ALWAYS( tapGesture && "TapGesture handle is empty" );
148 BaseObject& object = tapGesture.GetBaseObject();
150 return static_cast< Internal::TapGesture& >( object );
153 inline const Internal::TapGesture& GetImplementation( const Dali::TapGesture& tapGesture )
155 DALI_ASSERT_ALWAYS( tapGesture && "TapGesture handle is empty" );
157 const BaseObject& object = tapGesture.GetBaseObject();
159 return static_cast< const Internal::TapGesture& >( object );
164 #endif // DALI_INTERNAL_TAP_GESTURE_H