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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 // Create a new TouchEvent which is identical to the provided model. | 484 // Create a new TouchEvent which is identical to the provided model. |
485 // If source / target windows are provided, the model location will be | 485 // If source / target windows are provided, the model location will be |
486 // converted from |source| coordinate system to |target| coordinate system. | 486 // converted from |source| coordinate system to |target| coordinate system. |
487 template <class T> | 487 template <class T> |
488 TouchEvent(const TouchEvent& model, T* source, T* target) | 488 TouchEvent(const TouchEvent& model, T* source, T* target) |
489 : LocatedEvent(model, source, target), | 489 : LocatedEvent(model, source, target), |
490 touch_id_(model.touch_id_), | 490 touch_id_(model.touch_id_), |
491 radius_x_(model.radius_x_), | 491 radius_x_(model.radius_x_), |
492 radius_y_(model.radius_y_), | 492 radius_y_(model.radius_y_), |
493 rotation_angle_(model.rotation_angle_), | 493 rotation_angle_(model.rotation_angle_), |
| 494 tilt_(model.tilt_), |
494 force_(model.force_) { | 495 force_(model.force_) { |
495 } | 496 } |
496 | 497 |
497 TouchEvent(EventType type, | 498 TouchEvent(EventType type, |
498 const gfx::PointF& location, | 499 const gfx::PointF& location, |
499 int touch_id, | 500 int touch_id, |
500 base::TimeDelta time_stamp); | 501 base::TimeDelta time_stamp); |
501 | 502 |
502 TouchEvent(EventType type, | 503 TouchEvent(EventType type, |
503 const gfx::PointF& location, | 504 const gfx::PointF& location, |
504 int flags, | 505 int flags, |
505 int touch_id, | 506 int touch_id, |
506 base::TimeDelta timestamp, | 507 base::TimeDelta timestamp, |
507 float radius_x, | 508 float radius_x, |
508 float radius_y, | 509 float radius_y, |
509 float angle, | 510 float angle, |
| 511 float tilt, |
510 float force); | 512 float force); |
511 | 513 |
512 ~TouchEvent() override; | 514 ~TouchEvent() override; |
513 | 515 |
514 int touch_id() const { return touch_id_; } | 516 int touch_id() const { return touch_id_; } |
515 float radius_x() const { return radius_x_; } | 517 float radius_x() const { return radius_x_; } |
516 float radius_y() const { return radius_y_; } | 518 float radius_y() const { return radius_y_; } |
517 float rotation_angle() const { return rotation_angle_; } | 519 float rotation_angle() const { return rotation_angle_; } |
| 520 float tilt() const { return tilt_; } |
518 float force() const { return force_; } | 521 float force() const { return force_; } |
519 | 522 |
520 // Used for unit tests. | 523 // Used for unit tests. |
521 void set_radius_x(const float r) { radius_x_ = r; } | 524 void set_radius_x(const float r) { radius_x_ = r; } |
522 void set_radius_y(const float r) { radius_y_ = r; } | 525 void set_radius_y(const float r) { radius_y_ = r; } |
523 | 526 |
524 // Overridden from LocatedEvent. | 527 // Overridden from LocatedEvent. |
525 void UpdateForRootTransform( | 528 void UpdateForRootTransform( |
526 const gfx::Transform& inverted_root_transform) override; | 529 const gfx::Transform& inverted_root_transform) override; |
527 | 530 |
528 protected: | 531 protected: |
529 void set_radius(float radius_x, float radius_y) { | 532 void set_radius(float radius_x, float radius_y) { |
530 radius_x_ = radius_x; | 533 radius_x_ = radius_x; |
531 radius_y_ = radius_y; | 534 radius_y_ = radius_y; |
532 } | 535 } |
533 | 536 |
534 void set_rotation_angle(float rotation_angle) { | 537 void set_rotation_angle(float rotation_angle) { |
535 rotation_angle_ = rotation_angle; | 538 rotation_angle_ = rotation_angle; |
536 } | 539 } |
537 | 540 |
| 541 void set_tilt(float tilt) { |
| 542 tilt_ = tilt; |
| 543 } |
| 544 |
538 void set_force(float force) { force_ = force; } | 545 void set_force(float force) { force_ = force; } |
539 | 546 |
540 private: | 547 private: |
541 // The identity (typically finger) of the touch starting at 0 and incrementing | 548 // The identity (typically finger) of the touch starting at 0 and incrementing |
542 // for each separable additional touch that the hardware can detect. | 549 // for each separable additional touch that the hardware can detect. |
543 const int touch_id_; | 550 const int touch_id_; |
544 | 551 |
545 // Radius of the X (major) axis of the touch ellipse. 0.0 if unknown. | 552 // Radius of the X (major) axis of the touch ellipse. 0.0 if unknown. |
546 float radius_x_; | 553 float radius_x_; |
547 | 554 |
548 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. | 555 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. |
549 float radius_y_; | 556 float radius_y_; |
550 | 557 |
551 // Angle of the major axis away from the X axis. Default 0.0. | 558 // Angle of the major axis away from the X axis. Default 0.0. |
552 float rotation_angle_; | 559 float rotation_angle_; |
553 | 560 |
| 561 // Tilt angle of the stylus away from the perpendicular to the screen. |
| 562 // Default is 0.0. |
| 563 float tilt_; |
| 564 |
554 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. | 565 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. |
555 float force_; | 566 float force_; |
556 }; | 567 }; |
557 | 568 |
558 // An interface that individual platforms can use to store additional data on | 569 // An interface that individual platforms can use to store additional data on |
559 // KeyEvent. | 570 // KeyEvent. |
560 // | 571 // |
561 // Currently only used in mojo. | 572 // Currently only used in mojo. |
562 class EVENTS_EXPORT ExtendedKeyEventData { | 573 class EVENTS_EXPORT ExtendedKeyEventData { |
563 public: | 574 public: |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 | 818 |
808 const GestureEventDetails& details() const { return details_; } | 819 const GestureEventDetails& details() const { return details_; } |
809 | 820 |
810 private: | 821 private: |
811 GestureEventDetails details_; | 822 GestureEventDetails details_; |
812 }; | 823 }; |
813 | 824 |
814 } // namespace ui | 825 } // namespace ui |
815 | 826 |
816 #endif // UI_EVENTS_EVENT_H_ | 827 #endif // UI_EVENTS_EVENT_H_ |
OLD | NEW |