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