| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_ | 5 #ifndef UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_ |
| 6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_ | 6 #define UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_ |
| 7 | 7 |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "ui/events/event_constants.h" | 9 #include "ui/events/event_constants.h" |
| 10 #include "ui/events/events_base_export.h" | 10 #include "ui/events/events_base_export.h" |
| 11 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
| 12 #include "ui/gfx/rect_conversions.h" | 12 #include "ui/gfx/rect_conversions.h" |
| 13 | 13 |
| 14 namespace ui { | 14 namespace ui { |
| 15 | 15 |
| 16 struct EVENTS_BASE_EXPORT GestureEventDetails { | 16 struct EVENTS_BASE_EXPORT GestureEventDetails { |
| 17 public: | 17 public: |
| 18 GestureEventDetails(); | 18 GestureEventDetails(); |
| 19 GestureEventDetails(EventType type); |
| 19 GestureEventDetails(EventType type, float delta_x, float delta_y); | 20 GestureEventDetails(EventType type, float delta_x, float delta_y); |
| 20 | 21 |
| 21 EventType type() const { return type_; } | 22 EventType type() const { return type_; } |
| 22 | 23 |
| 23 int touch_points() const { return touch_points_; } | 24 int touch_points() const { return touch_points_; } |
| 24 void set_touch_points(int touch_points) { | 25 void set_touch_points(int touch_points) { |
| 25 DCHECK_GT(touch_points, 0); | 26 DCHECK_GT(touch_points, 0); |
| 26 touch_points_ = touch_points; | 27 touch_points_ = touch_points; |
| 27 } | 28 } |
| 28 | 29 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 117 } |
| 117 | 118 |
| 118 void set_tap_count(int tap_count) { | 119 void set_tap_count(int tap_count) { |
| 119 DCHECK_GE(tap_count, 0); | 120 DCHECK_GE(tap_count, 0); |
| 120 DCHECK(type_ == ET_GESTURE_TAP || | 121 DCHECK(type_ == ET_GESTURE_TAP || |
| 121 type_ == ET_GESTURE_TAP_UNCONFIRMED || | 122 type_ == ET_GESTURE_TAP_UNCONFIRMED || |
| 122 type_ == ET_GESTURE_DOUBLE_TAP); | 123 type_ == ET_GESTURE_DOUBLE_TAP); |
| 123 data.tap_count = tap_count; | 124 data.tap_count = tap_count; |
| 124 } | 125 } |
| 125 | 126 |
| 127 void set_scale(float scale) { |
| 128 DCHECK_GE(scale, 0.0f); |
| 129 DCHECK_EQ(type_, ET_GESTURE_PINCH_UPDATE); |
| 130 data.scale = scale; |
| 131 } |
| 132 |
| 126 private: | 133 private: |
| 127 EventType type_; | 134 EventType type_; |
| 128 union Details { | 135 union Details { |
| 129 Details(); | 136 Details(); |
| 130 struct { // SCROLL start details. | 137 struct { // SCROLL start details. |
| 131 // Distance that caused the scroll to start. Generally redundant with | 138 // Distance that caused the scroll to start. Generally redundant with |
| 132 // the x/y values from the first scroll_update. | 139 // the x/y values from the first scroll_update. |
| 133 float x_hint; | 140 float x_hint; |
| 134 float y_hint; | 141 float y_hint; |
| 135 } scroll_begin; | 142 } scroll_begin; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // enclosing rectangles of the touch-points in the gesture. | 178 // enclosing rectangles of the touch-points in the gesture. |
| 172 gfx::RectF bounding_box_; | 179 gfx::RectF bounding_box_; |
| 173 | 180 |
| 174 // The touch id of the oldest touch contributing to the gesture. | 181 // The touch id of the oldest touch contributing to the gesture. |
| 175 int oldest_touch_id_; | 182 int oldest_touch_id_; |
| 176 }; | 183 }; |
| 177 | 184 |
| 178 } // namespace ui | 185 } // namespace ui |
| 179 | 186 |
| 180 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_ | 187 #endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_EVENT_DETAILS_H_ |
| OLD | NEW |