OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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" |
(...skipping 16 matching lines...) Expand all Loading... |
27 }; | 27 }; |
28 typedef NSInteger ButtonType; | 28 typedef NSInteger ButtonType; |
29 | 29 |
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 | |
38 NSTimeInterval lastHoverUpdate_; | |
39 scoped_nsobject<NSGradient> gradient_; | 37 scoped_nsobject<NSGradient> gradient_; |
40 scoped_nsobject<NSImage> underlayImage_; | 38 scoped_nsobject<NSImage> underlayImage_; |
41 } | 39 } |
42 | 40 |
43 // Turn off theming. Temporary work-around. | 41 // Turn off theming. Temporary work-around. |
44 - (void)setShouldTheme:(BOOL)shouldTheme; | 42 - (void)setShouldTheme:(BOOL)shouldTheme; |
45 | 43 |
46 - (void)drawBorderAndFillForTheme:(GTMTheme*)theme | 44 - (void)drawBorderAndFillForTheme:(GTMTheme*)theme |
47 controlView:(NSView*)controlView | 45 controlView:(NSView*)controlView |
48 outerPath:(NSBezierPath*)outerPath | 46 outerPath:(NSBezierPath*)outerPath |
49 innerPath:(NSBezierPath*)innerPath | 47 innerPath:(NSBezierPath*)innerPath |
| 48 showHighlightGradient:(BOOL)showHighlightGradient |
50 showClickedGradient:(BOOL)showClickedGradient | 49 showClickedGradient:(BOOL)showClickedGradient |
51 showHighlightGradient:(BOOL)showHighlightGradient | |
52 hoverAlpha:(CGFloat)hoverAlpha | |
53 active:(BOOL)active | 50 active:(BOOL)active |
54 cellFrame:(NSRect)cellFrame; | 51 cellFrame:(NSRect)cellFrame; |
55 | 52 |
56 // An image to underlay beneath the existing image; not themed. May be nil. | 53 // An image to underlay beneath the existing image; not themed. May be nil. |
57 - (NSImage*)underlayImage; | 54 - (NSImage*)underlayImage; |
58 - (void)setUnderlayImage:(NSImage*)image; | 55 - (void)setUnderlayImage:(NSImage*)image; |
59 | 56 |
60 // Let the view know when the mouse moves in and out. A timer will update | |
61 // the current hoverAlpha_ based on these events. | |
62 - (void)setMouseInside:(BOOL)flag animate:(BOOL)animate; | |
63 | |
64 @property(assign, nonatomic)CGFloat hoverAlpha; | |
65 @end | 57 @end |
66 | 58 |
67 @interface GradientButtonCell(TestingAPI) | 59 @interface GradientButtonCell(TestingAPI) |
68 - (BOOL)isMouseInside; | 60 - (BOOL)isMouseInside; |
69 @end | 61 @end |
70 | 62 |
71 #endif // CHROME_BROWSER_COCOA_CHROMIUM_BUTTON_CELL_H_ | 63 #endif // CHROME_BROWSER_COCOA_CHROMIUM_BUTTON_CELL_H_ |
OLD | NEW |