summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/cocoa/image_button_cell.h
blob: c049294457448237eeb0e30831daa7d2a74bee01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_COCOA_IMAGE_BUTTON_CELL_H_
#define CHROME_BROWSER_UI_COCOA_IMAGE_BUTTON_CELL_H_
#pragma once

#import <Cocoa/Cocoa.h>

namespace image_button_cell {

// Possible states
enum ButtonState {
  kDefaultState = 0,
  kHoverState,
  kPressedState,
  kDisabledState,
  kButtonStateCount
};

} // namespace ImageButtonCell

// A button cell that can disable a different image for each possible button
// state. Images are specified by image IDs.
@interface ImageButtonCell : NSButtonCell {
 @private
  NSInteger imageID_[image_button_cell::kButtonStateCount];
  NSInteger overlayImageID_;
  BOOL isMouseInside_;
}

@property(assign, nonatomic) BOOL isMouseInside;
@property(assign, nonatomic) NSInteger overlayImageID;

// Sets the image for the given button state using an image ID.
// The image will be lazy loaded from a resource pak.
- (void)setImageID:(NSInteger)imageID
    forButtonState:(image_button_cell::ButtonState)state;

@end

#endif // CHROME_BROWSER_UI_COCOA_IMAGE_BUTTON_CELL_H_