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/hover_image_button.h" | 5 #import "ui/base/cocoa/hover_image_button.h" |
6 | |
7 #include "base/memory/scoped_nsobject.h" | |
8 #include "grit/generated_resources.h" | |
9 #include "ui/base/l10n/l10n_util.h" | |
10 | 6 |
11 @implementation HoverImageButton | 7 @implementation HoverImageButton |
12 | 8 |
13 - (void)drawRect:(NSRect)rect { | 9 - (void)drawRect:(NSRect)rect { |
14 if (hoverState_ == kHoverStateMouseDown && pressedImage_) { | 10 if (hoverState_ == kHoverStateMouseDown && pressedImage_) { |
15 [super setImage:pressedImage_.get()]; | 11 [super setImage:pressedImage_.get()]; |
16 [super setAlphaValue:pressedOpacity_]; | 12 [super setAlphaValue:pressedOpacity_]; |
17 } else if (hoverState_ == kHoverStateMouseOver && hoverImage_) { | 13 } else if (hoverState_ == kHoverStateMouseOver && hoverImage_) { |
18 [super setImage:hoverImage_.get()]; | 14 [super setImage:hoverImage_.get()]; |
19 [super setAlphaValue:hoverOpacity_]; | 15 [super setAlphaValue:hoverOpacity_]; |
(...skipping 23 matching lines...) Expand all Loading... |
43 | 39 |
44 - (void)setPressedImage:(NSImage*)image { | 40 - (void)setPressedImage:(NSImage*)image { |
45 pressedImage_.reset([image retain]); | 41 pressedImage_.reset([image retain]); |
46 } | 42 } |
47 | 43 |
48 - (void)setPressedOpacity:(float)opacity { | 44 - (void)setPressedOpacity:(float)opacity { |
49 pressedOpacity_ = opacity; | 45 pressedOpacity_ = opacity; |
50 } | 46 } |
51 | 47 |
52 @end | 48 @end |
OLD | NEW |