| 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 12 matching lines...) Expand all Loading... |
| 23 enum { | 23 enum { |
| 24 kLeftButtonType = -1, | 24 kLeftButtonType = -1, |
| 25 kLeftButtonWithShadowType = -2, | 25 kLeftButtonWithShadowType = -2, |
| 26 kStandardButtonType = 0, | 26 kStandardButtonType = 0, |
| 27 kRightButtonType = 1, | 27 kRightButtonType = 1, |
| 28 kMiddleButtonType = 2, | 28 kMiddleButtonType = 2, |
| 29 // Draws like a standard button, except when clicked where the interior | 29 // Draws like a standard button, except when clicked where the interior |
| 30 // doesn't darken using the theme's "pressed" gradient. Instead uses the | 30 // doesn't darken using the theme's "pressed" gradient. Instead uses the |
| 31 // normal un-pressed gradient. | 31 // normal un-pressed gradient. |
| 32 kStandardButtonTypeWithLimitedClickFeedback = 3, | 32 kStandardButtonTypeWithLimitedClickFeedback = 3, |
| 33 kMaterialStandardButtonTypeWithLimitedClickFeedback = 4, | |
| 34 }; | 33 }; |
| 35 typedef NSInteger ButtonType; | 34 typedef NSInteger ButtonType; |
| 36 | 35 |
| 37 namespace gradient_button_cell { | 36 namespace gradient_button_cell { |
| 38 | 37 |
| 39 // Pulsing state for this button. | 38 // Pulsing state for this button. |
| 40 typedef enum { | 39 typedef enum { |
| 41 // Stable states. | 40 // Stable states. |
| 42 kPulsedOn, | 41 kPulsedOn, |
| 43 kPulsedOff, | 42 kPulsedOff, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 - (BOOL)isContinuousPulsing; | 99 - (BOOL)isContinuousPulsing; |
| 101 | 100 |
| 102 // Safely stop continuous pulsing by turning off all timers. | 101 // Safely stop continuous pulsing by turning off all timers. |
| 103 // May leave the cell in an odd state. | 102 // May leave the cell in an odd state. |
| 104 // Needed by an owning control's dealloc routine. | 103 // Needed by an owning control's dealloc routine. |
| 105 - (void)safelyStopPulsing; | 104 - (void)safelyStopPulsing; |
| 106 | 105 |
| 107 // Actually fetches current mouse position and does a hit test. | 106 // Actually fetches current mouse position and does a hit test. |
| 108 - (BOOL)isMouseReallyInside; | 107 - (BOOL)isMouseReallyInside; |
| 109 | 108 |
| 110 // Returns the offset of the start of the text in the cell. | |
| 111 - (CGFloat)textStartXOffset; | |
| 112 | |
| 113 // Defines the top offset of text within the cell. Used by drawTitle and can | 109 // Defines the top offset of text within the cell. Used by drawTitle and can |
| 114 // be overriden by objects that inherit this class for placement of text. | 110 // be overriden by objects that inherit this class for placement of text. |
| 115 - (int)verticalTextOffset; | 111 - (int)verticalTextOffset; |
| 116 | 112 |
| 117 @property(assign, nonatomic) CGFloat hoverAlpha; | 113 @property(assign, nonatomic) CGFloat hoverAlpha; |
| 118 | 114 |
| 119 // An image that will be drawn after the normal content of the button cell, | 115 // An image that will be drawn after the normal content of the button cell, |
| 120 // overlaying it. Never themed. | 116 // overlaying it. Never themed. |
| 121 @property(retain, nonatomic) NSImage* overlayImage; | 117 @property(retain, nonatomic) NSImage* overlayImage; |
| 122 | 118 |
| 123 @end | 119 @end |
| 124 | 120 |
| 125 @interface GradientButtonCell(TestingAPI) | 121 @interface GradientButtonCell(TestingAPI) |
| 126 - (BOOL)isMouseInside; | 122 - (BOOL)isMouseInside; |
| 127 - (BOOL)pulsing; | 123 - (BOOL)pulsing; |
| 128 - (gradient_button_cell::PulseState)pulseState; | 124 - (gradient_button_cell::PulseState)pulseState; |
| 129 - (void)setPulseState:(gradient_button_cell::PulseState)pstate; | 125 - (void)setPulseState:(gradient_button_cell::PulseState)pstate; |
| 130 @end | 126 @end |
| 131 | 127 |
| 132 #endif // CHROME_BROWSER_UI_COCOA_GRADIENT_BUTTON_CELL_H_ | 128 #endif // CHROME_BROWSER_UI_COCOA_GRADIENT_BUTTON_CELL_H_ |
| OLD | NEW |