| 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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 // converted from |source| coordinate system to |target| coordinate system. | 488 // converted from |source| coordinate system to |target| coordinate system. |
| 489 template <class T> | 489 template <class T> |
| 490 TouchEvent(const TouchEvent& model, T* source, T* target) | 490 TouchEvent(const TouchEvent& model, T* source, T* target) |
| 491 : LocatedEvent(model, source, target), | 491 : LocatedEvent(model, source, target), |
| 492 touch_id_(model.touch_id_), | 492 touch_id_(model.touch_id_), |
| 493 unique_event_id_(model.unique_event_id_), | 493 unique_event_id_(model.unique_event_id_), |
| 494 radius_x_(model.radius_x_), | 494 radius_x_(model.radius_x_), |
| 495 radius_y_(model.radius_y_), | 495 radius_y_(model.radius_y_), |
| 496 rotation_angle_(model.rotation_angle_), | 496 rotation_angle_(model.rotation_angle_), |
| 497 force_(model.force_), | 497 force_(model.force_), |
| 498 tilt_(model.tilt_), |
| 499 tiltDirection_(model.tiltDirection_), |
| 498 may_cause_scrolling_(model.may_cause_scrolling_) {} | 500 may_cause_scrolling_(model.may_cause_scrolling_) {} |
| 499 | 501 |
| 500 TouchEvent(EventType type, | 502 TouchEvent(EventType type, |
| 501 const gfx::PointF& location, | 503 const gfx::PointF& location, |
| 502 int touch_id, | 504 int touch_id, |
| 503 base::TimeDelta time_stamp); | 505 base::TimeDelta time_stamp); |
| 504 | 506 |
| 505 TouchEvent(EventType type, | 507 TouchEvent(EventType type, |
| 506 const gfx::PointF& location, | 508 const gfx::PointF& location, |
| 507 int flags, | 509 int flags, |
| 508 int touch_id, | 510 int touch_id, |
| 509 base::TimeDelta timestamp, | 511 base::TimeDelta timestamp, |
| 510 float radius_x, | 512 float radius_x, |
| 511 float radius_y, | 513 float radius_y, |
| 512 float angle, | 514 float angle, |
| 513 float force); | 515 float force, |
| 516 float tilt, |
| 517 float tiltDirection); |
| 514 | 518 |
| 515 ~TouchEvent() override; | 519 ~TouchEvent() override; |
| 516 | 520 |
| 517 // The id of the pointer this event modifies. | 521 // The id of the pointer this event modifies. |
| 518 int touch_id() const { return touch_id_; } | 522 int touch_id() const { return touch_id_; } |
| 519 // A unique identifier for this event. | 523 // A unique identifier for this event. |
| 520 uint64 unique_event_id() const { return unique_event_id_; } | 524 uint64 unique_event_id() const { return unique_event_id_; } |
| 521 // If we aren't provided with a radius on one axis, use the | 525 // If we aren't provided with a radius on one axis, use the |
| 522 // information from the other axis. | 526 // information from the other axis. |
| 523 float radius_x() const { return radius_x_ > 0 ? radius_x_ : radius_y_; } | 527 float radius_x() const { return radius_x_ > 0 ? radius_x_ : radius_y_; } |
| 524 float radius_y() const { return radius_y_ > 0 ? radius_y_ : radius_x_; } | 528 float radius_y() const { return radius_y_ > 0 ? radius_y_ : radius_x_; } |
| 525 float rotation_angle() const { return rotation_angle_; } | 529 float rotation_angle() const { return rotation_angle_; } |
| 526 float force() const { return force_; } | 530 float force() const { return force_; } |
| 531 float tilt() const { return tilt_; } |
| 532 float tiltDirection() const { return tiltDirection_; } |
| 527 | 533 |
| 528 void set_may_cause_scrolling(bool causes) { may_cause_scrolling_ = causes; } | 534 void set_may_cause_scrolling(bool causes) { may_cause_scrolling_ = causes; } |
| 529 bool may_cause_scrolling() const { return may_cause_scrolling_; } | 535 bool may_cause_scrolling() const { return may_cause_scrolling_; } |
| 530 | 536 |
| 531 // Used for unit tests. | 537 // Used for unit tests. |
| 532 void set_radius_x(const float r) { radius_x_ = r; } | 538 void set_radius_x(const float r) { radius_x_ = r; } |
| 533 void set_radius_y(const float r) { radius_y_ = r; } | 539 void set_radius_y(const float r) { radius_y_ = r; } |
| 534 | 540 |
| 535 // Overridden from LocatedEvent. | 541 // Overridden from LocatedEvent. |
| 536 void UpdateForRootTransform( | 542 void UpdateForRootTransform( |
| (...skipping 22 matching lines...) Expand all Loading... |
| 559 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. | 565 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. |
| 560 float radius_y_; | 566 float radius_y_; |
| 561 | 567 |
| 562 // Clockwise angle (in degrees) of the major axis from the X axis. Must be | 568 // Clockwise angle (in degrees) of the major axis from the X axis. Must be |
| 563 // less than 180 and non-negative. | 569 // less than 180 and non-negative. |
| 564 float rotation_angle_; | 570 float rotation_angle_; |
| 565 | 571 |
| 566 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. | 572 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. |
| 567 float force_; | 573 float force_; |
| 568 | 574 |
| 575 // Tilt angle of the stylus away from the perpendicular to the screen. |
| 576 // Default is NaN. |
| 577 float tilt_; |
| 578 |
| 579 // Clockwise angle from the X axis to the XY-projection of the stylus. |
| 580 // Range is [-180, 180), default is NaN. |
| 581 float tiltDirection_; |
| 582 |
| 569 // Whether the (unhandled) touch event will produce a scroll event (e.g., a | 583 // Whether the (unhandled) touch event will produce a scroll event (e.g., a |
| 570 // touchmove that exceeds the platform slop region, or a touchend that | 584 // touchmove that exceeds the platform slop region, or a touchend that |
| 571 // causes a fling). Defaults to false. | 585 // causes a fling). Defaults to false. |
| 572 bool may_cause_scrolling_; | 586 bool may_cause_scrolling_; |
| 573 }; | 587 }; |
| 574 | 588 |
| 575 // An interface that individual platforms can use to store additional data on | 589 // An interface that individual platforms can use to store additional data on |
| 576 // KeyEvent. | 590 // KeyEvent. |
| 577 // | 591 // |
| 578 // Currently only used in mojo. | 592 // Currently only used in mojo. |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 | 879 |
| 866 const GestureEventDetails& details() const { return details_; } | 880 const GestureEventDetails& details() const { return details_; } |
| 867 | 881 |
| 868 private: | 882 private: |
| 869 GestureEventDetails details_; | 883 GestureEventDetails details_; |
| 870 }; | 884 }; |
| 871 | 885 |
| 872 } // namespace ui | 886 } // namespace ui |
| 873 | 887 |
| 874 #endif // UI_EVENTS_EVENT_H_ | 888 #endif // UI_EVENTS_EVENT_H_ |
| OLD | NEW |