Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(629)

Side by Side Diff: chrome/browser/ui/cocoa/gradient_button_cell.h

Issue 2407343002: cocoa browser: fix meaning of "continuous pulsing" (Closed)
Patch Set: setIsContinuousPulsing -> setPulseIsStuckOn Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 27 matching lines...) Expand all
38 namespace gradient_button_cell { 38 namespace gradient_button_cell {
39 39
40 // Pulsing state for this button. 40 // Pulsing state for this button.
41 typedef enum { 41 typedef enum {
42 // Stable states. 42 // Stable states.
43 kPulsedOn, 43 kPulsedOn,
44 kPulsedOff, 44 kPulsedOff,
45 // In motion which will end in a stable state. 45 // In motion which will end in a stable state.
46 kPulsingOn, 46 kPulsingOn,
47 kPulsingOff, 47 kPulsingOff,
48 // In continuous motion. 48 // Continuously illuminated, used to highlight buttons.
49 kPulsingContinuous, 49 kPulsingStuckOn,
50 } PulseState; 50 } PulseState;
51 51
52 }; 52 };
53 53
54 54
55 @interface GradientButtonCell : NSButtonCell { 55 @interface GradientButtonCell : NSButtonCell {
56 @private 56 @private
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 pulseMultiplier_; // for selecting pulse direction when continuous.
67 CGFloat outerStrokeAlphaMult_; // For pulsing. 66 CGFloat outerStrokeAlphaMult_; // For pulsing.
68 base::scoped_nsobject<NSImage> overlayImage_; 67 base::scoped_nsobject<NSImage> overlayImage_;
69 } 68 }
70 69
71 // Turn off theming. Temporary work-around. 70 // Turn off theming. Temporary work-around.
72 - (void)setShouldTheme:(BOOL)shouldTheme; 71 - (void)setShouldTheme:(BOOL)shouldTheme;
73 72
74 - (void)drawBorderAndFillForTheme:(const ui::ThemeProvider*)themeProvider 73 - (void)drawBorderAndFillForTheme:(const ui::ThemeProvider*)themeProvider
75 controlView:(NSView*)controlView 74 controlView:(NSView*)controlView
76 innerPath:(NSBezierPath*)innerPath 75 innerPath:(NSBezierPath*)innerPath
77 showClickedGradient:(BOOL)showClickedGradient 76 showClickedGradient:(BOOL)showClickedGradient
78 showHighlightGradient:(BOOL)showHighlightGradient 77 showHighlightGradient:(BOOL)showHighlightGradient
79 hoverAlpha:(CGFloat)hoverAlpha 78 hoverAlpha:(CGFloat)hoverAlpha
80 active:(BOOL)active 79 active:(BOOL)active
81 cellFrame:(NSRect)cellFrame 80 cellFrame:(NSRect)cellFrame
82 defaultGradient:(NSGradient*)defaultGradient; 81 defaultGradient:(NSGradient*)defaultGradient;
83 82
84 // 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
85 // the current hoverAlpha_ based on these events. 84 // the current hoverAlpha_ based on these events.
86 - (void)setMouseInside:(BOOL)flag animate:(BOOL)animate; 85 - (void)setMouseInside:(BOOL)flag animate:(BOOL)animate;
87 86
88 // 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
89 // 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
90 // the background of the button is drawn by someone else. 89 // the background of the button is drawn by someone else.
91 - (NSBezierPath*)clipPathForFrame:(NSRect)cellFrame 90 - (NSBezierPath*)clipPathForFrame:(NSRect)cellFrame
92 inView:(NSView*)controlView; 91 inView:(NSView*)controlView;
93 92
94 // Turn on or off continuous pulsing. When turning off continuous 93 // Turn on or off pulse sticking. When turning off sticking, leave our pulse
95 // pulsing, leave our pulse state in the correct ending position for 94 // state in the correct ending position for our isMouseInside_ property. Public
96 // our isMouseInside_ property. Public since it's called from the 95 // since it's called from the bookmark bubble.
97 // bookmark bubble. 96 - (void)setPulseIsStuckOn:(BOOL)continuous;
98 - (void)setIsContinuousPulsing:(BOOL)continuous;
99 97
100 // Returns continuous pulse state. 98 // Returns continuous pulse state.
101 - (BOOL)isContinuousPulsing; 99 - (BOOL)isPulseStuckOn;
102 100
103 // Safely stop continuous pulsing by turning off all timers. 101 // Safely stop continuous pulsing by turning off all timers.
104 // May leave the cell in an odd state. 102 // May leave the cell in an odd state.
105 // Needed by an owning control's dealloc routine. 103 // Needed by an owning control's dealloc routine.
106 - (void)safelyStopPulsing; 104 - (void)safelyStopPulsing;
107 105
108 // Actually fetches current mouse position and does a hit test. 106 // Actually fetches current mouse position and does a hit test.
109 - (BOOL)isMouseReallyInside; 107 - (BOOL)isMouseReallyInside;
110 108
111 // Returns the offset of the start of the text in the cell. 109 // Returns the offset of the start of the text in the cell.
(...skipping 19 matching lines...) Expand all
131 @end 129 @end
132 130
133 @interface GradientButtonCell(TestingAPI) 131 @interface GradientButtonCell(TestingAPI)
134 - (BOOL)isMouseInside; 132 - (BOOL)isMouseInside;
135 - (BOOL)pulsing; 133 - (BOOL)pulsing;
136 - (gradient_button_cell::PulseState)pulseState; 134 - (gradient_button_cell::PulseState)pulseState;
137 - (void)setPulseState:(gradient_button_cell::PulseState)pstate; 135 - (void)setPulseState:(gradient_button_cell::PulseState)pstate;
138 @end 136 @end
139 137
140 #endif // CHROME_BROWSER_UI_COCOA_GRADIENT_BUTTON_CELL_H_ 138 #endif // CHROME_BROWSER_UI_COCOA_GRADIENT_BUTTON_CELL_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/bookmarks/bookmark_button.mm ('k') | chrome/browser/ui/cocoa/gradient_button_cell.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698