| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_BASE_GESTURES_GESTURE_TYPES_H_ | 5 #ifndef UI_BASE_GESTURES_GESTURE_TYPES_H_ |
| 6 #define UI_BASE_GESTURES_GESTURE_TYPES_H_ | 6 #define UI_BASE_GESTURES_GESTURE_TYPES_H_ |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "ui/base/events/event_constants.h" | 10 #include "ui/base/events/event_constants.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 data.scroll_update.velocity_y; | 53 data.scroll_update.velocity_y; |
| 54 } | 54 } |
| 55 | 55 |
| 56 int touch_id() const { | 56 int touch_id() const { |
| 57 CHECK_EQ(ui::ET_GESTURE_LONG_PRESS, type_); | 57 CHECK_EQ(ui::ET_GESTURE_LONG_PRESS, type_); |
| 58 return data.touch_id; | 58 return data.touch_id; |
| 59 } | 59 } |
| 60 | 60 |
| 61 float scale() const { | 61 float scale() const { |
| 62 CHECK_EQ(ui::ET_GESTURE_PINCH_UPDATE, type_); | 62 CHECK_EQ(ui::ET_GESTURE_PINCH_UPDATE, type_); |
| 63 return data.scale; | 63 return data.pinch.scale; |
| 64 } |
| 65 |
| 66 float rotation() const { |
| 67 CHECK_EQ(ui::ET_GESTURE_PINCH_UPDATE, type_); |
| 68 return data.pinch.rotation; |
| 64 } | 69 } |
| 65 | 70 |
| 66 bool swipe_left() const { | 71 bool swipe_left() const { |
| 67 CHECK_EQ(ui::ET_GESTURE_MULTIFINGER_SWIPE, type_); | 72 CHECK_EQ(ui::ET_GESTURE_MULTIFINGER_SWIPE, type_); |
| 68 return data.swipe.left; | 73 return data.swipe.left; |
| 69 } | 74 } |
| 70 | 75 |
| 71 bool swipe_right() const { | 76 bool swipe_right() const { |
| 72 CHECK_EQ(ui::ET_GESTURE_MULTIFINGER_SWIPE, type_); | 77 CHECK_EQ(ui::ET_GESTURE_MULTIFINGER_SWIPE, type_); |
| 73 return data.swipe.right; | 78 return data.swipe.right; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 91 private: | 96 private: |
| 92 ui::EventType type_; | 97 ui::EventType type_; |
| 93 union { | 98 union { |
| 94 struct { // SCROLL delta. | 99 struct { // SCROLL delta. |
| 95 float x; | 100 float x; |
| 96 float y; | 101 float y; |
| 97 float velocity_x; | 102 float velocity_x; |
| 98 float velocity_y; | 103 float velocity_y; |
| 99 } scroll_update; | 104 } scroll_update; |
| 100 | 105 |
| 101 float scale; // PINCH scale. | 106 struct { // PINCH scale, rotation. |
| 107 float scale; |
| 108 float rotation; |
| 109 } pinch; |
| 102 | 110 |
| 103 struct { // FLING velocity. | 111 struct { // FLING velocity. |
| 104 float x; | 112 float x; |
| 105 float y; | 113 float y; |
| 106 } fling_velocity; | 114 } fling_velocity; |
| 107 | 115 |
| 108 int touch_id; // LONG_PRESS touch-id. | 116 int touch_id; // LONG_PRESS touch-id. |
| 109 | 117 |
| 110 struct { // SWIPE direction. | 118 struct { // SWIPE direction. |
| 111 bool left; | 119 bool left; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 virtual ~GestureEventHelper() { | 161 virtual ~GestureEventHelper() { |
| 154 } | 162 } |
| 155 | 163 |
| 156 virtual bool DispatchLongPressGestureEvent(GestureEvent* event) = 0; | 164 virtual bool DispatchLongPressGestureEvent(GestureEvent* event) = 0; |
| 157 virtual bool DispatchCancelTouchEvent(TouchEvent* event) = 0; | 165 virtual bool DispatchCancelTouchEvent(TouchEvent* event) = 0; |
| 158 }; | 166 }; |
| 159 | 167 |
| 160 } // namespace ui | 168 } // namespace ui |
| 161 | 169 |
| 162 #endif // UI_BASE_GESTURES_GESTURE_TYPES_H_ | 170 #endif // UI_BASE_GESTURES_GESTURE_TYPES_H_ |
| OLD | NEW |