OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_PARAMS_H_ |
| 6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_PARAMS_H_ |
| 7 |
| 8 #include "base/time/time.h" |
| 9 #include "ui/events/gesture_detection/gesture_detection_export.h" |
| 10 |
| 11 namespace ui { |
| 12 |
| 13 enum GestureEventType { |
| 14 GESTURE_SHOW_PRESS, |
| 15 GESTURE_DOUBLE_TAP, |
| 16 GESTURE_SINGLE_TAP_CONFIRMED, |
| 17 GESTURE_SINGLE_TAP_UNCONFIRMED, |
| 18 GESTURE_LONG_PRESS, |
| 19 GESTURE_SCROLL_BEGIN, |
| 20 GESTURE_SCROLL_UPDATE, |
| 21 GESTURE_SCROLL_END, |
| 22 GESTURE_FLING_START, |
| 23 GESTURE_FLING_CANCEL, |
| 24 GESTURE_PINCH_BEGIN, |
| 25 GESTURE_PINCH_UPDATE, |
| 26 GESTURE_PINCH_END, |
| 27 GESTURE_TAP_CANCEL, |
| 28 GESTURE_LONG_TAP, |
| 29 GESTURE_TAP_DOWN |
| 30 }; |
| 31 |
| 32 // TODO(jdduke): Convert all (x,y) and (width,height) pairs to their |
| 33 // corresponding gfx:: geometry types. |
| 34 struct GESTURE_DETECTION_EXPORT GestureEventParams { |
| 35 struct Data; |
| 36 GestureEventParams(GestureEventType type, |
| 37 base::TimeTicks time, |
| 38 float x, |
| 39 float y, |
| 40 const Data& data); |
| 41 |
| 42 GestureEventType type; |
| 43 base::TimeTicks time; |
| 44 float x; |
| 45 float y; |
| 46 |
| 47 // TODO(jdduke): Determine if we can simply re-use blink::WebGestureEvent, as |
| 48 // this is more or less straight up duplication. |
| 49 struct Data { |
| 50 Data(); |
| 51 union { |
| 52 struct { |
| 53 int tap_count; |
| 54 float width; |
| 55 float height; |
| 56 } tap; |
| 57 |
| 58 struct { |
| 59 float width; |
| 60 float height; |
| 61 } tap_down; |
| 62 |
| 63 struct { |
| 64 float width; |
| 65 float height; |
| 66 } show_press; |
| 67 |
| 68 struct { |
| 69 float width; |
| 70 float height; |
| 71 } long_press; |
| 72 |
| 73 struct { |
| 74 // Initial motion that triggered the scroll. |
| 75 // May be redundant with deltaX/deltaY in the first scrollUpdate. |
| 76 float delta_x_hint; |
| 77 float delta_y_hint; |
| 78 } scroll_begin; |
| 79 |
| 80 struct { |
| 81 float delta_x; |
| 82 float delta_y; |
| 83 float velocity_x; |
| 84 float velocity_y; |
| 85 } scroll_update; |
| 86 |
| 87 struct { |
| 88 float velocity_x; |
| 89 float velocity_y; |
| 90 } fling_start; |
| 91 |
| 92 struct { |
| 93 float scale; |
| 94 } pinch_update; |
| 95 }; |
| 96 } data; |
| 97 |
| 98 private: |
| 99 GestureEventParams(); |
| 100 }; |
| 101 |
| 102 } // namespace ui |
| 103 |
| 104 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_PARAMS_H_ |
OLD | NEW |