| 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.h" | 10 #include "ui/base/events.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 } | 62 } |
| 63 bool swipe_up() const { | 63 bool swipe_up() const { |
| 64 CHECK_EQ(ui::ET_GESTURE_MULTIFINGER_SWIPE, type_); | 64 CHECK_EQ(ui::ET_GESTURE_MULTIFINGER_SWIPE, type_); |
| 65 return data.swipe.up; | 65 return data.swipe.up; |
| 66 } | 66 } |
| 67 bool swipe_down() const { | 67 bool swipe_down() const { |
| 68 CHECK_EQ(ui::ET_GESTURE_MULTIFINGER_SWIPE, type_); | 68 CHECK_EQ(ui::ET_GESTURE_MULTIFINGER_SWIPE, type_); |
| 69 return data.swipe.down; | 69 return data.swipe.down; |
| 70 } | 70 } |
| 71 | 71 |
| 72 float generic_x() const { | 72 int tap_count() const { |
| 73 return data.generic.delta_x; | 73 CHECK_EQ(ui::ET_GESTURE_TAP, type_); |
| 74 } | 74 return data.tap_count; |
| 75 | |
| 76 float generic_y() const { | |
| 77 return data.generic.delta_y; | |
| 78 } | 75 } |
| 79 | 76 |
| 80 private: | 77 private: |
| 81 ui::EventType type_; | 78 ui::EventType type_; |
| 82 union { | 79 union { |
| 83 struct { // SCROLL delta. | 80 struct { // SCROLL delta. |
| 84 float x; | 81 float x; |
| 85 float y; | 82 float y; |
| 86 } scroll; | 83 } scroll; |
| 87 | 84 |
| 88 float scale; // PINCH scale. | 85 float scale; // PINCH scale. |
| 89 | 86 |
| 90 struct { // FLING velocity. | 87 struct { // FLING velocity. |
| 91 float x; | 88 float x; |
| 92 float y; | 89 float y; |
| 93 } velocity; | 90 } velocity; |
| 94 | 91 |
| 95 int touch_id; // LONG_PRESS touch-id. | 92 int touch_id; // LONG_PRESS touch-id. |
| 96 | 93 |
| 97 struct { // SWIPE direction. | 94 struct { // SWIPE direction. |
| 98 bool left; | 95 bool left; |
| 99 bool right; | 96 bool right; |
| 100 bool up; | 97 bool up; |
| 101 bool down; | 98 bool down; |
| 102 } swipe; | 99 } swipe; |
| 103 | 100 |
| 101 int tap_count; // TAP repeat count. |
| 102 |
| 104 struct { | 103 struct { |
| 105 float delta_x; | 104 float delta_x; |
| 106 float delta_y; | 105 float delta_y; |
| 107 } generic; | 106 } generic; |
| 108 } data; | 107 } data; |
| 109 | 108 |
| 110 int touch_points_; // Number of active touch points in the gesture. | 109 int touch_points_; // Number of active touch points in the gesture. |
| 111 | 110 |
| 112 // Bounding box is an axis-aligned rectangle that contains all the | 111 // Bounding box is an axis-aligned rectangle that contains all the |
| 113 // enclosing rectangles of the touch-points in the gesture. | 112 // enclosing rectangles of the touch-points in the gesture. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 int touch_id, | 191 int touch_id, |
| 193 base::TimeDelta time_stamp) = 0; | 192 base::TimeDelta time_stamp) = 0; |
| 194 | 193 |
| 195 virtual bool DispatchLongPressGestureEvent(GestureEvent* event) = 0; | 194 virtual bool DispatchLongPressGestureEvent(GestureEvent* event) = 0; |
| 196 virtual bool DispatchCancelTouchEvent(TouchEvent* event) = 0; | 195 virtual bool DispatchCancelTouchEvent(TouchEvent* event) = 0; |
| 197 }; | 196 }; |
| 198 | 197 |
| 199 } // namespace ui | 198 } // namespace ui |
| 200 | 199 |
| 201 #endif // UI_BASE_GESTURES_GESTURE_TYPES_H_ | 200 #endif // UI_BASE_GESTURES_GESTURE_TYPES_H_ |
| OLD | NEW |