| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // Sets the event type if the accelerator should be processed on an event | 42 // Sets the event type if the accelerator should be processed on an event |
| 43 // other than ui::ET_KEY_PRESSED. | 43 // other than ui::ET_KEY_PRESSED. |
| 44 void set_type(ui::EventType type) { type_ = type; } | 44 void set_type(ui::EventType type) { type_ = type; } |
| 45 ui::EventType type() const { return type_; } | 45 ui::EventType type() const { return type_; } |
| 46 | 46 |
| 47 int modifiers() const { return modifiers_; } | 47 int modifiers() const { return modifiers_; } |
| 48 | 48 |
| 49 bool IsShiftDown() const; | 49 bool IsShiftDown() const; |
| 50 bool IsCtrlDown() const; | 50 bool IsCtrlDown() const; |
| 51 bool IsAltDown() const; | 51 bool IsAltDown() const; |
| 52 bool IsCmdDown() const; |
| 52 | 53 |
| 53 // Returns a string with the localized shortcut if any. | 54 // Returns a string with the localized shortcut if any. |
| 54 string16 GetShortcutText() const; | 55 string16 GetShortcutText() const; |
| 55 | 56 |
| 56 protected: | 57 protected: |
| 57 // The keycode (VK_...). | 58 // The keycode (VK_...). |
| 58 KeyboardCode key_code_; | 59 KeyboardCode key_code_; |
| 59 | 60 |
| 60 // The event type (usually ui::ET_KEY_PRESSED). | 61 // The event type (usually ui::ET_KEY_PRESSED). |
| 61 EventType type_; | 62 EventType type_; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 90 virtual bool GetAcceleratorForCommandId(int command_id, | 91 virtual bool GetAcceleratorForCommandId(int command_id, |
| 91 ui::Accelerator* accelerator) = 0; | 92 ui::Accelerator* accelerator) = 0; |
| 92 | 93 |
| 93 protected: | 94 protected: |
| 94 virtual ~AcceleratorProvider() {} | 95 virtual ~AcceleratorProvider() {} |
| 95 }; | 96 }; |
| 96 | 97 |
| 97 } // namespace ui | 98 } // namespace ui |
| 98 | 99 |
| 99 #endif // UI_BASE_ACCELERATORS_ACCELERATOR_H_ | 100 #endif // UI_BASE_ACCELERATORS_ACCELERATOR_H_ |
| OLD | NEW |