1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BUTTON_CELL_H_
6 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BUTTON_CELL_H_
8 #import "chrome/browser/ui/cocoa/gradient_button_cell.h"
10 @
class BookmarkContextMenuCocoaController
;
13 // A button cell that handles drawing/highlighting of buttons in the
14 // bookmark bar. This cell forwards mouseEntered/mouseExited events
15 // to its control view so that pseudo-menu operations
16 // (e.g. hover-over to open) can be implemented.
17 @interface BookmarkButtonCell
: GradientButtonCell
<NSMenuDelegate
> {
19 // Controller for showing the context menu. Weak, owned by
20 // BookmarkBarController.
21 BookmarkContextMenuCocoaController
* menuController_
;
23 BOOL empty_
; // is this an "empty" button placeholder button cell?
25 // Starting index of bookmarkFolder children that we care to use.
26 int startingChildIndex_
;
28 // Should we draw the folder arrow as needed? Not used for the bar
29 // itself but used on the folder windows.
30 BOOL drawFolderArrow_
;
33 base::scoped_nsobject
<NSImage
> arrowImage_
;
35 // Text color for title.
36 base::scoped_nsobject
<NSColor
> textColor_
;
39 @
property(nonatomic
, readwrite
, assign
) const BookmarkNode
* bookmarkNode
;
40 @
property(nonatomic
, readwrite
, assign
) int startingChildIndex
;
41 @
property(nonatomic
, readwrite
, assign
) BOOL drawFolderArrow
;
43 // Create a button cell which draws with a theme.
44 + (id
)buttonCellForNode
:(const BookmarkNode
*)node
47 menuController
:(BookmarkContextMenuCocoaController
*)menuController
;
49 // Create a button cell not attached to any node which draws with a theme.
50 + (id
)buttonCellWithText
:(NSString
*)text
52 menuController
:(BookmarkContextMenuCocoaController
*)menuController
;
54 // Initialize a button cell which draws with a theme.
55 // Designated initializer.
56 - (id
)initForNode
:(const BookmarkNode
*)node
59 menuController
:(BookmarkContextMenuCocoaController
*)menuController
;
61 // Initialize a button cell not attached to any node which draws with a theme.
62 - (id
)initWithText
:(NSString
*)text
64 menuController
:(BookmarkContextMenuCocoaController
*)menuController
;
66 // A button cell is considered empty if it is expected to be attached to a node
67 // and this node is NULL. If the button was created with
68 // buttonCellForContextMenu then no node is expected and empty is always NO.
70 - (void)setEmpty
:(BOOL
)empty
;
72 // |-setBookmarkCellText:image:| is used to set the text and image of
73 // a BookmarkButtonCell, and align the image to the left (NSImageLeft)
74 // if there is text in the title, and centered (NSImageCenter) if
75 // there is not. If |title| is nil, do not reset the title.
76 - (void)setBookmarkCellText
:(NSString
*)title
77 image
:(NSImage
*)image
;
79 // Set the color of text in this cell.
80 - (void)setTextColor
:(NSColor
*)color
;
82 - (BOOL
)isFolderButtonCell
;
86 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BUTTON_CELL_H_