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_GRADIENT_BUTTON_CELL_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_GRADIENT_BUTTON_CELL_H_ |
6 #define CHROME_BROWSER_UI_COCOA_GRADIENT_BUTTON_CELL_H_ | 6 #define CHROME_BROWSER_UI_COCOA_GRADIENT_BUTTON_CELL_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/memory/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
11 | 11 |
12 namespace ui { | 12 namespace ui { |
13 class ThemeProvider; | 13 class ThemeProvider; |
14 } | 14 } |
15 | 15 |
16 // Base class for button cells for toolbar and bookmark bar. | 16 // Base class for button cells for toolbar and bookmark bar. |
17 // | 17 // |
18 // This is a button cell that handles drawing/highlighting of buttons. | 18 // This is a button cell that handles drawing/highlighting of buttons. |
19 // The appearance is determined by setting the cell's tag (not the | 19 // The appearance is determined by setting the cell's tag (not the |
20 // view's) to one of the constants below (ButtonType). | 20 // view's) to one of the constants below (ButtonType). |
(...skipping 27 matching lines...) Expand all Loading... |
48 } PulseState; | 48 } PulseState; |
49 | 49 |
50 }; | 50 }; |
51 | 51 |
52 | 52 |
53 @interface GradientButtonCell : NSButtonCell { | 53 @interface GradientButtonCell : NSButtonCell { |
54 @private | 54 @private |
55 // Custom drawing means we need to perform our own mouse tracking if | 55 // Custom drawing means we need to perform our own mouse tracking if |
56 // the cell is setShowsBorderOnlyWhileMouseInside:YES. | 56 // the cell is setShowsBorderOnlyWhileMouseInside:YES. |
57 BOOL isMouseInside_; | 57 BOOL isMouseInside_; |
58 scoped_nsobject<NSTrackingArea> trackingArea_; | 58 base::scoped_nsobject<NSTrackingArea> trackingArea_; |
59 BOOL shouldTheme_; | 59 BOOL shouldTheme_; |
60 CGFloat hoverAlpha_; // 0-1. Controls the alpha during mouse hover | 60 CGFloat hoverAlpha_; // 0-1. Controls the alpha during mouse hover |
61 NSTimeInterval lastHoverUpdate_; | 61 NSTimeInterval lastHoverUpdate_; |
62 scoped_nsobject<NSGradient> gradient_; | 62 base::scoped_nsobject<NSGradient> gradient_; |
63 gradient_button_cell::PulseState pulseState_; | 63 gradient_button_cell::PulseState pulseState_; |
64 CGFloat pulseMultiplier_; // for selecting pulse direction when continuous. | 64 CGFloat pulseMultiplier_; // for selecting pulse direction when continuous. |
65 CGFloat outerStrokeAlphaMult_; // For pulsing. | 65 CGFloat outerStrokeAlphaMult_; // For pulsing. |
66 scoped_nsobject<NSImage> overlayImage_; | 66 base::scoped_nsobject<NSImage> overlayImage_; |
67 } | 67 } |
68 | 68 |
69 // Turn off theming. Temporary work-around. | 69 // Turn off theming. Temporary work-around. |
70 - (void)setShouldTheme:(BOOL)shouldTheme; | 70 - (void)setShouldTheme:(BOOL)shouldTheme; |
71 | 71 |
72 - (void)drawBorderAndFillForTheme:(ui::ThemeProvider*)themeProvider | 72 - (void)drawBorderAndFillForTheme:(ui::ThemeProvider*)themeProvider |
73 controlView:(NSView*)controlView | 73 controlView:(NSView*)controlView |
74 innerPath:(NSBezierPath*)innerPath | 74 innerPath:(NSBezierPath*)innerPath |
75 showClickedGradient:(BOOL)showClickedGradient | 75 showClickedGradient:(BOOL)showClickedGradient |
76 showHighlightGradient:(BOOL)showHighlightGradient | 76 showHighlightGradient:(BOOL)showHighlightGradient |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 @end | 119 @end |
120 | 120 |
121 @interface GradientButtonCell(TestingAPI) | 121 @interface GradientButtonCell(TestingAPI) |
122 - (BOOL)isMouseInside; | 122 - (BOOL)isMouseInside; |
123 - (BOOL)pulsing; | 123 - (BOOL)pulsing; |
124 - (gradient_button_cell::PulseState)pulseState; | 124 - (gradient_button_cell::PulseState)pulseState; |
125 - (void)setPulseState:(gradient_button_cell::PulseState)pstate; | 125 - (void)setPulseState:(gradient_button_cell::PulseState)pstate; |
126 @end | 126 @end |
127 | 127 |
128 #endif // CHROME_BROWSER_UI_COCOA_GRADIENT_BUTTON_CELL_H_ | 128 #endif // CHROME_BROWSER_UI_COCOA_GRADIENT_BUTTON_CELL_H_ |
OLD | NEW |