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 #include "ui/events/event.h" | 5 #include "ui/events/event.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 | 10 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 CASE_TYPE(ET_TOUCH_PRESSED); | 97 CASE_TYPE(ET_TOUCH_PRESSED); |
98 CASE_TYPE(ET_TOUCH_MOVED); | 98 CASE_TYPE(ET_TOUCH_MOVED); |
99 CASE_TYPE(ET_TOUCH_CANCELLED); | 99 CASE_TYPE(ET_TOUCH_CANCELLED); |
100 CASE_TYPE(ET_DROP_TARGET_EVENT); | 100 CASE_TYPE(ET_DROP_TARGET_EVENT); |
101 CASE_TYPE(ET_POINTER_DOWN); | 101 CASE_TYPE(ET_POINTER_DOWN); |
102 CASE_TYPE(ET_POINTER_MOVED); | 102 CASE_TYPE(ET_POINTER_MOVED); |
103 CASE_TYPE(ET_POINTER_UP); | 103 CASE_TYPE(ET_POINTER_UP); |
104 CASE_TYPE(ET_POINTER_CANCELLED); | 104 CASE_TYPE(ET_POINTER_CANCELLED); |
105 CASE_TYPE(ET_POINTER_ENTERED); | 105 CASE_TYPE(ET_POINTER_ENTERED); |
106 CASE_TYPE(ET_POINTER_EXITED); | 106 CASE_TYPE(ET_POINTER_EXITED); |
| 107 CASE_TYPE(ET_POINTER_WHEEL_CHANGED); |
| 108 CASE_TYPE(ET_POINTER_CAPTURE_CHANGED); |
107 CASE_TYPE(ET_GESTURE_SCROLL_BEGIN); | 109 CASE_TYPE(ET_GESTURE_SCROLL_BEGIN); |
108 CASE_TYPE(ET_GESTURE_SCROLL_END); | 110 CASE_TYPE(ET_GESTURE_SCROLL_END); |
109 CASE_TYPE(ET_GESTURE_SCROLL_UPDATE); | 111 CASE_TYPE(ET_GESTURE_SCROLL_UPDATE); |
110 CASE_TYPE(ET_GESTURE_SHOW_PRESS); | 112 CASE_TYPE(ET_GESTURE_SHOW_PRESS); |
111 CASE_TYPE(ET_GESTURE_TAP); | 113 CASE_TYPE(ET_GESTURE_TAP); |
112 CASE_TYPE(ET_GESTURE_TAP_DOWN); | 114 CASE_TYPE(ET_GESTURE_TAP_DOWN); |
113 CASE_TYPE(ET_GESTURE_TAP_CANCEL); | 115 CASE_TYPE(ET_GESTURE_TAP_CANCEL); |
114 CASE_TYPE(ET_GESTURE_BEGIN); | 116 CASE_TYPE(ET_GESTURE_BEGIN); |
115 CASE_TYPE(ET_GESTURE_END); | 117 CASE_TYPE(ET_GESTURE_END); |
116 CASE_TYPE(ET_GESTURE_TWO_FINGER_TAP); | 118 CASE_TYPE(ET_GESTURE_TWO_FINGER_TAP); |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 break; | 489 break; |
488 | 490 |
489 case ET_POINTER_EXITED: | 491 case ET_POINTER_EXITED: |
490 SetType(ET_MOUSE_EXITED); | 492 SetType(ET_MOUSE_EXITED); |
491 break; | 493 break; |
492 | 494 |
493 case ET_POINTER_UP: | 495 case ET_POINTER_UP: |
494 SetType(ET_MOUSE_RELEASED); | 496 SetType(ET_MOUSE_RELEASED); |
495 break; | 497 break; |
496 | 498 |
| 499 case ET_POINTER_WHEEL_CHANGED: |
| 500 SetType(ET_MOUSEWHEEL); |
| 501 break; |
| 502 |
| 503 case ET_POINTER_CAPTURE_CHANGED: |
| 504 SetType(ET_MOUSE_CAPTURE_CHANGED); |
| 505 break; |
| 506 |
497 default: | 507 default: |
498 NOTREACHED(); | 508 NOTREACHED(); |
499 } | 509 } |
500 } | 510 } |
501 | 511 |
502 MouseEvent::MouseEvent(EventType type, | 512 MouseEvent::MouseEvent(EventType type, |
503 const gfx::Point& location, | 513 const gfx::Point& location, |
504 const gfx::Point& root_location, | 514 const gfx::Point& root_location, |
505 base::TimeTicks time_stamp, | 515 base::TimeTicks time_stamp, |
506 int flags, | 516 int flags, |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 // PointerEvent | 848 // PointerEvent |
839 | 849 |
840 bool PointerEvent::CanConvertFrom(const Event& event) { | 850 bool PointerEvent::CanConvertFrom(const Event& event) { |
841 switch (event.type()) { | 851 switch (event.type()) { |
842 case ET_MOUSE_PRESSED: | 852 case ET_MOUSE_PRESSED: |
843 case ET_MOUSE_DRAGGED: | 853 case ET_MOUSE_DRAGGED: |
844 case ET_MOUSE_MOVED: | 854 case ET_MOUSE_MOVED: |
845 case ET_MOUSE_ENTERED: | 855 case ET_MOUSE_ENTERED: |
846 case ET_MOUSE_EXITED: | 856 case ET_MOUSE_EXITED: |
847 case ET_MOUSE_RELEASED: | 857 case ET_MOUSE_RELEASED: |
| 858 case ET_MOUSEWHEEL: |
| 859 case ET_MOUSE_CAPTURE_CHANGED: |
848 case ET_TOUCH_PRESSED: | 860 case ET_TOUCH_PRESSED: |
849 case ET_TOUCH_MOVED: | 861 case ET_TOUCH_MOVED: |
850 case ET_TOUCH_RELEASED: | 862 case ET_TOUCH_RELEASED: |
851 case ET_TOUCH_CANCELLED: | 863 case ET_TOUCH_CANCELLED: |
852 return true; | 864 return true; |
853 default: | 865 default: |
854 return false; | 866 return false; |
855 } | 867 } |
856 } | 868 } |
857 | 869 |
(...skipping 24 matching lines...) Expand all Loading... |
882 break; | 894 break; |
883 | 895 |
884 case ET_MOUSE_EXITED: | 896 case ET_MOUSE_EXITED: |
885 SetType(ET_POINTER_EXITED); | 897 SetType(ET_POINTER_EXITED); |
886 break; | 898 break; |
887 | 899 |
888 case ET_MOUSE_RELEASED: | 900 case ET_MOUSE_RELEASED: |
889 SetType(ET_POINTER_UP); | 901 SetType(ET_POINTER_UP); |
890 break; | 902 break; |
891 | 903 |
| 904 case ET_MOUSEWHEEL: |
| 905 SetType(ET_POINTER_WHEEL_CHANGED); |
| 906 details_ = PointerDetails(EventPointerType::POINTER_TYPE_MOUSE, |
| 907 mouse_event.AsMouseWheelEvent()->offset()); |
| 908 break; |
| 909 |
| 910 case ET_MOUSE_CAPTURE_CHANGED: |
| 911 SetType(ET_POINTER_CAPTURE_CHANGED); |
| 912 break; |
| 913 |
892 default: | 914 default: |
893 NOTREACHED(); | 915 NOTREACHED(); |
894 } | 916 } |
895 } | 917 } |
896 | 918 |
897 PointerEvent::PointerEvent(const TouchEvent& touch_event) | 919 PointerEvent::PointerEvent(const TouchEvent& touch_event) |
898 : LocatedEvent(touch_event), | 920 : LocatedEvent(touch_event), |
899 pointer_id_(touch_event.touch_id()), | 921 pointer_id_(touch_event.touch_id()), |
900 changed_button_flags_(0), | 922 changed_button_flags_(0), |
901 details_(touch_event.pointer_details()) { | 923 details_(touch_event.pointer_details()) { |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 gfx::PointF(x, y), | 1299 gfx::PointF(x, y), |
1278 time_stamp, | 1300 time_stamp, |
1279 flags | EF_FROM_TOUCH), | 1301 flags | EF_FROM_TOUCH), |
1280 details_(details), | 1302 details_(details), |
1281 unique_touch_event_id_(unique_touch_event_id) {} | 1303 unique_touch_event_id_(unique_touch_event_id) {} |
1282 | 1304 |
1283 GestureEvent::~GestureEvent() { | 1305 GestureEvent::~GestureEvent() { |
1284 } | 1306 } |
1285 | 1307 |
1286 } // namespace ui | 1308 } // namespace ui |
OLD | NEW |