Chromium Code Reviews| 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/themed_window.h" | 9 #import "chrome/browser/ui/cocoa/themed_window.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| 11 #include "ui/gfx/image/image.h" | 11 #include "ui/gfx/image/image.h" |
| 12 | 12 |
| 13 namespace { | |
| 14 | |
| 15 // Adjust the overlay position relative to the top right of the button image. | 13 // Adjust the overlay position relative to the top right of the button image. |
| 16 const CGFloat kOverlayOffsetX = -3; | 14 const CGFloat kOverlayOffsetX = -3; |
| 17 const CGFloat kOverlayOffsetY = 5; | 15 const CGFloat kOverlayOffsetY = 5; |
| 18 | 16 |
| 19 // When the window doesn't have focus then we want to draw the button with a | 17 // When the window doesn't have focus then we want to draw the button with a |
| 20 // slightly lighter color. We do this by just reducing the alpha. | 18 // slightly lighter color. We do this by just reducing the alpha. |
| 21 const CGFloat kImageNoFocusAlpha = 0.65; | 19 const CGFloat kImageNoFocusAlpha = 0.65; |
| 22 | 20 |
| 23 } // namespace | |
|
Robert Sesek
2013/01/07 22:08:04
Why this?
Nico
2013/01/07 22:20:15
const has implicit internal linkage, so the namesp
Robert Sesek
2013/01/07 22:24:28
Ah differences from C are always so fun. I think t
| |
| 24 | |
| 25 @interface ImageButtonCell (Private) | 21 @interface ImageButtonCell (Private) |
| 26 - (void)sharedInit; | 22 - (void)sharedInit; |
| 27 - (image_button_cell::ButtonState)currentButtonState; | 23 - (image_button_cell::ButtonState)currentButtonState; |
| 28 - (NSImage*)imageForID:(NSInteger)imageID | 24 - (NSImage*)imageForID:(NSInteger)imageID |
| 29 controlView:(NSView*)controlView; | 25 controlView:(NSView*)controlView; |
| 30 @end | 26 @end |
| 31 | 27 |
| 32 @implementation ImageButtonCell | 28 @implementation ImageButtonCell |
| 33 | 29 |
| 34 @synthesize overlayImageID = overlayImageID_; | 30 @synthesize overlayImageID = overlayImageID_; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 | 196 |
| 201 - (void)mouseEntered:(NSEvent*)theEvent { | 197 - (void)mouseEntered:(NSEvent*)theEvent { |
| 202 [self setIsMouseInside:YES]; | 198 [self setIsMouseInside:YES]; |
| 203 } | 199 } |
| 204 | 200 |
| 205 - (void)mouseExited:(NSEvent*)theEvent { | 201 - (void)mouseExited:(NSEvent*)theEvent { |
| 206 [self setIsMouseInside:NO]; | 202 [self setIsMouseInside:NO]; |
| 207 } | 203 } |
| 208 | 204 |
| 209 @end | 205 @end |
| OLD | NEW |