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
3 // found in the LICENSE file.
5 #import "ui/base/cocoa/hover_image_button.h"
7 @implementation HoverImageButton
9 - (void)drawRect:(NSRect)rect {
10 if (hoverState_ == kHoverStateMouseDown && pressedImage_) {
11 [super setImage:pressedImage_.get()];
12 } else if (hoverState_ == kHoverStateMouseOver && hoverImage_) {
13 [super setImage:hoverImage_.get()];
15 [super setImage:defaultImage_.get()];
18 [super drawRect:rect];
21 - (void)setDefaultImage:(NSImage*)image {
22 defaultImage_.reset([image retain]);
25 - (void)setHoverImage:(NSImage*)image {
26 hoverImage_.reset([image retain]);
29 - (void)setPressedImage:(NSImage*)image {
30 pressedImage_.reset([image retain]);