| 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 #import "chrome/browser/ui/cocoa/image_button_cell.h" | 5 #import "chrome/browser/ui/cocoa/image_button_cell.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "chrome/browser/themes/theme_service.h" | 8 #import "chrome/browser/themes/theme_service.h" |
| 9 #import "chrome/browser/ui/cocoa/image_utils.h" | 9 #import "chrome/browser/ui/cocoa/image_utils.h" |
| 10 #import "chrome/browser/ui/cocoa/themed_window.h" | 10 #import "chrome/browser/ui/cocoa/themed_window.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 ui::ThemeProvider* themeProvider = [[controlView window] themeProvider]; | 131 ui::ThemeProvider* themeProvider = [[controlView window] themeProvider]; |
| 132 if (!themeProvider) | 132 if (!themeProvider) |
| 133 return nil; | 133 return nil; |
| 134 | 134 |
| 135 return themeProvider->GetNSImageNamed(imageID, true); | 135 return themeProvider->GetNSImageNamed(imageID, true); |
| 136 } | 136 } |
| 137 | 137 |
| 138 - (void)setIsMouseInside:(BOOL)isMouseInside { | 138 - (void)setIsMouseInside:(BOOL)isMouseInside { |
| 139 if (isMouseInside_ != isMouseInside) { | 139 if (isMouseInside_ != isMouseInside) { |
| 140 isMouseInside_ = isMouseInside; | 140 isMouseInside_ = isMouseInside; |
| 141 [[self controlView] setNeedsDisplay:YES]; | 141 NSView<ImageButton>* control = |
| 142 static_cast<NSView<ImageButton>*>([self controlView]); |
| 143 if ([control respondsToSelector:@selector(mouseInsideStateDidChange:)]) { |
| 144 [control mouseInsideStateDidChange:isMouseInside]; |
| 145 } |
| 146 [control setNeedsDisplay:YES]; |
| 142 } | 147 } |
| 143 } | 148 } |
| 144 | 149 |
| 150 - (void)setShowsBorderOnlyWhileMouseInside:(BOOL)show { |
| 151 VLOG_IF(1, !show) << "setShowsBorderOnlyWhileMouseInside:NO ignored"; |
| 152 } |
| 153 |
| 154 - (BOOL)showsBorderOnlyWhileMouseInside { |
| 155 // Always returns YES so that buttons always get mouse tracking even when |
| 156 // disabled. The reload button (and possibly others) depend on this. |
| 157 return YES; |
| 158 } |
| 159 |
| 145 - (void)mouseEntered:(NSEvent*)theEvent { | 160 - (void)mouseEntered:(NSEvent*)theEvent { |
| 146 [self setIsMouseInside:YES]; | 161 [self setIsMouseInside:YES]; |
| 147 } | 162 } |
| 148 | 163 |
| 149 - (void)mouseExited:(NSEvent*)theEvent { | 164 - (void)mouseExited:(NSEvent*)theEvent { |
| 150 [self setIsMouseInside:NO]; | 165 [self setIsMouseInside:NO]; |
| 151 } | 166 } |
| 152 | 167 |
| 153 @end | 168 @end |
| OLD | NEW |