6f7695c0a01d1d473279e06c5eb1ce05a40cd3f5
[platform/core/uifw/dali-core.git] / dali / internal / event / events / pan-gesture / pan-gesture-event.h
1 #ifndef DALI_INTERNAL_EVENT_PAN_GESTURE_EVENT_H
2 #define DALI_INTERNAL_EVENT_PAN_GESTURE_EVENT_H
3
4 /*
5  * Copyright (c) 2019 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-event.h>
23 #include <dali/public-api/math/vector2.h>
24
25 namespace Dali
26 {
27
28 namespace Internal
29 {
30
31 /**
32  * If the adaptor detects a pan gesture, then it should create an instance of this structure and
33  * send it to the Core.
34  *
35  * A Pan Gesture event should be in one of five states:
36  * - POSSIBLE:   When the user first puts their finger down - Core needs to hit test the down point.
37  * - STARTED:    If a pan is detected.
38  * - CONTINUING: If after a pan is detected, it continues.
39  * - FINISHED:   If after a pan, the user lifts their finger(s).
40  * - CANCELLED:  If, after a down event, no pan is detected or a system interruption.
41  *
42  * A STARTED state will be ignored if a POSSIBLE state does not precede it.
43  * Likewise, a CONTINUING or FINISHED state will be ignored if a STARTED state does not precede it.
44  */
45 struct PanGestureEvent: public GestureEvent
46 {
47   // Construction & Destruction
48
49   /**
50    * Default Constructor
51    * @param[in]  state  The state of the gesture
52    */
53   PanGestureEvent(GestureState state);
54
55   /**
56    * Virtual destructor
57    */
58   virtual ~PanGestureEvent();
59
60   // Data
61
62   /**
63    * The previous touch position of the primary touch point in screen coordinates.
64    */
65   Vector2 previousPosition;
66
67   /**
68    * This current touch position of the primary touch point in screen coordinates.
69    */
70   Vector2 currentPosition;
71
72   /**
73    * The time difference between the previous and latest touch motion events (in ms).
74    */
75   unsigned long timeDelta;
76
77   /**
78    * The total number of fingers touching the screen in a pan gesture.
79    */
80   unsigned int numberOfTouches;
81 };
82
83 } // namespace Internal
84
85 } // namespace Dali
86
87 #endif // DALI_INTERNAL_EVENT_PAN_GESTURE_EVENT_H