| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_UI_COCOA_TOOLBAR_TOOLBAR_BUTTON_COCOA_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_TOOLBAR_TOOLBAR_BUTTON_COCOA_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_TOOLBAR_TOOLBAR_BUTTON_COCOA_H_ | 6 #define CHROME_BROWSER_UI_COCOA_TOOLBAR_TOOLBAR_BUTTON_COCOA_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #import "base/mac/scoped_nsobject.h" |
| 10 #import "chrome/browser/ui/cocoa/themed_window.h" | 11 #import "chrome/browser/ui/cocoa/themed_window.h" |
| 11 #import "ui/gfx/color_utils.h" | 12 #import "ui/gfx/color_utils.h" |
| 12 #include "ui/gfx/vector_icons_public.h" | 13 #include "ui/gfx/vector_icons_public.h" |
| 13 | 14 |
| 14 enum class ToolbarButtonImageBackgroundStyle { | 15 enum class ToolbarButtonImageBackgroundStyle { |
| 16 DEFAULT, |
| 15 HOVER, | 17 HOVER, |
| 16 HOVER_THEMED, | 18 HOVER_THEMED, |
| 17 PRESSED, | 19 PRESSED, |
| 18 PRESSED_THEMED, | 20 PRESSED_THEMED, |
| 19 }; | 21 }; |
| 20 | 22 |
| 21 // NSButton subclass which handles middle mouse clicking. | 23 // NSButton subclass which handles middle mouse clicking. |
| 22 @interface ToolbarButton : NSButton<ThemedWindowDrawing> { | 24 @interface ToolbarButton : NSButton<ThemedWindowDrawing> { |
| 23 @protected | 25 @protected |
| 26 // The toolbar button's image, as assigned by setImage:. |
| 27 base::scoped_nsobject<NSImage> image_; |
| 28 |
| 24 // YES when middle mouse clicks should be handled. | 29 // YES when middle mouse clicks should be handled. |
| 25 BOOL handleMiddleClick_; | 30 BOOL handleMiddleClick_; |
| 26 } | 31 } |
| 27 | 32 |
| 28 // Return the size of toolbar buttons. | 33 // Return the size of toolbar buttons. |
| 29 + (NSSize)toolbarButtonSize; | 34 + (NSSize)toolbarButtonSize; |
| 30 // Whether or not to handle the mouse middle click events. | 35 // Whether or not to handle the mouse middle click events. |
| 31 @property(assign, nonatomic) BOOL handleMiddleClick; | 36 @property(assign, nonatomic) BOOL handleMiddleClick; |
| 32 // Override point for subclasses to return their vector icon id. | 37 // Override point for subclasses to return their vector icon id. |
| 33 - (gfx::VectorIconId)vectorIconId; | 38 - (gfx::VectorIconId)vectorIconId; |
| 34 // Override point for subclasses to return their vector icon color. | 39 // Override point for subclasses to return their vector icon color. |
| 35 - (SkColor)vectorIconColor:(BOOL)themeIsDark; | 40 - (SkColor)vectorIconColor:(BOOL)themeIsDark; |
| 36 // When in Material Design mode, sets the images for each of the ToolbarButton's | 41 // When in Material Design mode, sets the images for each of the ToolbarButton's |
| 37 // states from the specified image. | 42 // states from the specified image. |
| 38 - (void)setImage:(NSImage*)anImage; | 43 - (void)setImage:(NSImage*)anImage; |
| 39 // Resets the images for each of the ToolbarButton's states from its vector icon | 44 // Resets the images for each of the ToolbarButton's states from its vector icon |
| 40 // id or its main image. Should only be called when in Material Design mode. | 45 // id or its main image. Should only be called when in Material Design mode. |
| 41 - (void)resetButtonStateImages; | 46 - (void)resetButtonStateImages; |
| 42 @end | 47 @end |
| 43 | 48 |
| 44 @interface ToolbarButton (ExposedForTesting) | 49 @interface ToolbarButton (ExposedForTesting) |
| 45 - (BOOL)shouldHandleEvent:(NSEvent*)theEvent; | 50 - (BOOL)shouldHandleEvent:(NSEvent*)theEvent; |
| 46 @end | 51 @end |
| 47 | 52 |
| 48 #endif // CHROME_BROWSER_UI_COCOA_TOOLBAR_TOOLBAR_BUTTON_COCOA_H_ | 53 #endif // CHROME_BROWSER_UI_COCOA_TOOLBAR_TOOLBAR_BUTTON_COCOA_H_ |
| OLD | NEW |