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