• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef CHROME_BROWSER_UI_COCOA_MULTI_KEY_EQUIVALENT_BUTTON_H_
6 #define CHROME_BROWSER_UI_COCOA_MULTI_KEY_EQUIVALENT_BUTTON_H_
7 
8 #import <AppKit/AppKit.h>
9 
10 #include <vector>
11 
12 struct KeyEquivalentAndModifierMask {
13  public:
KeyEquivalentAndModifierMaskKeyEquivalentAndModifierMask14   KeyEquivalentAndModifierMask() : charCode(nil), mask(0) {}
15   NSString* charCode;
16   NSUInteger mask;
17 };
18 
19 // MultiKeyEquivalentButton is an NSButton subclass that is capable of
20 // responding to additional key equivalents.  It will respond to the ordinary
21 // NSButton key equivalent set by -setKeyEquivalent: and
22 // -setKeyEquivalentModifierMask:, and it will also respond to any additional
23 // equivalents provided to it in a KeyEquivalentAndModifierMask structure
24 // passed to -addKeyEquivalent:.
25 
26 @interface MultiKeyEquivalentButton : NSButton {
27  @private
28   std::vector<KeyEquivalentAndModifierMask> extraKeys_;
29 }
30 
31 - (void)addKeyEquivalent:(KeyEquivalentAndModifierMask)key;
32 
33 @end
34 
35 #endif  // CHROME_BROWSER_UI_COCOA_MULTI_KEY_EQUIVALENT_BUTTON_H_
36