summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/cocoa/multi_key_equivalent_button.h
blob: 14811dcd08d0e43966ea598376b652b4c201b283 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_COCOA_MULTI_KEY_EQUIVALENT_BUTTON_H_
#define CHROME_BROWSER_UI_COCOA_MULTI_KEY_EQUIVALENT_BUTTON_H_

#import <AppKit/AppKit.h>

#include <vector>

struct KeyEquivalentAndModifierMask {
 public:
  KeyEquivalentAndModifierMask() : charCode(nil), mask(0) {}
  NSString* charCode;
  NSUInteger mask;
};

// MultiKeyEquivalentButton is an NSButton subclass that is capable of
// responding to additional key equivalents.  It will respond to the ordinary
// NSButton key equivalent set by -setKeyEquivalent: and
// -setKeyEquivalentModifierMask:, and it will also respond to any additional
// equivalents provided to it in a KeyEquivalentAndModifierMask structure
// passed to -addKeyEquivalent:.

@interface MultiKeyEquivalentButton : NSButton {
 @private
  std::vector<KeyEquivalentAndModifierMask> extraKeys_;
}

- (void)addKeyEquivalent:(KeyEquivalentAndModifierMask)key;

@end

#endif  // CHROME_BROWSER_UI_COCOA_MULTI_KEY_EQUIVALENT_BUTTON_H_