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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
486 // If source / target windows are provided, the model location will be | 486 // If source / target windows are provided, the model location will be |
487 // converted from |source| coordinate system to |target| coordinate system. | 487 // converted from |source| coordinate system to |target| coordinate system. |
488 template <class T> | 488 template <class T> |
489 TouchEvent(const TouchEvent& model, T* source, T* target) | 489 TouchEvent(const TouchEvent& model, T* source, T* target) |
490 : LocatedEvent(model, source, target), | 490 : LocatedEvent(model, source, target), |
491 touch_id_(model.touch_id_), | 491 touch_id_(model.touch_id_), |
492 unique_event_id_(model.unique_event_id_), | 492 unique_event_id_(model.unique_event_id_), |
493 radius_x_(model.radius_x_), | 493 radius_x_(model.radius_x_), |
494 radius_y_(model.radius_y_), | 494 radius_y_(model.radius_y_), |
495 rotation_angle_(model.rotation_angle_), | 495 rotation_angle_(model.rotation_angle_), |
496 force_(model.force_) {} | 496 force_(model.force_), |
497 may_cause_scrolling_(model.may_cause_scrolling_) {} | |
497 | 498 |
498 TouchEvent(EventType type, | 499 TouchEvent(EventType type, |
499 const gfx::PointF& location, | 500 const gfx::PointF& location, |
500 int touch_id, | 501 int touch_id, |
501 base::TimeDelta time_stamp); | 502 base::TimeDelta time_stamp); |
502 | 503 |
503 TouchEvent(EventType type, | 504 TouchEvent(EventType type, |
504 const gfx::PointF& location, | 505 const gfx::PointF& location, |
505 int flags, | 506 int flags, |
506 int touch_id, | 507 int touch_id, |
507 base::TimeDelta timestamp, | 508 base::TimeDelta timestamp, |
508 float radius_x, | 509 float radius_x, |
509 float radius_y, | 510 float radius_y, |
510 float angle, | 511 float angle, |
511 float force); | 512 float force); |
512 | 513 |
513 ~TouchEvent() override; | 514 ~TouchEvent() override; |
514 | 515 |
515 // The id of the pointer this event modifies. | 516 // The id of the pointer this event modifies. |
516 int touch_id() const { return touch_id_; } | 517 int touch_id() const { return touch_id_; } |
517 // A unique identifier for this event. | 518 // A unique identifier for this event. |
518 uint64 unique_event_id() const { return unique_event_id_; } | 519 uint64 unique_event_id() const { return unique_event_id_; } |
519 float radius_x() const { return radius_x_; } | 520 float radius_x() const { return radius_x_; } |
520 float radius_y() const { return radius_y_; } | 521 float radius_y() const { return radius_y_; } |
521 float rotation_angle() const { return rotation_angle_; } | 522 float rotation_angle() const { return rotation_angle_; } |
522 float force() const { return force_; } | 523 float force() const { return force_; } |
523 | 524 |
525 void set_may_cause_scrolling(bool causes) { may_cause_scrolling_ = causes; } | |
jdduke (slow)
2014/12/11 19:06:38
I'm open to different naming here, or event a diff
| |
526 bool may_cause_scrolling() const { return may_cause_scrolling_; } | |
527 | |
524 // Used for unit tests. | 528 // Used for unit tests. |
525 void set_radius_x(const float r) { radius_x_ = r; } | 529 void set_radius_x(const float r) { radius_x_ = r; } |
526 void set_radius_y(const float r) { radius_y_ = r; } | 530 void set_radius_y(const float r) { radius_y_ = r; } |
527 | 531 |
528 // Overridden from LocatedEvent. | 532 // Overridden from LocatedEvent. |
529 void UpdateForRootTransform( | 533 void UpdateForRootTransform( |
530 const gfx::Transform& inverted_root_transform) override; | 534 const gfx::Transform& inverted_root_transform) override; |
531 | 535 |
532 // Marks the event as not participating in synchronous gesture recognition. | 536 // Marks the event as not participating in synchronous gesture recognition. |
533 void DisableSynchronousHandling(); | 537 void DisableSynchronousHandling(); |
(...skipping 25 matching lines...) Expand all Loading... | |
559 float radius_x_; | 563 float radius_x_; |
560 | 564 |
561 // 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. |
562 float radius_y_; | 566 float radius_y_; |
563 | 567 |
564 // Angle of the major axis away from the X axis. Default 0.0. | 568 // Angle of the major axis away from the X axis. Default 0.0. |
565 float rotation_angle_; | 569 float rotation_angle_; |
566 | 570 |
567 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. | 571 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. |
568 float force_; | 572 float force_; |
573 | |
574 // Whether the (unhandled) touch event will produce a scroll event (i.e., it's | |
575 // a touchmove and exceeds the platform slop region). Defaults to false. | |
576 bool may_cause_scrolling_; | |
jdduke (slow)
2014/12/11 19:32:54
Awfully tempting to make this mutable... Would avo
| |
569 }; | 577 }; |
570 | 578 |
571 // An interface that individual platforms can use to store additional data on | 579 // An interface that individual platforms can use to store additional data on |
572 // KeyEvent. | 580 // KeyEvent. |
573 // | 581 // |
574 // Currently only used in mojo. | 582 // Currently only used in mojo. |
575 class EVENTS_EXPORT ExtendedKeyEventData { | 583 class EVENTS_EXPORT ExtendedKeyEventData { |
576 public: | 584 public: |
577 virtual ~ExtendedKeyEventData() {} | 585 virtual ~ExtendedKeyEventData() {} |
578 | 586 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
822 | 830 |
823 const GestureEventDetails& details() const { return details_; } | 831 const GestureEventDetails& details() const { return details_; } |
824 | 832 |
825 private: | 833 private: |
826 GestureEventDetails details_; | 834 GestureEventDetails details_; |
827 }; | 835 }; |
828 | 836 |
829 } // namespace ui | 837 } // namespace ui |
830 | 838 |
831 #endif // UI_EVENTS_EVENT_H_ | 839 #endif // UI_EVENTS_EVENT_H_ |
OLD | NEW |