Chromium Code Reviews| 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_EVENTS_EVENT_H_ | 5 #ifndef UI_EVENTS_EVENT_H_ |
| 6 #define UI_EVENTS_EVENT_H_ | 6 #define UI_EVENTS_EVENT_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/event_types.h" | 10 #include "base/event_types.h" |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 485 public: | 485 public: |
| 486 explicit TouchEvent(const base::NativeEvent& native_event); | 486 explicit TouchEvent(const base::NativeEvent& native_event); |
| 487 | 487 |
| 488 // Create a new TouchEvent which is identical to the provided model. | 488 // Create a new TouchEvent which is identical to the provided model. |
| 489 // If source / target windows are provided, the model location will be | 489 // If source / target windows are provided, the model location will be |
| 490 // converted from |source| coordinate system to |target| coordinate system. | 490 // converted from |source| coordinate system to |target| coordinate system. |
| 491 template <class T> | 491 template <class T> |
| 492 TouchEvent(const TouchEvent& model, T* source, T* target) | 492 TouchEvent(const TouchEvent& model, T* source, T* target) |
| 493 : LocatedEvent(model, source, target), | 493 : LocatedEvent(model, source, target), |
| 494 touch_id_(model.touch_id_), | 494 touch_id_(model.touch_id_), |
| 495 unique_event_id_(model.unique_event_id_), | 495 unique_touch_event_id_(model.unique_touch_event_id_), |
| 496 radius_x_(model.radius_x_), | 496 radius_x_(model.radius_x_), |
| 497 radius_y_(model.radius_y_), | 497 radius_y_(model.radius_y_), |
| 498 rotation_angle_(model.rotation_angle_), | 498 rotation_angle_(model.rotation_angle_), |
| 499 force_(model.force_), | 499 force_(model.force_), |
| 500 may_cause_scrolling_(model.may_cause_scrolling_), | 500 may_cause_scrolling_(model.may_cause_scrolling_), |
| 501 should_remove_native_touch_id_mapping_(false) {} | 501 should_remove_native_touch_id_mapping_(false) {} |
| 502 | 502 |
| 503 TouchEvent(EventType type, | 503 TouchEvent(EventType type, |
| 504 const gfx::PointF& location, | 504 const gfx::PointF& location, |
| 505 int touch_id, | 505 int touch_id, |
| 506 base::TimeDelta time_stamp); | 506 base::TimeDelta time_stamp); |
| 507 | 507 |
| 508 TouchEvent(EventType type, | 508 TouchEvent(EventType type, |
| 509 const gfx::PointF& location, | 509 const gfx::PointF& location, |
| 510 int flags, | 510 int flags, |
| 511 int touch_id, | 511 int touch_id, |
| 512 base::TimeDelta timestamp, | 512 base::TimeDelta timestamp, |
| 513 float radius_x, | 513 float radius_x, |
| 514 float radius_y, | 514 float radius_y, |
| 515 float angle, | 515 float angle, |
| 516 float force); | 516 float force); |
| 517 | 517 |
| 518 ~TouchEvent() override; | 518 ~TouchEvent() override; |
| 519 | 519 |
| 520 // The id of the pointer this event modifies. | 520 // The id of the pointer this event modifies. |
| 521 int touch_id() const { return touch_id_; } | 521 int touch_id() const { return touch_id_; } |
| 522 // A unique identifier for this event. | 522 // A unique identifier for this event. |
| 523 uint64 unique_event_id() const { return unique_event_id_; } | 523 uint64 unique_touch_event_id() const { return unique_touch_event_id_; } |
|
jdduke (slow)
2015/03/16 21:33:44
Why the extra "touch" name here? Isn't that implic
| |
| 524 // If we aren't provided with a radius on one axis, use the | 524 // If we aren't provided with a radius on one axis, use the |
| 525 // information from the other axis. | 525 // information from the other axis. |
| 526 float radius_x() const { return radius_x_ > 0 ? radius_x_ : radius_y_; } | 526 float radius_x() const { return radius_x_ > 0 ? radius_x_ : radius_y_; } |
| 527 float radius_y() const { return radius_y_ > 0 ? radius_y_ : radius_x_; } | 527 float radius_y() const { return radius_y_ > 0 ? radius_y_ : radius_x_; } |
| 528 float rotation_angle() const { return rotation_angle_; } | 528 float rotation_angle() const { return rotation_angle_; } |
| 529 float force() const { return force_; } | 529 float force() const { return force_; } |
| 530 | 530 |
| 531 void set_may_cause_scrolling(bool causes) { may_cause_scrolling_ = causes; } | 531 void set_may_cause_scrolling(bool causes) { may_cause_scrolling_ = causes; } |
| 532 bool may_cause_scrolling() const { return may_cause_scrolling_; } | 532 bool may_cause_scrolling() const { return may_cause_scrolling_; } |
| 533 | 533 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 553 | 553 |
| 554 private: | 554 private: |
| 555 // Adjusts rotation_angle_ to within the acceptable range. | 555 // Adjusts rotation_angle_ to within the acceptable range. |
| 556 void FixRotationAngle(); | 556 void FixRotationAngle(); |
| 557 | 557 |
| 558 // The identity (typically finger) of the touch starting at 0 and incrementing | 558 // The identity (typically finger) of the touch starting at 0 and incrementing |
| 559 // for each separable additional touch that the hardware can detect. | 559 // for each separable additional touch that the hardware can detect. |
| 560 const int touch_id_; | 560 const int touch_id_; |
| 561 | 561 |
| 562 // A unique identifier for the touch event. | 562 // A unique identifier for the touch event. |
| 563 const uint64 unique_event_id_; | 563 const uint64 unique_touch_event_id_; |
| 564 | 564 |
| 565 // Radius of the X (major) axis of the touch ellipse. 0.0 if unknown. | 565 // Radius of the X (major) axis of the touch ellipse. 0.0 if unknown. |
| 566 float radius_x_; | 566 float radius_x_; |
| 567 | 567 |
| 568 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. | 568 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. |
| 569 float radius_y_; | 569 float radius_y_; |
| 570 | 570 |
| 571 // Clockwise angle (in degrees) of the major axis from the X axis. Must be | 571 // Clockwise angle (in degrees) of the major axis from the X axis. Must be |
| 572 // less than 180 and non-negative. | 572 // less than 180 and non-negative. |
| 573 float rotation_angle_; | 573 float rotation_angle_; |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 881 | 881 |
| 882 const GestureEventDetails& details() const { return details_; } | 882 const GestureEventDetails& details() const { return details_; } |
| 883 | 883 |
| 884 private: | 884 private: |
| 885 GestureEventDetails details_; | 885 GestureEventDetails details_; |
| 886 }; | 886 }; |
| 887 | 887 |
| 888 } // namespace ui | 888 } // namespace ui |
| 889 | 889 |
| 890 #endif // UI_EVENTS_EVENT_H_ | 890 #endif // UI_EVENTS_EVENT_H_ |
| OLD | NEW |