| 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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 // Identifies the button that changed. During a press this corresponds to the | 455 // Identifies the button that changed. During a press this corresponds to the |
| 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 // Replace the pointer type (e.g. to EventPointerType::POINTER_TYPE_PEN) for | |
| 466 // stylus devices. | |
| 467 void set_pointer_type(EventPointerType type) { | |
| 468 pointer_details_.pointer_type_ = type; | |
| 469 } | |
| 470 | |
| 471 // Update properties for stylus devices exposed through the Pointer Events | |
| 472 // spec. | |
| 473 void set_force(const float f) { pointer_details_.force_ = f; } | |
| 474 void set_tilt_x(const float t) { pointer_details_.tilt_x_ = t; } | |
| 475 void set_tilt_y(const float t) { pointer_details_.tilt_y_ = t; } | |
| 476 void set_radius_x(const float r) { pointer_details_.radius_x_ = r; } | |
| 477 void set_radius_y(const float r) { pointer_details_.radius_y_ = r; } | |
| 478 | |
| 479 // Event details common to MouseEvent and TouchEvent. | 465 // Event details common to MouseEvent and TouchEvent. |
| 480 const PointerDetails& pointer_details() { return pointer_details_; } | 466 const PointerDetails& pointer_details() { return pointer_details_; } |
| 467 void set_pointer_details(const PointerDetails& details) { |
| 468 pointer_details_ = details; |
| 469 } |
| 481 | 470 |
| 482 private: | 471 private: |
| 483 FRIEND_TEST_ALL_PREFIXES(EventTest, DoubleClickRequiresRelease); | 472 FRIEND_TEST_ALL_PREFIXES(EventTest, DoubleClickRequiresRelease); |
| 484 FRIEND_TEST_ALL_PREFIXES(EventTest, SingleClickRightLeft); | 473 FRIEND_TEST_ALL_PREFIXES(EventTest, SingleClickRightLeft); |
| 485 | 474 |
| 486 // Returns the flags for the mouse buttons. | 475 // Returns the flags for the mouse buttons. |
| 487 int button_flags() const { | 476 int button_flags() const { |
| 488 return flags() & (EF_LEFT_MOUSE_BUTTON | EF_MIDDLE_MOUSE_BUTTON | | 477 return flags() & (EF_LEFT_MOUSE_BUTTON | EF_MIDDLE_MOUSE_BUTTON | |
| 489 EF_RIGHT_MOUSE_BUTTON | EF_BACK_MOUSE_BUTTON | | 478 EF_RIGHT_MOUSE_BUTTON | EF_BACK_MOUSE_BUTTON | |
| 490 EF_FORWARD_MOUSE_BUTTON); | 479 EF_FORWARD_MOUSE_BUTTON); |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 | 932 |
| 944 const GestureEventDetails& details() const { return details_; } | 933 const GestureEventDetails& details() const { return details_; } |
| 945 | 934 |
| 946 private: | 935 private: |
| 947 GestureEventDetails details_; | 936 GestureEventDetails details_; |
| 948 }; | 937 }; |
| 949 | 938 |
| 950 } // namespace ui | 939 } // namespace ui |
| 951 | 940 |
| 952 #endif // UI_EVENTS_EVENT_H_ | 941 #endif // UI_EVENTS_EVENT_H_ |
| OLD | NEW |