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_BOOKMARKS_BOOKMARK_BUTTON_CELL_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BUTTON_CELL_H_ |
6 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BUTTON_CELL_H_ | 6 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BUTTON_CELL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #import "base/mac/cocoa_protocols.h" | 9 #import "base/mac/cocoa_protocols.h" |
10 #import "chrome/browser/ui/cocoa/gradient_button_cell.h" | 10 #import "chrome/browser/ui/cocoa/gradient_button_cell.h" |
11 | 11 |
12 class BookmarkNode; | 12 class BookmarkNode; |
13 | 13 |
14 // A button cell that handles drawing/highlighting of buttons in the | 14 // A button cell that handles drawing/highlighting of buttons in the |
15 // bookmark bar. This cell forwards mouseEntered/mouseExited events | 15 // bookmark bar. This cell forwards mouseEntered/mouseExited events |
16 // to its control view so that pseudo-menu operations | 16 // to its control view so that pseudo-menu operations |
17 // (e.g. hover-over to open) can be implemented. | 17 // (e.g. hover-over to open) can be implemented. |
18 @interface BookmarkButtonCell : GradientButtonCell<NSMenuDelegate> { | 18 @interface BookmarkButtonCell : GradientButtonCell<NSMenuDelegate> { |
19 @private | 19 @private |
20 BOOL empty_; // is this an "empty" button placeholder button cell? | 20 BOOL empty_; // is this an "empty" button placeholder button cell? |
21 | 21 |
| 22 // Starting index of bookmarkFolder children that we care to use. |
| 23 int startingChildIndex_; |
| 24 |
| 25 // Should we draw the folder arrow as needed? Not used for the bar |
| 26 // itself but used on the folder windows. |
| 27 BOOL drawFolderArrow_; |
| 28 |
| 29 // Arrow for folders |
| 30 scoped_nsobject<NSImage> arrowImage_; |
| 31 |
22 // Text color for title. | 32 // Text color for title. |
23 scoped_nsobject<NSColor> textColor_; | 33 scoped_nsobject<NSColor> textColor_; |
24 } | 34 } |
25 | 35 |
26 @property(nonatomic, readwrite, assign) const BookmarkNode* bookmarkNode; | 36 @property(nonatomic, readwrite, assign) const BookmarkNode* bookmarkNode; |
| 37 @property(nonatomic, readwrite, assign) int startingChildIndex; |
| 38 @property(nonatomic, readwrite, assign) BOOL drawFolderArrow; |
27 | 39 |
28 // Create a button cell which draws with a theme. | 40 // Create a button cell which draws with a theme. |
29 + (id)buttonCellForNode:(const BookmarkNode*)node | 41 + (id)buttonCellForNode:(const BookmarkNode*)node |
30 contextMenu:(NSMenu*)contextMenu | 42 contextMenu:(NSMenu*)contextMenu |
31 cellText:(NSString*)cellText | 43 cellText:(NSString*)cellText |
32 cellImage:(NSImage*)cellImage; | 44 cellImage:(NSImage*)cellImage; |
33 | 45 |
34 // Initialize a button cell which draws with a theme. | 46 // Initialize a button cell which draws with a theme. |
35 // Designated initializer. | 47 // Designated initializer. |
36 - (id)initForNode:(const BookmarkNode*)node | 48 - (id)initForNode:(const BookmarkNode*)node |
37 contextMenu:(NSMenu*)contextMenu | 49 contextMenu:(NSMenu*)contextMenu |
38 cellText:(NSString*)cellText | 50 cellText:(NSString*)cellText |
39 cellImage:(NSImage*)cellImage; | 51 cellImage:(NSImage*)cellImage; |
40 | 52 |
41 - (BOOL)empty; // returns YES if empty. | 53 - (BOOL)empty; // returns YES if empty. |
42 - (void)setEmpty:(BOOL)empty; | 54 - (void)setEmpty:(BOOL)empty; |
43 | 55 |
44 // |-setBookmarkCellText:image:| is used to set the text and image of | 56 // |-setBookmarkCellText:image:| is used to set the text and image of |
45 // a BookmarkButtonCell, and align the image to the left (NSImageLeft) | 57 // a BookmarkButtonCell, and align the image to the left (NSImageLeft) |
46 // if there is text in the title, and centered (NSImageCenter) if | 58 // if there is text in the title, and centered (NSImageCenter) if |
47 // there is not. If |title| is nil, do not reset the title. | 59 // there is not. If |title| is nil, do not reset the title. |
48 - (void)setBookmarkCellText:(NSString*)title | 60 - (void)setBookmarkCellText:(NSString*)title |
49 image:(NSImage*)image; | 61 image:(NSImage*)image; |
50 | 62 |
51 // Set the color of text in this cell. | 63 // Set the color of text in this cell. |
52 - (void)setTextColor:(NSColor*)color; | 64 - (void)setTextColor:(NSColor*)color; |
53 | 65 |
| 66 - (BOOL)isFolderButtonCell; |
| 67 |
54 @end | 68 @end |
55 | 69 |
56 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BUTTON_CELL_H_ | 70 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BUTTON_CELL_H_ |
OLD | NEW |