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 // This class describe a keyboard accelerator (or keyboard shortcut). | 5 // This class describe a keyboard accelerator (or keyboard shortcut). |
6 // Keyboard accelerators are registered with the FocusManager. | 6 // Keyboard accelerators are registered with the FocusManager. |
7 // It has a copy constructor and assignment operator so that it can be copied. | 7 // It has a copy constructor and assignment operator so that it can be copied. |
8 // It also defines the < operator so that it can be used as a key in a std::map. | 8 // It also defines the < operator so that it can be used as a key in a std::map. |
9 // | 9 // |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 int modifiers, | 46 int modifiers, |
47 KeyState key_state = KeyState::PRESSED); | 47 KeyState key_state = KeyState::PRESSED); |
48 explicit Accelerator(const KeyEvent& key_event); | 48 explicit Accelerator(const KeyEvent& key_event); |
49 Accelerator(const Accelerator& accelerator); | 49 Accelerator(const Accelerator& accelerator); |
50 ~Accelerator(); | 50 ~Accelerator(); |
51 | 51 |
52 // Masks out all the non-modifiers KeyEvent |flags| and returns only the | 52 // Masks out all the non-modifiers KeyEvent |flags| and returns only the |
53 // available modifier ones. This does not include EF_IS_REPEAT. | 53 // available modifier ones. This does not include EF_IS_REPEAT. |
54 static int MaskOutKeyEventFlags(int flags); | 54 static int MaskOutKeyEventFlags(int flags); |
55 | 55 |
| 56 KeyEvent ToKeyEvent() const; |
| 57 |
56 Accelerator& operator=(const Accelerator& accelerator); | 58 Accelerator& operator=(const Accelerator& accelerator); |
57 | 59 |
58 // Define the < operator so that the KeyboardShortcut can be used as a key in | 60 // Define the < operator so that the KeyboardShortcut can be used as a key in |
59 // a std::map. | 61 // a std::map. |
60 bool operator <(const Accelerator& rhs) const; | 62 bool operator <(const Accelerator& rhs) const; |
61 | 63 |
62 bool operator ==(const Accelerator& rhs) const; | 64 bool operator ==(const Accelerator& rhs) const; |
63 | 65 |
64 bool operator !=(const Accelerator& rhs) const; | 66 bool operator !=(const Accelerator& rhs) const; |
65 | 67 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 virtual bool GetAcceleratorForCommandId(int command_id, | 132 virtual bool GetAcceleratorForCommandId(int command_id, |
131 Accelerator* accelerator) const = 0; | 133 Accelerator* accelerator) const = 0; |
132 | 134 |
133 protected: | 135 protected: |
134 virtual ~AcceleratorProvider() {} | 136 virtual ~AcceleratorProvider() {} |
135 }; | 137 }; |
136 | 138 |
137 } // namespace ui | 139 } // namespace ui |
138 | 140 |
139 #endif // UI_BASE_ACCELERATORS_ACCELERATOR_H_ | 141 #endif // UI_BASE_ACCELERATORS_ACCELERATOR_H_ |
OLD | NEW |