| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // Let the view know when the mouse moves in and out. A timer will update | 83 // Let the view know when the mouse moves in and out. A timer will update |
| 84 // the current hoverAlpha_ based on these events. | 84 // the current hoverAlpha_ based on these events. |
| 85 - (void)setMouseInside:(BOOL)flag animate:(BOOL)animate; | 85 - (void)setMouseInside:(BOOL)flag animate:(BOOL)animate; |
| 86 | 86 |
| 87 // Gets the path which tightly bounds the outside of the button. This is needed | 87 // Gets the path which tightly bounds the outside of the button. This is needed |
| 88 // to produce images of clear buttons which only include the area inside, since | 88 // to produce images of clear buttons which only include the area inside, since |
| 89 // the background of the button is drawn by someone else. | 89 // the background of the button is drawn by someone else. |
| 90 - (NSBezierPath*)clipPathForFrame:(NSRect)cellFrame | 90 - (NSBezierPath*)clipPathForFrame:(NSRect)cellFrame |
| 91 inView:(NSView*)controlView; | 91 inView:(NSView*)controlView; |
| 92 | 92 |
| 93 // Returns the amount by which the control frame is inset on all sides for |
| 94 // drawing. |
| 95 - (CGFloat)insetInView:(NSView*)controlView; |
| 96 |
| 93 // Turn on or off pulse sticking. When turning off sticking, leave our pulse | 97 // Turn on or off pulse sticking. When turning off sticking, leave our pulse |
| 94 // state in the correct ending position for our isMouseInside_ property. Public | 98 // state in the correct ending position for our isMouseInside_ property. Public |
| 95 // since it's called from the bookmark bubble. | 99 // since it's called from the bookmark bubble. |
| 96 - (void)setPulseIsStuckOn:(BOOL)continuous; | 100 - (void)setPulseIsStuckOn:(BOOL)continuous; |
| 97 | 101 |
| 98 // Returns continuous pulse state. | 102 // Returns continuous pulse state. |
| 99 - (BOOL)isPulseStuckOn; | 103 - (BOOL)isPulseStuckOn; |
| 100 | 104 |
| 101 // Safely stop continuous pulsing by turning off all timers. | 105 // Safely stop continuous pulsing by turning off all timers. |
| 102 // May leave the cell in an odd state. | 106 // May leave the cell in an odd state. |
| 103 // Needed by an owning control's dealloc routine. | 107 // Needed by an owning control's dealloc routine. |
| 104 - (void)safelyStopPulsing; | 108 - (void)safelyStopPulsing; |
| 105 | 109 |
| 106 // Actually fetches current mouse position and does a hit test. | 110 // Actually fetches current mouse position and does a hit test. |
| 107 - (BOOL)isMouseReallyInside; | 111 - (BOOL)isMouseReallyInside; |
| 108 | 112 |
| 109 // Returns the offset of the start of the text in the cell. | |
| 110 - (CGFloat)textStartXOffset; | |
| 111 | |
| 112 // Defines the top offset of text within the cell. Used by drawTitle and can | 113 // Defines the top offset of text within the cell. Used by drawTitle and can |
| 113 // be overriden by objects that inherit this class for placement of text. | 114 // be overriden by objects that inherit this class for placement of text. |
| 114 - (int)verticalTextOffset; | 115 - (int)verticalTextOffset; |
| 115 | 116 |
| 116 // The amount by which the gradient button cell should nudge the path used to | 117 // The amount by which the gradient button cell should nudge the path used to |
| 117 // draw the hover (and pressed) state background path. | 118 // draw the hover (and pressed) state background path. |
| 118 - (CGFloat)hoverBackgroundVerticalOffsetInControlView:(NSView*)controlView; | 119 - (CGFloat)hoverBackgroundVerticalOffsetInControlView:(NSView*)controlView; |
| 119 | 120 |
| 120 // Returns YES if the cell's tag indicates a Material Design button type. | 121 // Returns YES if the cell's tag indicates a Material Design button type. |
| 121 - (BOOL)isMaterialDesignButtonType; | 122 - (BOOL)isMaterialDesignButtonType; |
| 122 | 123 |
| 123 @property(assign, nonatomic) CGFloat hoverAlpha; | 124 @property(assign, nonatomic) CGFloat hoverAlpha; |
| 124 | 125 |
| 125 // An image that will be drawn after the normal content of the button cell, | 126 // An image that will be drawn after the normal content of the button cell, |
| 126 // overlaying it. Never themed. | 127 // overlaying it. Never themed. |
| 127 @property(retain, nonatomic) NSImage* overlayImage; | 128 @property(retain, nonatomic) NSImage* overlayImage; |
| 128 | 129 |
| 129 @end | 130 @end |
| 130 | 131 |
| 131 @interface GradientButtonCell(TestingAPI) | 132 @interface GradientButtonCell(TestingAPI) |
| 132 - (BOOL)isMouseInside; | 133 - (BOOL)isMouseInside; |
| 133 - (BOOL)pulsing; | 134 - (BOOL)pulsing; |
| 134 - (gradient_button_cell::PulseState)pulseState; | 135 - (gradient_button_cell::PulseState)pulseState; |
| 135 - (void)setPulseState:(gradient_button_cell::PulseState)pstate; | 136 - (void)setPulseState:(gradient_button_cell::PulseState)pstate; |
| 136 @end | 137 @end |
| 137 | 138 |
| 138 #endif // CHROME_BROWSER_UI_COCOA_GRADIENT_BUTTON_CELL_H_ | 139 #endif // CHROME_BROWSER_UI_COCOA_GRADIENT_BUTTON_CELL_H_ |
| OLD | NEW |