| 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 255   CancelModeEvent(); | 255   CancelModeEvent(); | 
| 256   ~CancelModeEvent() override; | 256   ~CancelModeEvent() override; | 
| 257 }; | 257 }; | 
| 258 | 258 | 
| 259 class EVENTS_EXPORT LocatedEvent : public Event { | 259 class EVENTS_EXPORT LocatedEvent : public Event { | 
| 260  public: | 260  public: | 
| 261   ~LocatedEvent() override; | 261   ~LocatedEvent() override; | 
| 262 | 262 | 
| 263   float x() const { return location_.x(); } | 263   float x() const { return location_.x(); } | 
| 264   float y() const { return location_.y(); } | 264   float y() const { return location_.y(); } | 
| 265   void set_location(const gfx::PointF& location) { location_ = location; } | 265   void set_location(const gfx::Point& location) { | 
|  | 266     location_ = gfx::PointF(location); | 
|  | 267   } | 
|  | 268   void set_location_f(const gfx::PointF& location) { location_ = location; } | 
| 266   gfx::Point location() const { return gfx::ToFlooredPoint(location_); } | 269   gfx::Point location() const { return gfx::ToFlooredPoint(location_); } | 
| 267   const gfx::PointF& location_f() const { return location_; } | 270   const gfx::PointF& location_f() const { return location_; } | 
| 268   void set_root_location(const gfx::PointF& root_location) { | 271   void set_root_location(const gfx::Point& root_location) { | 
|  | 272     root_location_ = gfx::PointF(root_location); | 
|  | 273   } | 
|  | 274   void set_root_location_f(const gfx::PointF& root_location) { | 
| 269     root_location_ = root_location; | 275     root_location_ = root_location; | 
| 270   } | 276   } | 
| 271   gfx::Point root_location() const { | 277   gfx::Point root_location() const { | 
| 272     return gfx::ToFlooredPoint(root_location_); | 278     return gfx::ToFlooredPoint(root_location_); | 
| 273   } | 279   } | 
| 274   const gfx::PointF& root_location_f() const { | 280   const gfx::PointF& root_location_f() const { | 
| 275     return root_location_; | 281     return root_location_; | 
| 276   } | 282   } | 
| 277 | 283 | 
| 278   // Transform the locations using |inverted_root_transform|. | 284   // Transform the locations using |inverted_root_transform|. | 
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 394              int flags) | 400              int flags) | 
| 395       : LocatedEvent(model, source, target), | 401       : LocatedEvent(model, source, target), | 
| 396         changed_button_flags_(model.changed_button_flags_), | 402         changed_button_flags_(model.changed_button_flags_), | 
| 397         pointer_details_(model.pointer_details_) { | 403         pointer_details_(model.pointer_details_) { | 
| 398     SetType(type); | 404     SetType(type); | 
| 399     set_flags(flags); | 405     set_flags(flags); | 
| 400   } | 406   } | 
| 401 | 407 | 
| 402   // Used for synthetic events in testing, gesture recognizer and Ozone | 408   // Used for synthetic events in testing, gesture recognizer and Ozone | 
| 403   MouseEvent(EventType type, | 409   MouseEvent(EventType type, | 
| 404              const gfx::PointF& location, | 410              const gfx::Point& location, | 
| 405              const gfx::PointF& root_location, | 411              const gfx::Point& root_location, | 
| 406              base::TimeDelta time_stamp, | 412              base::TimeDelta time_stamp, | 
| 407              int flags, | 413              int flags, | 
| 408              int changed_button_flags); | 414              int changed_button_flags); | 
| 409 | 415 | 
| 410   // Conveniences to quickly test what button is down | 416   // Conveniences to quickly test what button is down | 
| 411   bool IsOnlyLeftMouseButton() const { | 417   bool IsOnlyLeftMouseButton() const { | 
| 412     return button_flags() == EF_LEFT_MOUSE_BUTTON; | 418     return button_flags() == EF_LEFT_MOUSE_BUTTON; | 
| 413   } | 419   } | 
| 414 | 420 | 
| 415   bool IsLeftMouseButton() const { | 421   bool IsLeftMouseButton() const { | 
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 511   template <class T> | 517   template <class T> | 
| 512   MouseWheelEvent(const MouseWheelEvent& model, | 518   MouseWheelEvent(const MouseWheelEvent& model, | 
| 513                   T* source, | 519                   T* source, | 
| 514                   T* target) | 520                   T* target) | 
| 515       : MouseEvent(model, source, target, model.type(), model.flags()), | 521       : MouseEvent(model, source, target, model.type(), model.flags()), | 
| 516         offset_(model.x_offset(), model.y_offset()) { | 522         offset_(model.x_offset(), model.y_offset()) { | 
| 517   } | 523   } | 
| 518 | 524 | 
| 519   // Used for synthetic events in testing and by the gesture recognizer. | 525   // Used for synthetic events in testing and by the gesture recognizer. | 
| 520   MouseWheelEvent(const gfx::Vector2d& offset, | 526   MouseWheelEvent(const gfx::Vector2d& offset, | 
| 521                   const gfx::PointF& location, | 527                   const gfx::Point& location, | 
| 522                   const gfx::PointF& root_location, | 528                   const gfx::Point& root_location, | 
| 523                   base::TimeDelta time_stamp, | 529                   base::TimeDelta time_stamp, | 
| 524                   int flags, | 530                   int flags, | 
| 525                   int changed_button_flags); | 531                   int changed_button_flags); | 
| 526 | 532 | 
| 527   // The amount to scroll. This is in multiples of kWheelDelta. | 533   // The amount to scroll. This is in multiples of kWheelDelta. | 
| 528   // Note: x_offset() > 0/y_offset() > 0 means scroll left/up. | 534   // Note: x_offset() > 0/y_offset() > 0 means scroll left/up. | 
| 529   int x_offset() const { return offset_.x(); } | 535   int x_offset() const { return offset_.x(); } | 
| 530   int y_offset() const { return offset_.y(); } | 536   int y_offset() const { return offset_.y(); } | 
| 531   const gfx::Vector2d& offset() const { return offset_; } | 537   const gfx::Vector2d& offset() const { return offset_; } | 
| 532 | 538 | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 545   TouchEvent(const TouchEvent& model, T* source, T* target) | 551   TouchEvent(const TouchEvent& model, T* source, T* target) | 
| 546       : LocatedEvent(model, source, target), | 552       : LocatedEvent(model, source, target), | 
| 547         touch_id_(model.touch_id_), | 553         touch_id_(model.touch_id_), | 
| 548         unique_event_id_(model.unique_event_id_), | 554         unique_event_id_(model.unique_event_id_), | 
| 549         rotation_angle_(model.rotation_angle_), | 555         rotation_angle_(model.rotation_angle_), | 
| 550         may_cause_scrolling_(model.may_cause_scrolling_), | 556         may_cause_scrolling_(model.may_cause_scrolling_), | 
| 551         should_remove_native_touch_id_mapping_(false), | 557         should_remove_native_touch_id_mapping_(false), | 
| 552         pointer_details_(model.pointer_details_) {} | 558         pointer_details_(model.pointer_details_) {} | 
| 553 | 559 | 
| 554   TouchEvent(EventType type, | 560   TouchEvent(EventType type, | 
| 555              const gfx::PointF& location, | 561              const gfx::Point& location, | 
| 556              int touch_id, | 562              int touch_id, | 
| 557              base::TimeDelta time_stamp); | 563              base::TimeDelta time_stamp); | 
| 558 | 564 | 
| 559   TouchEvent(EventType type, | 565   TouchEvent(EventType type, | 
| 560              const gfx::PointF& location, | 566              const gfx::Point& location, | 
| 561              int flags, | 567              int flags, | 
| 562              int touch_id, | 568              int touch_id, | 
| 563              base::TimeDelta timestamp, | 569              base::TimeDelta timestamp, | 
| 564              float radius_x, | 570              float radius_x, | 
| 565              float radius_y, | 571              float radius_y, | 
| 566              float angle, | 572              float angle, | 
| 567              float force); | 573              float force); | 
| 568 | 574 | 
| 569   TouchEvent(const TouchEvent& copy); | 575   TouchEvent(const TouchEvent& copy); | 
| 570 | 576 | 
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 847       : MouseEvent(model, source, target), | 853       : MouseEvent(model, source, target), | 
| 848         x_offset_(model.x_offset_), | 854         x_offset_(model.x_offset_), | 
| 849         y_offset_(model.y_offset_), | 855         y_offset_(model.y_offset_), | 
| 850         x_offset_ordinal_(model.x_offset_ordinal_), | 856         x_offset_ordinal_(model.x_offset_ordinal_), | 
| 851         y_offset_ordinal_(model.y_offset_ordinal_), | 857         y_offset_ordinal_(model.y_offset_ordinal_), | 
| 852         finger_count_(model.finger_count_){ | 858         finger_count_(model.finger_count_){ | 
| 853   } | 859   } | 
| 854 | 860 | 
| 855   // Used for tests. | 861   // Used for tests. | 
| 856   ScrollEvent(EventType type, | 862   ScrollEvent(EventType type, | 
| 857               const gfx::PointF& location, | 863               const gfx::Point& location, | 
| 858               base::TimeDelta time_stamp, | 864               base::TimeDelta time_stamp, | 
| 859               int flags, | 865               int flags, | 
| 860               float x_offset, | 866               float x_offset, | 
| 861               float y_offset, | 867               float y_offset, | 
| 862               float x_offset_ordinal, | 868               float x_offset_ordinal, | 
| 863               float y_offset_ordinal, | 869               float y_offset_ordinal, | 
| 864               int finger_count); | 870               int finger_count); | 
| 865 | 871 | 
| 866   // Scale the scroll event's offset value. | 872   // Scale the scroll event's offset value. | 
| 867   // This is useful in the multi-monitor setup where it needs to be scaled | 873   // This is useful in the multi-monitor setup where it needs to be scaled | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 906 | 912 | 
| 907   const GestureEventDetails& details() const { return details_; } | 913   const GestureEventDetails& details() const { return details_; } | 
| 908 | 914 | 
| 909  private: | 915  private: | 
| 910   GestureEventDetails details_; | 916   GestureEventDetails details_; | 
| 911 }; | 917 }; | 
| 912 | 918 | 
| 913 }  // namespace ui | 919 }  // namespace ui | 
| 914 | 920 | 
| 915 #endif  // UI_EVENTS_EVENT_H_ | 921 #endif  // UI_EVENTS_EVENT_H_ | 
| OLD | NEW | 
|---|