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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 // button that was pressed and during a release this corresponds to the button | 456 // button that was pressed and during a release this corresponds to the button |
457 // that was released. | 457 // that was released. |
458 // NOTE: during a press and release flags() contains the complete set of | 458 // NOTE: during a press and release flags() contains the complete set of |
459 // flags. Use this to determine the button that was pressed or released. | 459 // flags. Use this to determine the button that was pressed or released. |
460 int changed_button_flags() const { return changed_button_flags_; } | 460 int changed_button_flags() const { return changed_button_flags_; } |
461 | 461 |
462 // Updates the button that changed. | 462 // Updates the button that changed. |
463 void set_changed_button_flags(int flags) { changed_button_flags_ = flags; } | 463 void set_changed_button_flags(int flags) { changed_button_flags_ = flags; } |
464 | 464 |
465 // Event details common to MouseEvent and TouchEvent. | 465 // Event details common to MouseEvent and TouchEvent. |
466 const PointerDetails& pointer_details() { return pointer_details_; } | 466 const PointerDetails& pointer_details() const { return pointer_details_; } |
467 void set_pointer_details(const PointerDetails& details) { | 467 void set_pointer_details(const PointerDetails& details) { |
468 pointer_details_ = details; | 468 pointer_details_ = details; |
469 } | 469 } |
470 | 470 |
471 private: | 471 private: |
472 FRIEND_TEST_ALL_PREFIXES(EventTest, DoubleClickRequiresRelease); | 472 FRIEND_TEST_ALL_PREFIXES(EventTest, DoubleClickRequiresRelease); |
473 FRIEND_TEST_ALL_PREFIXES(EventTest, SingleClickRightLeft); | 473 FRIEND_TEST_ALL_PREFIXES(EventTest, SingleClickRightLeft); |
474 | 474 |
475 // Returns the flags for the mouse buttons. | 475 // Returns the flags for the mouse buttons. |
476 int button_flags() const { | 476 int button_flags() const { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 | 572 |
573 TouchEvent(const TouchEvent& copy); | 573 TouchEvent(const TouchEvent& copy); |
574 | 574 |
575 ~TouchEvent() override; | 575 ~TouchEvent() override; |
576 | 576 |
577 // The id of the pointer this event modifies. | 577 // The id of the pointer this event modifies. |
578 int touch_id() const { return touch_id_; } | 578 int touch_id() const { return touch_id_; } |
579 // A unique identifier for this event. | 579 // A unique identifier for this event. |
580 uint32 unique_event_id() const { return unique_event_id_; } | 580 uint32 unique_event_id() const { return unique_event_id_; } |
581 | 581 |
582 // TODO(robert.bradford): Drop these shims. | |
583 float radius_x() const { return pointer_details_.radius_x(); } | |
584 float radius_y() const { return pointer_details_.radius_y(); } | |
585 float force() const { return pointer_details_.force(); } | |
586 | |
587 float rotation_angle() const { return rotation_angle_; } | 582 float rotation_angle() const { return rotation_angle_; } |
588 | 583 |
589 void set_may_cause_scrolling(bool causes) { may_cause_scrolling_ = causes; } | 584 void set_may_cause_scrolling(bool causes) { may_cause_scrolling_ = causes; } |
590 bool may_cause_scrolling() const { return may_cause_scrolling_; } | 585 bool may_cause_scrolling() const { return may_cause_scrolling_; } |
591 | 586 |
592 // TODO(robert.bradford): ozone_platform_egltest.cc could use | 587 // TODO(robert.bradford): ozone_platform_egltest.cc could use |
593 // UpdateForRootTransform() instead: crbug.com/519337 | 588 // UpdateForRootTransform() instead: crbug.com/519337 |
594 void set_radius_x(const float r) { pointer_details_.radius_x_ = r; } | 589 void set_radius_x(const float r) { pointer_details_.radius_x_ = r; } |
595 void set_radius_y(const float r) { pointer_details_.radius_y_ = r; } | 590 void set_radius_y(const float r) { pointer_details_.radius_y_ = r; } |
596 | 591 |
597 void set_should_remove_native_touch_id_mapping( | 592 void set_should_remove_native_touch_id_mapping( |
598 bool should_remove_native_touch_id_mapping) { | 593 bool should_remove_native_touch_id_mapping) { |
599 should_remove_native_touch_id_mapping_ = | 594 should_remove_native_touch_id_mapping_ = |
600 should_remove_native_touch_id_mapping; | 595 should_remove_native_touch_id_mapping; |
601 } | 596 } |
602 | 597 |
603 // Overridden from LocatedEvent. | 598 // Overridden from LocatedEvent. |
604 void UpdateForRootTransform( | 599 void UpdateForRootTransform( |
605 const gfx::Transform& inverted_root_transform) override; | 600 const gfx::Transform& inverted_root_transform) override; |
606 | 601 |
607 // Marks the event as not participating in synchronous gesture recognition. | 602 // Marks the event as not participating in synchronous gesture recognition. |
608 void DisableSynchronousHandling(); | 603 void DisableSynchronousHandling(); |
609 bool synchronous_handling_disabled() const { | 604 bool synchronous_handling_disabled() const { |
610 return !!(result() & ER_DISABLE_SYNC_HANDLING); | 605 return !!(result() & ER_DISABLE_SYNC_HANDLING); |
611 } | 606 } |
612 | 607 |
613 // Event details common to MouseEvent and TouchEvent. | 608 // Event details common to MouseEvent and TouchEvent. |
614 const PointerDetails& pointer_details() { return pointer_details_; } | 609 const PointerDetails& pointer_details() const { return pointer_details_; } |
615 | 610 |
616 private: | 611 private: |
617 // Adjusts rotation_angle_ to within the acceptable range. | 612 // Adjusts rotation_angle_ to within the acceptable range. |
618 void FixRotationAngle(); | 613 void FixRotationAngle(); |
619 | 614 |
620 // The identity (typically finger) of the touch starting at 0 and incrementing | 615 // The identity (typically finger) of the touch starting at 0 and incrementing |
621 // for each separable additional touch that the hardware can detect. | 616 // for each separable additional touch that the hardware can detect. |
622 const int touch_id_; | 617 const int touch_id_; |
623 | 618 |
624 // A unique identifier for the touch event. | 619 // A unique identifier for the touch event. |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
932 | 927 |
933 const GestureEventDetails& details() const { return details_; } | 928 const GestureEventDetails& details() const { return details_; } |
934 | 929 |
935 private: | 930 private: |
936 GestureEventDetails details_; | 931 GestureEventDetails details_; |
937 }; | 932 }; |
938 | 933 |
939 } // namespace ui | 934 } // namespace ui |
940 | 935 |
941 #endif // UI_EVENTS_EVENT_H_ | 936 #endif // UI_EVENTS_EVENT_H_ |
OLD | NEW |