| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_COCOA_CHROMIUM_BUTTON_CELL_H_ | 5 #ifndef CHROME_BROWSER_COCOA_CHROMIUM_BUTTON_CELL_H_ |
| 6 #define CHROME_BROWSER_COCOA_CHROMIUM_BUTTON_CELL_H_ | 6 #define CHROME_BROWSER_COCOA_CHROMIUM_BUTTON_CELL_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/scoped_nsobject.h" | 10 #include "base/scoped_nsobject.h" |
| 11 | 11 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 30 @interface GradientButtonCell : NSButtonCell { | 30 @interface GradientButtonCell : NSButtonCell { |
| 31 @private | 31 @private |
| 32 // Custom drawing means we need to perform our own mouse tracking if | 32 // Custom drawing means we need to perform our own mouse tracking if |
| 33 // the cell is setShowsBorderOnlyWhileMouseInside:YES. | 33 // the cell is setShowsBorderOnlyWhileMouseInside:YES. |
| 34 BOOL isMouseInside_; | 34 BOOL isMouseInside_; |
| 35 scoped_nsobject<NSTrackingArea> trackingArea_; | 35 scoped_nsobject<NSTrackingArea> trackingArea_; |
| 36 BOOL shouldTheme_; | 36 BOOL shouldTheme_; |
| 37 CGFloat hoverAlpha_; // 0-1. Controls the alpha during mouse hover | 37 CGFloat hoverAlpha_; // 0-1. Controls the alpha during mouse hover |
| 38 NSTimeInterval lastHoverUpdate_; | 38 NSTimeInterval lastHoverUpdate_; |
| 39 scoped_nsobject<NSGradient> gradient_; | 39 scoped_nsobject<NSGradient> gradient_; |
| 40 scoped_nsobject<NSImage> underlayImage_; | |
| 41 } | 40 } |
| 42 | 41 |
| 43 // Turn off theming. Temporary work-around. | 42 // Turn off theming. Temporary work-around. |
| 44 - (void)setShouldTheme:(BOOL)shouldTheme; | 43 - (void)setShouldTheme:(BOOL)shouldTheme; |
| 45 | 44 |
| 46 - (void)drawBorderAndFillForTheme:(ThemeProvider*)themeProvider | 45 - (void)drawBorderAndFillForTheme:(ThemeProvider*)themeProvider |
| 47 controlView:(NSView*)controlView | 46 controlView:(NSView*)controlView |
| 48 innerPath:(NSBezierPath*)innerPath | 47 innerPath:(NSBezierPath*)innerPath |
| 49 showClickedGradient:(BOOL)showClickedGradient | 48 showClickedGradient:(BOOL)showClickedGradient |
| 50 showHighlightGradient:(BOOL)showHighlightGradient | 49 showHighlightGradient:(BOOL)showHighlightGradient |
| 51 hoverAlpha:(CGFloat)hoverAlpha | 50 hoverAlpha:(CGFloat)hoverAlpha |
| 52 active:(BOOL)active | 51 active:(BOOL)active |
| 53 cellFrame:(NSRect)cellFrame | 52 cellFrame:(NSRect)cellFrame |
| 54 defaultGradient:(NSGradient*)defaultGradient; | 53 defaultGradient:(NSGradient*)defaultGradient; |
| 55 | 54 |
| 56 // An image to underlay beneath the existing image; not themed. May be nil. | |
| 57 - (NSImage*)underlayImage; | |
| 58 - (void)setUnderlayImage:(NSImage*)image; | |
| 59 | |
| 60 // Let the view know when the mouse moves in and out. A timer will update | 55 // Let the view know when the mouse moves in and out. A timer will update |
| 61 // the current hoverAlpha_ based on these events. | 56 // the current hoverAlpha_ based on these events. |
| 62 - (void)setMouseInside:(BOOL)flag animate:(BOOL)animate; | 57 - (void)setMouseInside:(BOOL)flag animate:(BOOL)animate; |
| 63 | 58 |
| 64 // Gets the path which tightly bounds the outside of the button. This is needed | 59 // Gets the path which tightly bounds the outside of the button. This is needed |
| 65 // to produce images of clear buttons which only include the area inside, since | 60 // to produce images of clear buttons which only include the area inside, since |
| 66 // the background of the button is drawn by someone else. | 61 // the background of the button is drawn by someone else. |
| 67 - (NSBezierPath*)clipPathForFrame:(NSRect)cellFrame | 62 - (NSBezierPath*)clipPathForFrame:(NSRect)cellFrame |
| 68 inView:(NSView*)controlView; | 63 inView:(NSView*)controlView; |
| 69 | 64 |
| 70 @property(assign, nonatomic)CGFloat hoverAlpha; | 65 @property(assign, nonatomic)CGFloat hoverAlpha; |
| 71 @end | 66 @end |
| 72 | 67 |
| 73 @interface GradientButtonCell(TestingAPI) | 68 @interface GradientButtonCell(TestingAPI) |
| 74 - (BOOL)isMouseInside; | 69 - (BOOL)isMouseInside; |
| 75 @end | 70 @end |
| 76 | 71 |
| 77 #endif // CHROME_BROWSER_COCOA_CHROMIUM_BUTTON_CELL_H_ | 72 #endif // CHROME_BROWSER_COCOA_CHROMIUM_BUTTON_CELL_H_ |
| OLD | NEW |