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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 483 // Create a new TouchEvent which is identical to the provided model. | 483 // Create a new TouchEvent which is identical to the provided model. |
| 484 // If source / target windows are provided, the model location will be | 484 // If source / target windows are provided, the model location will be |
| 485 // converted from |source| coordinate system to |target| coordinate system. | 485 // converted from |source| coordinate system to |target| coordinate system. |
| 486 template <class T> | 486 template <class T> |
| 487 TouchEvent(const TouchEvent& model, T* source, T* target) | 487 TouchEvent(const TouchEvent& model, T* source, T* target) |
| 488 : LocatedEvent(model, source, target), | 488 : LocatedEvent(model, source, target), |
| 489 touch_id_(model.touch_id_), | 489 touch_id_(model.touch_id_), |
| 490 radius_x_(model.radius_x_), | 490 radius_x_(model.radius_x_), |
| 491 radius_y_(model.radius_y_), | 491 radius_y_(model.radius_y_), |
| 492 rotation_angle_(model.rotation_angle_), | 492 rotation_angle_(model.rotation_angle_), |
| 493 force_(model.force_) { | 493 force_(model.force_), |
| 494 } | 494 may_cause_scrolling_(model.may_cause_scrolling_) {} |
| 495 | 495 |
| 496 TouchEvent(EventType type, | 496 TouchEvent(EventType type, |
| 497 const gfx::PointF& location, | 497 const gfx::PointF& location, |
| 498 int touch_id, | 498 int touch_id, |
| 499 base::TimeDelta time_stamp); | 499 base::TimeDelta time_stamp); |
| 500 | 500 |
| 501 TouchEvent(EventType type, | 501 TouchEvent(EventType type, |
| 502 const gfx::PointF& location, | 502 const gfx::PointF& location, |
| 503 int flags, | 503 int flags, |
| 504 int touch_id, | 504 int touch_id, |
| 505 base::TimeDelta timestamp, | 505 base::TimeDelta timestamp, |
| 506 float radius_x, | 506 float radius_x, |
| 507 float radius_y, | 507 float radius_y, |
| 508 float angle, | 508 float angle, |
| 509 float force); | 509 float force); |
| 510 | 510 |
| 511 ~TouchEvent() override; | 511 ~TouchEvent() override; |
| 512 | 512 |
| 513 int touch_id() const { return touch_id_; } | 513 int touch_id() const { return touch_id_; } |
| 514 float radius_x() const { return radius_x_; } | 514 float radius_x() const { return radius_x_; } |
| 515 float radius_y() const { return radius_y_; } | 515 float radius_y() const { return radius_y_; } |
| 516 float rotation_angle() const { return rotation_angle_; } | 516 float rotation_angle() const { return rotation_angle_; } |
| 517 float force() const { return force_; } | 517 float force() const { return force_; } |
| 518 | 518 |
| 519 void set_may_cause_scrolling(bool causes) { may_cause_scrolling_ = causes; } | |
|
jdduke (slow)
2014/10/27 22:00:15
This isn't my favorite... I wonder if it would be
tdresser
2014/10/28 13:41:41
Your goal is to keep ui::TouchEvent from knowing a
| |
| 520 bool may_cause_scrolling() const { return may_cause_scrolling_; } | |
| 521 | |
| 519 // Used for unit tests. | 522 // Used for unit tests. |
| 520 void set_radius_x(const float r) { radius_x_ = r; } | 523 void set_radius_x(const float r) { radius_x_ = r; } |
| 521 void set_radius_y(const float r) { radius_y_ = r; } | 524 void set_radius_y(const float r) { radius_y_ = r; } |
| 522 | 525 |
| 523 // Overridden from LocatedEvent. | 526 // Overridden from LocatedEvent. |
| 524 void UpdateForRootTransform( | 527 void UpdateForRootTransform( |
| 525 const gfx::Transform& inverted_root_transform) override; | 528 const gfx::Transform& inverted_root_transform) override; |
| 526 | 529 |
| 527 protected: | 530 protected: |
| 528 void set_radius(float radius_x, float radius_y) { | 531 void set_radius(float radius_x, float radius_y) { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 545 float radius_x_; | 548 float radius_x_; |
| 546 | 549 |
| 547 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. | 550 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. |
| 548 float radius_y_; | 551 float radius_y_; |
| 549 | 552 |
| 550 // Angle of the major axis away from the X axis. Default 0.0. | 553 // Angle of the major axis away from the X axis. Default 0.0. |
| 551 float rotation_angle_; | 554 float rotation_angle_; |
| 552 | 555 |
| 553 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. | 556 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. |
| 554 float force_; | 557 float force_; |
| 558 | |
| 559 // Whether the (unhandled) touch event will produce a scroll event (i.e., it's | |
| 560 // a touchmove and exceeds the platform slop region). Defaults to false. | |
| 561 bool may_cause_scrolling_; | |
| 555 }; | 562 }; |
| 556 | 563 |
| 557 // An interface that individual platforms can use to store additional data on | 564 // An interface that individual platforms can use to store additional data on |
| 558 // KeyEvent. | 565 // KeyEvent. |
| 559 // | 566 // |
| 560 // Currently only used in mojo. | 567 // Currently only used in mojo. |
| 561 class EVENTS_EXPORT ExtendedKeyEventData { | 568 class EVENTS_EXPORT ExtendedKeyEventData { |
| 562 public: | 569 public: |
| 563 virtual ~ExtendedKeyEventData() {} | 570 virtual ~ExtendedKeyEventData() {} |
| 564 | 571 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 806 | 813 |
| 807 const GestureEventDetails& details() const { return details_; } | 814 const GestureEventDetails& details() const { return details_; } |
| 808 | 815 |
| 809 private: | 816 private: |
| 810 GestureEventDetails details_; | 817 GestureEventDetails details_; |
| 811 }; | 818 }; |
| 812 | 819 |
| 813 } // namespace ui | 820 } // namespace ui |
| 814 | 821 |
| 815 #endif // UI_EVENTS_EVENT_H_ | 822 #endif // UI_EVENTS_EVENT_H_ |
| OLD | NEW |