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 #ifndef CHROME_BROWSER_UI_COCOA_IMAGE_BUTTON_CELL_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_IMAGE_BUTTON_CELL_H_ |
6 #define CHROME_BROWSER_UI_COCOA_IMAGE_BUTTON_CELL_H_ | 6 #define CHROME_BROWSER_UI_COCOA_IMAGE_BUTTON_CELL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
10 | 10 |
11 namespace image_button_cell { | 11 namespace image_button_cell { |
12 | 12 |
13 // Possible states | 13 // Possible states |
14 enum ButtonState { | 14 enum ButtonState { |
15 kDefaultState = 0, | 15 kDefaultState = 0, |
16 kHoverState, | 16 kHoverState, |
17 kPressedState, | 17 kPressedState, |
18 kDisabledState, | 18 kDisabledState, |
19 kButtonStateCount | 19 kButtonStateCount |
20 }; | 20 }; |
21 | 21 |
22 } // namespace ImageButtonCell | 22 } // namespace ImageButtonCell |
23 | 23 |
24 @protocol ImageButton | 24 @protocol ImageButton |
25 @optional | 25 @optional |
26 // Sent from an ImageButtonCell to it's view when the mouse enters or exits the | 26 // Sent from an ImageButtonCell to its view when the mouse enters or exits the |
27 // cell. | 27 // cell. |
28 - (void)mouseInsideStateDidChange:(BOOL)isInside; | 28 - (void)mouseInsideStateDidChange:(BOOL)isInside; |
29 @end | 29 @end |
30 | 30 |
31 // A button cell that can disable a different image for each possible button | 31 // A button cell that can disable a different image for each possible button |
32 // state. Images are specified by image IDs. | 32 // state. Images are specified by image IDs. |
33 @interface ImageButtonCell : NSButtonCell { | 33 @interface ImageButtonCell : NSButtonCell { |
34 @private | 34 @private |
35 NSInteger imageID_[image_button_cell::kButtonStateCount]; | 35 NSInteger imageID_[image_button_cell::kButtonStateCount]; |
36 NSInteger overlayImageID_; | 36 NSInteger overlayImageID_; |
37 BOOL isMouseInside_; | 37 BOOL isMouseInside_; |
38 } | 38 } |
39 | 39 |
40 @property(assign, nonatomic) BOOL isMouseInside; | 40 @property(assign, nonatomic) BOOL isMouseInside; |
41 @property(assign, nonatomic) NSInteger overlayImageID; | 41 @property(assign, nonatomic) NSInteger overlayImageID; |
42 | 42 |
43 // Sets the image for the given button state using an image ID. | 43 // Sets the image for the given button state using an image ID. |
44 // The image will be lazy loaded from a resource pak. | 44 // The image will be lazy loaded from a resource pak. |
45 - (void)setImageID:(NSInteger)imageID | 45 - (void)setImageID:(NSInteger)imageID |
46 forButtonState:(image_button_cell::ButtonState)state; | 46 forButtonState:(image_button_cell::ButtonState)state; |
47 | 47 |
48 @end | 48 @end |
49 | 49 |
50 #endif // CHROME_BROWSER_UI_COCOA_IMAGE_BUTTON_CELL_H_ | 50 #endif // CHROME_BROWSER_UI_COCOA_IMAGE_BUTTON_CELL_H_ |
OLD | NEW |