BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / bookmarks / bookmark_button_cell.h
blob9144e0b261b079fc5bd9da582f98bb18001dcf5e
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;
12 namespace bookmarks {
13 class BookmarkNode;
16 // A button cell that handles drawing/highlighting of buttons in the
17 // bookmark bar. This cell forwards mouseEntered/mouseExited events
18 // to its control view so that pseudo-menu operations
19 // (e.g. hover-over to open) can be implemented.
20 @interface BookmarkButtonCell : GradientButtonCell<NSMenuDelegate> {
21 @private
22 // Controller for showing the context menu. Weak, owned by
23 // BookmarkBarController.
24 BookmarkContextMenuCocoaController* menuController_;
26 BOOL empty_; // is this an "empty" button placeholder button cell?
28 // Starting index of bookmarkFolder children that we care to use.
29 int startingChildIndex_;
31 // Should we draw the folder arrow as needed? Not used for the bar
32 // itself but used on the folder windows.
33 BOOL drawFolderArrow_;
35 // Arrow for folders
36 base::scoped_nsobject<NSImage> arrowImage_;
38 // Text color for title.
39 base::scoped_nsobject<NSColor> textColor_;
42 @property(nonatomic, readwrite, assign)
43 const bookmarks::BookmarkNode* bookmarkNode;
44 @property(nonatomic, readwrite, assign) int startingChildIndex;
45 @property(nonatomic, readwrite, assign) BOOL drawFolderArrow;
47 // Create a button cell which draws with a theme.
48 + (id)buttonCellForNode:(const bookmarks::BookmarkNode*)node
49 text:(NSString*)text
50 image:(NSImage*)image
51 menuController:(BookmarkContextMenuCocoaController*)menuController;
53 // Create a button cell not attached to any node which draws with a theme.
54 + (id)buttonCellWithText:(NSString*)text
55 image:(NSImage*)image
56 menuController:(BookmarkContextMenuCocoaController*)menuController;
58 // Initialize a button cell which draws with a theme.
59 // Designated initializer.
60 - (id)initForNode:(const bookmarks::BookmarkNode*)node
61 text:(NSString*)text
62 image:(NSImage*)image
63 menuController:(BookmarkContextMenuCocoaController*)menuController;
65 // Initialize a button cell not attached to any node which draws with a theme.
66 - (id)initWithText:(NSString*)text
67 image:(NSImage*)image
68 menuController:(BookmarkContextMenuCocoaController*)menuController;
70 // A button cell is considered empty if it is expected to be attached to a node
71 // and this node is NULL. If the button was created with
72 // buttonCellForContextMenu then no node is expected and empty is always NO.
73 - (BOOL)empty;
74 - (void)setEmpty:(BOOL)empty;
76 // |-setBookmarkCellText:image:| is used to set the text and image of
77 // a BookmarkButtonCell, and align the image to the left (NSImageLeft)
78 // if there is text in the title, and centered (NSImageCenter) if
79 // there is not. If |title| is nil, do not reset the title.
80 - (void)setBookmarkCellText:(NSString*)title
81 image:(NSImage*)image;
83 // Set the color of text in this cell.
84 - (void)setTextColor:(NSColor*)color;
86 - (BOOL)isFolderButtonCell;
88 @end
90 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BUTTON_CELL_H_