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/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // Custom drawing means we need to perform our own mouse tracking if | 57 // Custom drawing means we need to perform our own mouse tracking if |
58 // the cell is setShowsBorderOnlyWhileMouseInside:YES. | 58 // the cell is setShowsBorderOnlyWhileMouseInside:YES. |
59 BOOL isMouseInside_; | 59 BOOL isMouseInside_; |
60 base::scoped_nsobject<NSTrackingArea> trackingArea_; | 60 base::scoped_nsobject<NSTrackingArea> trackingArea_; |
61 BOOL shouldTheme_; | 61 BOOL shouldTheme_; |
62 CGFloat hoverAlpha_; // 0-1. Controls the alpha during mouse hover | 62 CGFloat hoverAlpha_; // 0-1. Controls the alpha during mouse hover |
63 NSTimeInterval lastHoverUpdate_; | 63 NSTimeInterval lastHoverUpdate_; |
64 base::scoped_nsobject<NSGradient> gradient_; | 64 base::scoped_nsobject<NSGradient> gradient_; |
65 gradient_button_cell::PulseState pulseState_; | 65 gradient_button_cell::PulseState pulseState_; |
66 CGFloat outerStrokeAlphaMult_; // For pulsing. | 66 CGFloat outerStrokeAlphaMult_; // For pulsing. |
67 base::scoped_nsobject<NSImage> overlayImage_; | |
68 } | 67 } |
69 | 68 |
70 // Turn off theming. Temporary work-around. | 69 // Turn off theming. Temporary work-around. |
71 - (void)setShouldTheme:(BOOL)shouldTheme; | 70 - (void)setShouldTheme:(BOOL)shouldTheme; |
72 | 71 |
73 - (void)drawBorderAndFillForTheme:(const ui::ThemeProvider*)themeProvider | 72 - (void)drawBorderAndFillForTheme:(const ui::ThemeProvider*)themeProvider |
74 controlView:(NSView*)controlView | 73 controlView:(NSView*)controlView |
75 innerPath:(NSBezierPath*)innerPath | 74 innerPath:(NSBezierPath*)innerPath |
76 showClickedGradient:(BOOL)showClickedGradient | 75 showClickedGradient:(BOOL)showClickedGradient |
77 showHighlightGradient:(BOOL)showHighlightGradient | 76 showHighlightGradient:(BOOL)showHighlightGradient |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 115 |
117 // The amount by which the gradient button cell should nudge the path used to | 116 // The amount by which the gradient button cell should nudge the path used to |
118 // draw the hover (and pressed) state background path. | 117 // draw the hover (and pressed) state background path. |
119 - (CGFloat)hoverBackgroundVerticalOffsetInControlView:(NSView*)controlView; | 118 - (CGFloat)hoverBackgroundVerticalOffsetInControlView:(NSView*)controlView; |
120 | 119 |
121 // Returns YES if the cell's tag indicates a Material Design button type. | 120 // Returns YES if the cell's tag indicates a Material Design button type. |
122 - (BOOL)isMaterialDesignButtonType; | 121 - (BOOL)isMaterialDesignButtonType; |
123 | 122 |
124 @property(assign, nonatomic) CGFloat hoverAlpha; | 123 @property(assign, nonatomic) CGFloat hoverAlpha; |
125 | 124 |
126 // An image that will be drawn after the normal content of the button cell, | |
127 // overlaying it. Never themed. | |
128 @property(retain, nonatomic) NSImage* overlayImage; | |
129 | |
130 @end | 125 @end |
131 | 126 |
132 @interface GradientButtonCell(TestingAPI) | 127 @interface GradientButtonCell(TestingAPI) |
133 - (BOOL)isMouseInside; | 128 - (BOOL)isMouseInside; |
134 - (BOOL)pulsing; | 129 - (BOOL)pulsing; |
135 - (gradient_button_cell::PulseState)pulseState; | 130 - (gradient_button_cell::PulseState)pulseState; |
136 - (void)setPulseState:(gradient_button_cell::PulseState)pstate; | 131 - (void)setPulseState:(gradient_button_cell::PulseState)pstate; |
137 @end | 132 @end |
138 | 133 |
139 #endif // CHROME_BROWSER_UI_COCOA_GRADIENT_BUTTON_CELL_H_ | 134 #endif // CHROME_BROWSER_UI_COCOA_GRADIENT_BUTTON_CELL_H_ |
OLD | NEW |