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

Side by Side Diff: ui/base/cocoa/hover_image_button.mm

Issue 12937008: Move HoverButton and HoverImageButton from chrome/browser/ui/cocoa/ to ui/base/cocoa. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « ui/base/cocoa/hover_image_button.h ('k') | ui/base/cocoa/hover_image_button_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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
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
OLDNEW
« no previous file with comments | « ui/base/cocoa/hover_image_button.h ('k') | ui/base/cocoa/hover_image_button_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698