Use modern construct 'using' instead of typedef.
[platform/core/uifw/dali-core.git] / dali / internal / event / events / long-press-gesture / long-press-gesture-impl.h
1 #ifndef DALI_INTERNAL_LONG_PRESS_GESTURE_H
2 #define DALI_INTERNAL_LONG_PRESS_GESTURE_H
3
4 /*
5  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/event/events/gesture-impl.h>
23 #include <dali/public-api/events/long-press-gesture.h>
24 #include <dali/public-api/math/vector2.h>
25
26 namespace Dali
27 {
28
29 namespace Internal
30 {
31
32 class LongPressGesture;
33 using LongPressGesturePtr = IntrusivePtr<LongPressGesture>;
34
35 /**
36  * @copydoc Dali::LongPressGesture
37  */
38 class LongPressGesture final : public Gesture
39 {
40 public:
41
42   /**
43    * Default Constructor
44    * @param[in]  state  STARTED, when we detect a long press.
45    *                    FINISHED, when all touches are finished.
46    */
47   LongPressGesture( GestureState state )
48   : Gesture( GestureType::LONG_PRESS, state )
49   {
50   }
51
52   LongPressGesture(const LongPressGesture&) = delete; ///< Deleted copy constructor
53   LongPressGesture(LongPressGesture&&) = delete; ///< Deleted move constructor
54   LongPressGesture& operator=(const LongPressGesture&) = delete; ///< Deleted copy assignment operator
55   LongPressGesture& operator=(LongPressGesture&&) = delete; ///< Deleted move assignment operator
56
57   /**
58    * @brief Set the number of touch points.
59    * @param[in] numberOfTouches The number of touch points to set.
60    */
61   inline void SetNumberOfTouches( uint32_t numberOfTouches )
62   {
63     mNumberOfTouches = numberOfTouches;
64   }
65
66   /**
67    * @copydoc Dali::LongPressGesture::GetNumberOfTouches()
68    */
69   inline uint32_t GetNumberOfTouches() const
70   {
71     return mNumberOfTouches;
72   }
73
74   /**
75    * @brief Set This is the point, in screen coordinates.
76    * @param[in] screenPoint The point in screen coordinates to set.
77    */
78   inline void SetScreenPoint( const Vector2& screenPoint )
79   {
80     mScreenPoint = screenPoint;
81   }
82
83   /**
84    * @copydoc Dali::LongPressGesture::GetScreenPoint()
85    */
86   inline const Vector2& GetScreenPoint() const
87   {
88     return mScreenPoint;
89   }
90
91   /**
92    * @brief Set This is the point, in local actor coordinates.
93    * @param[in] localPoint The point in local actor coordinates to set.
94    */
95   inline void SetLocalPoint( const Vector2& localPoint )
96   {
97     mLocalPoint = localPoint;
98   }
99
100   /**
101    * @copydoc Dali::LongPressGesture::GetLocalPoint()
102    */
103   inline const Vector2& GetLocalPoint() const
104   {
105     return mLocalPoint;
106   }
107
108 private:
109
110   /**
111    * @brief Virtual destructor
112    *
113    * A reference counted object may only be deleted by calling Unreference()
114    */
115   virtual ~LongPressGesture() = default;
116
117 private:
118   Vector2 mScreenPoint;
119   Vector2 mLocalPoint;
120   uint32_t mNumberOfTouches{1u};
121 };
122
123 } // namespace Internal
124
125 // Helpers for public-api forwarding methods
126
127 inline Internal::LongPressGesture& GetImplementation( Dali::LongPressGesture& longPressGesture )
128 {
129   DALI_ASSERT_ALWAYS( longPressGesture && "longPressGesture handle is empty" );
130
131   BaseObject& object = longPressGesture.GetBaseObject();
132
133   return static_cast< Internal::LongPressGesture& >( object );
134 }
135
136 inline const Internal::LongPressGesture& GetImplementation( const Dali::LongPressGesture& longPressGesture )
137 {
138   DALI_ASSERT_ALWAYS( longPressGesture && "longPressGesture handle is empty" );
139
140   const BaseObject& object = longPressGesture.GetBaseObject();
141
142   return static_cast< const Internal::LongPressGesture& >( object );
143 }
144
145 } // namespace Dali
146
147 #endif // DALI_INTERNAL_LONG_PRESS_GESTURE_H