Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: views/accelerator.h

Issue 2742003: Adds support for showing accelerators in bookmark menus. (Closed)
Patch Set: Added GetAcceleratorText Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | views/accelerator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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
11 #ifndef VIEWS_ACCELERATOR_H_ 11 #ifndef VIEWS_ACCELERATOR_H_
12 #define VIEWS_ACCELERATOR_H_ 12 #define VIEWS_ACCELERATOR_H_
13 13
14 #include <string> 14 #include <string>
15 15
16 #include "app/menus/accelerator.h" 16 #include "app/menus/accelerator.h"
17 #include "views/event.h" 17 #include "views/event.h"
18 18
19 namespace views { 19 namespace views {
20 20
21 class Accelerator : public menus::Accelerator { 21 class Accelerator : public menus::Accelerator {
22 public: 22 public:
23 Accelerator() : menus::Accelerator() {}
24
23 Accelerator(base::KeyboardCode keycode, 25 Accelerator(base::KeyboardCode keycode,
24 bool shift_pressed, bool ctrl_pressed, bool alt_pressed) { 26 bool shift_pressed, bool ctrl_pressed, bool alt_pressed) {
25 key_code_ = keycode; 27 key_code_ = keycode;
26 modifiers_ = 0; 28 modifiers_ = 0;
27 if (shift_pressed) 29 if (shift_pressed)
28 modifiers_ |= Event::EF_SHIFT_DOWN; 30 modifiers_ |= Event::EF_SHIFT_DOWN;
29 if (ctrl_pressed) 31 if (ctrl_pressed)
30 modifiers_ |= Event::EF_CONTROL_DOWN; 32 modifiers_ |= Event::EF_CONTROL_DOWN;
31 if (alt_pressed) 33 if (alt_pressed)
32 modifiers_ |= Event::EF_ALT_DOWN; 34 modifiers_ |= Event::EF_ALT_DOWN;
(...skipping 23 matching lines...) Expand all
56 public: 58 public:
57 // This method should return true if the accelerator was processed. 59 // This method should return true if the accelerator was processed.
58 virtual bool AcceleratorPressed(const Accelerator& accelerator) = 0; 60 virtual bool AcceleratorPressed(const Accelerator& accelerator) = 0;
59 61
60 protected: 62 protected:
61 virtual ~AcceleratorTarget() {} 63 virtual ~AcceleratorTarget() {}
62 }; 64 };
63 } 65 }
64 66
65 #endif // VIEWS_ACCELERATOR_H_ 67 #endif // VIEWS_ACCELERATOR_H_
OLDNEW
« no previous file with comments | « no previous file | views/accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698