| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 // of kWheelDelta. | 452 // of kWheelDelta. |
| 453 // Note: offset_.x() > 0/offset_.y() > 0 means scroll left/up. | 453 // Note: offset_.x() > 0/offset_.y() > 0 means scroll left/up. |
| 454 gfx::Vector2d offset; | 454 gfx::Vector2d offset; |
| 455 }; | 455 }; |
| 456 | 456 |
| 457 class EVENTS_EXPORT MouseEvent : public LocatedEvent { | 457 class EVENTS_EXPORT MouseEvent : public LocatedEvent { |
| 458 public: | 458 public: |
| 459 explicit MouseEvent(const base::NativeEvent& native_event); | 459 explicit MouseEvent(const base::NativeEvent& native_event); |
| 460 | 460 |
| 461 // |pointer_event.IsMousePointerEvent()| must be true. | 461 // |pointer_event.IsMousePointerEvent()| must be true. |
| 462 // Note: If |pointer_event| is a mouse wheel pointer event, use the |
| 463 // MouseWheelEvent version of this function to convert to a MouseWheelEvent |
| 464 // instead. |
| 462 explicit MouseEvent(const PointerEvent& pointer_event); | 465 explicit MouseEvent(const PointerEvent& pointer_event); |
| 463 | 466 |
| 464 // Create a new MouseEvent based on the provided model. | 467 // Create a new MouseEvent based on the provided model. |
| 465 // Uses the provided |type| and |flags| for the new event. | 468 // Uses the provided |type| and |flags| for the new event. |
| 466 // If source / target windows are provided, the model location will be | 469 // If source / target windows are provided, the model location will be |
| 467 // converted from |source| coordinate system to |target| coordinate system. | 470 // converted from |source| coordinate system to |target| coordinate system. |
| 468 template <class T> | 471 template <class T> |
| 469 MouseEvent(const MouseEvent& model, T* source, T* target) | 472 MouseEvent(const MouseEvent& model, T* source, T* target) |
| 470 : LocatedEvent(model, source, target), | 473 : LocatedEvent(model, source, target), |
| 471 changed_button_flags_(model.changed_button_flags_), | 474 changed_button_flags_(model.changed_button_flags_), |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 | 587 |
| 585 class ScrollEvent; | 588 class ScrollEvent; |
| 586 | 589 |
| 587 class EVENTS_EXPORT MouseWheelEvent : public MouseEvent { | 590 class EVENTS_EXPORT MouseWheelEvent : public MouseEvent { |
| 588 public: | 591 public: |
| 589 // See |offset| for details. | 592 // See |offset| for details. |
| 590 static const int kWheelDelta; | 593 static const int kWheelDelta; |
| 591 | 594 |
| 592 explicit MouseWheelEvent(const base::NativeEvent& native_event); | 595 explicit MouseWheelEvent(const base::NativeEvent& native_event); |
| 593 explicit MouseWheelEvent(const ScrollEvent& scroll_event); | 596 explicit MouseWheelEvent(const ScrollEvent& scroll_event); |
| 597 explicit MouseWheelEvent(const PointerEvent& pointer_event); |
| 594 MouseWheelEvent(const MouseEvent& mouse_event, int x_offset, int y_offset); | 598 MouseWheelEvent(const MouseEvent& mouse_event, int x_offset, int y_offset); |
| 595 MouseWheelEvent(const MouseWheelEvent& mouse_wheel_event); | 599 MouseWheelEvent(const MouseWheelEvent& mouse_wheel_event); |
| 596 | 600 |
| 597 template <class T> | 601 template <class T> |
| 598 MouseWheelEvent(const MouseWheelEvent& model, | 602 MouseWheelEvent(const MouseWheelEvent& model, |
| 599 T* source, | 603 T* source, |
| 600 T* target) | 604 T* target) |
| 601 : MouseEvent(model, source, target, model.type(), model.flags()), | 605 : MouseEvent(model, source, target, model.type(), model.flags()), |
| 602 offset_(model.x_offset(), model.y_offset()) { | 606 offset_(model.x_offset(), model.y_offset()) { |
| 603 } | 607 } |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 // dispatched. This field gets a non-zero value only for gestures that are | 1021 // dispatched. This field gets a non-zero value only for gestures that are |
| 1018 // released through TouchDispositionGestureFilter::SendGesture. The gesture | 1022 // released through TouchDispositionGestureFilter::SendGesture. The gesture |
| 1019 // events that aren't fired directly in response to processing a touch-event | 1023 // events that aren't fired directly in response to processing a touch-event |
| 1020 // (e.g. timer fired ones), this id is zero. See crbug.com/618738. | 1024 // (e.g. timer fired ones), this id is zero. See crbug.com/618738. |
| 1021 uint32_t unique_touch_event_id_; | 1025 uint32_t unique_touch_event_id_; |
| 1022 }; | 1026 }; |
| 1023 | 1027 |
| 1024 } // namespace ui | 1028 } // namespace ui |
| 1025 | 1029 |
| 1026 #endif // UI_EVENTS_EVENT_H_ | 1030 #endif // UI_EVENTS_EVENT_H_ |
| OLD | NEW |