bf937892514f992c37d23b5587b7f08402fe8134
[platform/core/uifw/dali-core.git] / dali / public-api / events / gesture.h
1 #ifndef __DALI_GESTURE_H__
2 #define __DALI_GESTURE_H__
3
4 /*
5  * Copyright (c) 2018 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/public-api/common/dali-common.h>
23
24 namespace Dali
25 {
26 /**
27  * @addtogroup dali_core_events
28  * @{
29  */
30
31 /**
32  * @brief Base structure for different gestures that an application can receive.
33  *
34  * A gesture is an event that is produced from a combination of
35  * several touch events in a particular order or within a certain time
36  * frame (e.g pinch).
37  *
38  * To receive a particular gesture, the application has to create and connect to the appropriate
39  * GestureDetector.
40  *
41  * @SINCE_1_0.0
42  * @note An instance of this class cannot be created.
43  * @see GestureDetector
44  *
45  */
46 struct DALI_CORE_API Gesture
47 {
48   /**
49    * @brief Copy constructor.
50    * @SINCE_1_0.0
51    * @param[in] rhs A reference to the copied handle
52    */
53   Gesture( const Gesture& rhs );
54
55   /**
56    * @brief Assignment operator.
57    * @SINCE_1_0.0
58    * @param[in] rhs A reference to the copied handle
59    * @return A reference to this
60    */
61   Gesture& operator=( const Gesture& rhs );
62
63   // Destruction
64
65   /**
66    * @brief Virtual destructor.
67    * @SINCE_1_0.0
68    */
69   virtual ~Gesture();
70
71   /**
72    * @brief Enumeration for type of gesture.
73    * @SINCE_1_0.0
74    */
75   enum Type
76   {
77     Pinch      = 1 << 0, ///< When two touch points move away or towards each other. @SINCE_1_0.0
78     Pan        = 1 << 1, ///< When the user drags their finger(s) in a particular direction. @SINCE_1_0.0
79     Tap        = 1 << 2, ///< When the user taps the screen. @SINCE_1_0.0
80     LongPress  = 1 << 3  ///< When the user continues to touch the same area on the screen for the device configured time. @SINCE_1_0.0
81   };
82
83   /**
84    * @brief Enumeration for state of the gesture.
85    * @SINCE_1_0.0
86    */
87   enum State
88   {
89     Clear,      ///< There is no state associated with this gesture. @SINCE_1_0.0
90     Started,    ///< The touched points on the screen have moved enough to be considered a gesture. @SINCE_1_0.0
91     Continuing, ///< The gesture is continuing. @SINCE_1_0.0
92     Finished,   ///< The user has lifted a finger or touched an additional point on the screen. @SINCE_1_0.0
93     Cancelled,  ///< The gesture has been cancelled. @SINCE_1_0.0
94     Possible    ///< A gesture is possible. @SINCE_1_0.0
95   };
96
97   // Data
98
99   /**
100    * @brief The gesture type.
101    */
102   Type type;
103
104   /**
105    * @brief The gesture state.
106    *
107    * Please see the description in the sub-classes to see the states
108    * used by the actual gesture.
109    */
110   State state;
111
112   /**
113    * @brief The time the gesture took place.
114    */
115   unsigned int time;
116
117 protected: // Creation
118
119   /**
120    * @brief This constructor is only used by derived classes.
121    *
122    * @SINCE_1_0.0
123    * @param[in] gestureType   The type of gesture event.
124    * @param[in] gestureState  The state of the gesture event.
125    */
126   Gesture(Type gestureType, State gestureState);
127
128 };
129
130 /**
131  * @}
132  */
133 } // namespace Dali
134
135 #endif // __DALI_GESTURE_H__