[dali_1.1.4] Merge branch 'devel/master'
[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) 2015 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  * @see GestureDetector
42  *
43  * @note An instance of this class cannot be created.
44  */
45 struct DALI_IMPORT_API Gesture
46 {
47   /**
48    * @brief Copy constructor.
49    */
50   Gesture( const Gesture& rhs );
51
52   /**
53    * @brief Assignment operator.
54    */
55   Gesture& operator=( const Gesture& rhs );
56
57   // Destruction
58
59   /**
60    * @brief Virtual destructor.
61    */
62   virtual ~Gesture();
63
64   /**
65    * @brief Type of gesture.
66    */
67   enum Type
68   {
69     Pinch      = 1 << 0, ///< When two touch points move away or towards each other.
70     Pan        = 1 << 1, ///< When the user drags their finger(s) in a particular direction.
71     Tap        = 1 << 2, ///< When the user taps the screen.
72     LongPress  = 1 << 3  ///< When the user continues to touch the same area on the screen for the device configured time.
73   };
74
75   /**
76    * @brief State of the gesture.
77    */
78   enum State
79   {
80     Clear,      ///< There is no state associated with this gesture.
81     Started,    ///< The touched points on the screen have moved enough to be considered a gesture.
82     Continuing, ///< The gesture is continuing.
83     Finished,   ///< The user has lifted a finger or touched an additional point on the screen.
84     Cancelled,  ///< The gesture has been cancelled.
85     Possible    ///< A gesture is possible.
86   };
87
88   // Data
89
90   /**
91    * @brief The gesture type.
92    */
93   Type type;
94
95   /**
96    * @brief The gesture state.
97    *
98    * Please see the description in the sub-classes to see the states
99    * used by the actual gesture.
100    */
101   State state;
102
103   /**
104    * @brief The time the gesture took place.
105    */
106   unsigned int time;
107
108 protected: // Creation
109
110   /**
111    * @brief This constructor is only used by derived classes.
112    *
113    * @param[in] gestureType   The type of gesture event.
114    * @param[in] gestureState  The state of the gesture event.
115    */
116   Gesture(Type gestureType, State gestureState);
117
118 };
119
120 /**
121  * @}
122  */
123 } // namespace Dali
124
125 #endif // __DALI_GESTURE_H__