| 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_BASE_EVENTS_EVENT_H_ | 5 #ifndef UI_BASE_EVENTS_EVENT_H_ |
| 6 #define UI_BASE_EVENTS_EVENT_H_ | 6 #define UI_BASE_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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 class UI_EXPORT ScrollEvent : public MouseEvent { | 615 class UI_EXPORT ScrollEvent : public MouseEvent { |
| 616 public: | 616 public: |
| 617 explicit ScrollEvent(const base::NativeEvent& native_event); | 617 explicit ScrollEvent(const base::NativeEvent& native_event); |
| 618 template <class T> | 618 template <class T> |
| 619 ScrollEvent(const ScrollEvent& model, | 619 ScrollEvent(const ScrollEvent& model, |
| 620 T* source, | 620 T* source, |
| 621 T* target) | 621 T* target) |
| 622 : MouseEvent(model, source, target), | 622 : MouseEvent(model, source, target), |
| 623 x_offset_(model.x_offset_), | 623 x_offset_(model.x_offset_), |
| 624 y_offset_(model.y_offset_), | 624 y_offset_(model.y_offset_), |
| 625 x_offset_ordinal_(model.x_offset_ordinal_), |
| 626 y_offset_ordinal_(model.y_offset_ordinal_), |
| 625 finger_count_(model.finger_count_){ | 627 finger_count_(model.finger_count_){ |
| 626 } | 628 } |
| 627 | 629 |
| 628 // Used for tests. | 630 // Used for tests. |
| 629 ScrollEvent(EventType type, | 631 ScrollEvent(EventType type, |
| 630 const gfx::Point& location, | 632 const gfx::Point& location, |
| 631 base::TimeDelta time_stamp, | 633 base::TimeDelta time_stamp, |
| 632 int flags, | 634 int flags, |
| 633 float x_offset, | 635 float x_offset, |
| 634 float y_offset, | 636 float y_offset, |
| 637 float x_offset_ordinal, |
| 638 float y_offset_ordinal, |
| 635 int finger_count); | 639 int finger_count); |
| 636 | 640 |
| 637 // Scale the scroll event's offset value. | 641 // Scale the scroll event's offset value. |
| 638 // This is useful in the multi-monitor setup where it needs to be scaled | 642 // This is useful in the multi-monitor setup where it needs to be scaled |
| 639 // to provide a consistent user experience. | 643 // to provide a consistent user experience. |
| 640 void Scale(const float factor); | 644 void Scale(const float factor); |
| 641 | 645 |
| 642 float x_offset() const { return x_offset_; } | 646 float x_offset() const { return x_offset_; } |
| 643 float y_offset() const { return y_offset_; } | 647 float y_offset() const { return y_offset_; } |
| 648 float x_offset_ordinal() const { return x_offset_ordinal_; } |
| 649 float y_offset_ordinal() const { return y_offset_ordinal_; } |
| 644 int finger_count() const { return finger_count_; } | 650 int finger_count() const { return finger_count_; } |
| 645 | 651 |
| 646 private: | 652 private: |
| 653 // Potential accelerated offsets. |
| 647 float x_offset_; | 654 float x_offset_; |
| 648 float y_offset_; | 655 float y_offset_; |
| 656 // Unaccelerated offsets. |
| 657 float x_offset_ordinal_; |
| 658 float y_offset_ordinal_; |
| 659 // Number of fingers on the pad. |
| 649 int finger_count_; | 660 int finger_count_; |
| 650 }; | 661 }; |
| 651 | 662 |
| 652 class UI_EXPORT GestureEvent : public LocatedEvent { | 663 class UI_EXPORT GestureEvent : public LocatedEvent { |
| 653 public: | 664 public: |
| 654 GestureEvent(EventType type, | 665 GestureEvent(EventType type, |
| 655 int x, | 666 int x, |
| 656 int y, | 667 int y, |
| 657 int flags, | 668 int flags, |
| 658 base::TimeDelta time_stamp, | 669 base::TimeDelta time_stamp, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 685 // This value is stored as a bitfield because the number of touch ids varies, | 696 // This value is stored as a bitfield because the number of touch ids varies, |
| 686 // but we currently don't need more than 32 touches at a time. | 697 // but we currently don't need more than 32 touches at a time. |
| 687 const unsigned int touch_ids_bitfield_; | 698 const unsigned int touch_ids_bitfield_; |
| 688 | 699 |
| 689 DISALLOW_COPY_AND_ASSIGN(GestureEvent); | 700 DISALLOW_COPY_AND_ASSIGN(GestureEvent); |
| 690 }; | 701 }; |
| 691 | 702 |
| 692 } // namespace ui | 703 } // namespace ui |
| 693 | 704 |
| 694 #endif // UI_BASE_EVENTS_EVENT_H_ | 705 #endif // UI_BASE_EVENTS_EVENT_H_ |
| OLD | NEW |