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