Home | History | Annotate | Download | only in toolbar
      1 // Copyright (c) 2011 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_TOOLBAR_TOOLBAR_BUTTON_H_
      6 #define CHROME_BROWSER_UI_COCOA_TOOLBAR_TOOLBAR_BUTTON_H_
      7 #pragma once
      8 
      9 #import <Cocoa/Cocoa.h>
     10 
     11 // NSButton subclass which handles middle mouse clicking.
     12 
     13 @interface ToolbarButton : NSButton {
     14  @protected
     15   // YES when middle mouse clicks should be handled.
     16   BOOL handleMiddleClick_;
     17 
     18   // YES when a middle mouse click is being handled. This is set to YES by an
     19   // NSOtherMouseDown event, and NO by an NSOtherMouseUp event. While this is
     20   // YES, other mouse button events should be ignored.
     21   BOOL handlingMiddleClick_;
     22 }
     23 
     24 // Whether or not to handle the mouse middle click events.
     25 @property(assign, nonatomic) BOOL handleMiddleClick;
     26 
     27 @end
     28 
     29 @interface ToolbarButton (ExposedForTesting)
     30 - (BOOL)shouldHandleEvent:(NSEvent*)theEvent;
     31 @end
     32 
     33 #endif  // CHROME_BROWSER_UI_COCOA_TOOLBAR_TOOLBAR_BUTTON_H_
     34