| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // events that are not cancelable. | 74 // events that are not cancelable. |
| 75 bool cancelable() const { return cancelable_; } | 75 bool cancelable() const { return cancelable_; } |
| 76 | 76 |
| 77 // The following methods return true if the respective keys were pressed at | 77 // The following methods return true if the respective keys were pressed at |
| 78 // the time the event was created. | 78 // the time the event was created. |
| 79 bool IsShiftDown() const { return (flags_ & EF_SHIFT_DOWN) != 0; } | 79 bool IsShiftDown() const { return (flags_ & EF_SHIFT_DOWN) != 0; } |
| 80 bool IsControlDown() const { return (flags_ & EF_CONTROL_DOWN) != 0; } | 80 bool IsControlDown() const { return (flags_ & EF_CONTROL_DOWN) != 0; } |
| 81 bool IsCapsLockDown() const { return (flags_ & EF_CAPS_LOCK_DOWN) != 0; } | 81 bool IsCapsLockDown() const { return (flags_ & EF_CAPS_LOCK_DOWN) != 0; } |
| 82 bool IsAltDown() const { return (flags_ & EF_ALT_DOWN) != 0; } | 82 bool IsAltDown() const { return (flags_ & EF_ALT_DOWN) != 0; } |
| 83 bool IsAltGrDown() const { return (flags_ & EF_ALTGR_DOWN) != 0; } | 83 bool IsAltGrDown() const { return (flags_ & EF_ALTGR_DOWN) != 0; } |
| 84 bool IsRepeat() const { return (flags_ & EF_IS_REPEAT) != 0; } |
| 84 | 85 |
| 85 bool IsKeyEvent() const { | 86 bool IsKeyEvent() const { |
| 86 return type_ == ET_KEY_PRESSED || | 87 return type_ == ET_KEY_PRESSED || |
| 87 type_ == ET_KEY_RELEASED || | 88 type_ == ET_KEY_RELEASED || |
| 88 type_ == ET_TRANSLATED_KEY_PRESS || | 89 type_ == ET_TRANSLATED_KEY_PRESS || |
| 89 type_ == ET_TRANSLATED_KEY_RELEASE; | 90 type_ == ET_TRANSLATED_KEY_RELEASE; |
| 90 } | 91 } |
| 91 | 92 |
| 92 bool IsMouseEvent() const { | 93 bool IsMouseEvent() const { |
| 93 return type_ == ET_MOUSE_PRESSED || | 94 return type_ == ET_MOUSE_PRESSED || |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 // | 575 // |
| 575 // This value represents the physical position in the keyboard and can be | 576 // This value represents the physical position in the keyboard and can be |
| 576 // converted from / to keyboard scan code like XKB. | 577 // converted from / to keyboard scan code like XKB. |
| 577 std::string code_; | 578 std::string code_; |
| 578 | 579 |
| 579 // True if this is a translated character event (vs. a raw key down). Both | 580 // True if this is a translated character event (vs. a raw key down). Both |
| 580 // share the same type: ET_KEY_PRESSED. | 581 // share the same type: ET_KEY_PRESSED. |
| 581 bool is_char_; | 582 bool is_char_; |
| 582 | 583 |
| 583 uint16 character_; | 584 uint16 character_; |
| 585 |
| 586 static bool IsRepeated(const KeyEvent& event); |
| 587 |
| 588 static KeyEvent* last_key_event_; |
| 584 }; | 589 }; |
| 585 | 590 |
| 586 class EVENTS_EXPORT ScrollEvent : public MouseEvent { | 591 class EVENTS_EXPORT ScrollEvent : public MouseEvent { |
| 587 public: | 592 public: |
| 588 explicit ScrollEvent(const base::NativeEvent& native_event); | 593 explicit ScrollEvent(const base::NativeEvent& native_event); |
| 589 template <class T> | 594 template <class T> |
| 590 ScrollEvent(const ScrollEvent& model, | 595 ScrollEvent(const ScrollEvent& model, |
| 591 T* source, | 596 T* source, |
| 592 T* target) | 597 T* target) |
| 593 : MouseEvent(model, source, target), | 598 : MouseEvent(model, source, target), |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 // The set of indices of ones in the binary representation of | 670 // The set of indices of ones in the binary representation of |
| 666 // touch_ids_bitfield_ is the set of touch_ids associate with this gesture. | 671 // touch_ids_bitfield_ is the set of touch_ids associate with this gesture. |
| 667 // This value is stored as a bitfield because the number of touch ids varies, | 672 // This value is stored as a bitfield because the number of touch ids varies, |
| 668 // but we currently don't need more than 32 touches at a time. | 673 // but we currently don't need more than 32 touches at a time. |
| 669 const unsigned int touch_ids_bitfield_; | 674 const unsigned int touch_ids_bitfield_; |
| 670 }; | 675 }; |
| 671 | 676 |
| 672 } // namespace ui | 677 } // namespace ui |
| 673 | 678 |
| 674 #endif // UI_EVENTS_EVENT_H_ | 679 #endif // UI_EVENTS_EVENT_H_ |
| OLD | NEW |