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