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 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
11 | 11 |
| 12 namespace ui { |
| 13 class ThemeProvider; |
| 14 } |
| 15 |
12 namespace image_button_cell { | 16 namespace image_button_cell { |
13 | 17 |
14 // Possible states | 18 // Possible states |
15 enum ButtonState { | 19 enum ButtonState { |
16 kDefaultState = 0, | 20 kDefaultState = 0, |
17 kHoverState, | 21 kHoverState, |
18 kPressedState, | 22 kPressedState, |
19 kDisabledState, | 23 kDisabledState, |
20 // The same as above, but for non-main, non-key windows. | 24 // The same as above, but for non-main, non-key windows. |
21 kDefaultStateBackground, | 25 kDefaultStateBackground, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 - (void)setImageID:(NSInteger)imageID | 61 - (void)setImageID:(NSInteger)imageID |
58 forButtonState:(image_button_cell::ButtonState)state; | 62 forButtonState:(image_button_cell::ButtonState)state; |
59 | 63 |
60 // Sets the image for the given button state using an image. | 64 // Sets the image for the given button state using an image. |
61 - (void)setImage:(NSImage*)image | 65 - (void)setImage:(NSImage*)image |
62 forButtonState:(image_button_cell::ButtonState)state; | 66 forButtonState:(image_button_cell::ButtonState)state; |
63 | 67 |
64 // Gets the alpha to use to draw the button for the current window focus state. | 68 // Gets the alpha to use to draw the button for the current window focus state. |
65 - (CGFloat)imageAlphaForWindowState:(NSWindow*)window; | 69 - (CGFloat)imageAlphaForWindowState:(NSWindow*)window; |
66 | 70 |
| 71 // Returns the theme provider for the given |window|; this allows subclasses to |
| 72 // pass in a different theme provider to use if appropriate. |
| 73 - (ui::ThemeProvider*)themeProviderForWindow:(NSWindow*)window; |
| 74 |
67 // Draws the cell's image within |cellFrame|. | 75 // Draws the cell's image within |cellFrame|. |
68 - (void)drawImageWithFrame:(NSRect)cellFrame inView:(NSView*)controlView; | 76 - (void)drawImageWithFrame:(NSRect)cellFrame inView:(NSView*)controlView; |
69 | 77 |
70 // If |controlView| is a first responder then draws a blue focus ring. | 78 // If |controlView| is a first responder then draws a blue focus ring. |
71 - (void)drawFocusRingWithFrame:(NSRect)cellFrame inView:(NSView*)controlView; | 79 - (void)drawFocusRingWithFrame:(NSRect)cellFrame inView:(NSView*)controlView; |
72 | 80 |
73 @end | 81 @end |
74 | 82 |
75 #endif // CHROME_BROWSER_UI_COCOA_IMAGE_BUTTON_CELL_H_ | 83 #endif // CHROME_BROWSER_UI_COCOA_IMAGE_BUTTON_CELL_H_ |
OLD | NEW |