| 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 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button_cell.h" |
| 6 | 6 |
| 7 #include "app/mac/nsimage_cache.h" | |
| 8 #include "base/logging.h" | 7 #include "base/logging.h" |
| 9 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 10 #import "chrome/browser/bookmarks/bookmark_model.h" | 9 #import "chrome/browser/bookmarks/bookmark_model.h" |
| 10 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" |
| 11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu.h" | 11 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu.h" |
| 12 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" | |
| 13 #import "chrome/browser/ui/cocoa/image_utils.h" | 12 #import "chrome/browser/ui/cocoa/image_utils.h" |
| 14 #include "content/browser/user_metrics.h" | 13 #include "content/browser/user_metrics.h" |
| 15 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
| 16 #include "ui/base/l10n/l10n_util_mac.h" | 15 #include "ui/base/l10n/l10n_util_mac.h" |
| 16 #include "ui/gfx/mac/nsimage_cache.h" |
| 17 | 17 |
| 18 | 18 |
| 19 @interface BookmarkButtonCell(Private) | 19 @interface BookmarkButtonCell(Private) |
| 20 - (void)configureBookmarkButtonCell; | 20 - (void)configureBookmarkButtonCell; |
| 21 @end | 21 @end |
| 22 | 22 |
| 23 | 23 |
| 24 @implementation BookmarkButtonCell | 24 @implementation BookmarkButtonCell |
| 25 | 25 |
| 26 @synthesize startingChildIndex = startingChildIndex_; | 26 @synthesize startingChildIndex = startingChildIndex_; |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 // See comment above mouseEntered:, above. | 201 // See comment above mouseEntered:, above. |
| 202 - (void)mouseExited:(NSEvent*)event { | 202 - (void)mouseExited:(NSEvent*)event { |
| 203 [[self controlView] mouseExited:event]; | 203 [[self controlView] mouseExited:event]; |
| 204 [super mouseExited:event]; | 204 [super mouseExited:event]; |
| 205 } | 205 } |
| 206 | 206 |
| 207 - (void)setDrawFolderArrow:(BOOL)draw { | 207 - (void)setDrawFolderArrow:(BOOL)draw { |
| 208 drawFolderArrow_ = draw; | 208 drawFolderArrow_ = draw; |
| 209 if (draw && !arrowImage_) { | 209 if (draw && !arrowImage_) { |
| 210 arrowImage_.reset( | 210 arrowImage_.reset( |
| 211 [app::mac::GetCachedImageWithName(@"menu_hierarchy_arrow.pdf") retain]); | 211 [gfx::GetCachedImageWithName(@"menu_hierarchy_arrow.pdf") retain]); |
| 212 } | 212 } |
| 213 } | 213 } |
| 214 | 214 |
| 215 // Add extra size for the arrow so it doesn't overlap the text. | 215 // Add extra size for the arrow so it doesn't overlap the text. |
| 216 // Does not sanity check to be sure this is actually a folder node. | 216 // Does not sanity check to be sure this is actually a folder node. |
| 217 - (NSSize)cellSize { | 217 - (NSSize)cellSize { |
| 218 NSSize cellSize = [super cellSize]; | 218 NSSize cellSize = [super cellSize]; |
| 219 if (drawFolderArrow_) { | 219 if (drawFolderArrow_) { |
| 220 cellSize.width += [arrowImage_ size].width; // plus margin? | 220 cellSize.width += [arrowImage_ size].width; // plus margin? |
| 221 } | 221 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 242 NSRect drawRect = NSOffsetRect(imageRect, dX, dY); | 242 NSRect drawRect = NSOffsetRect(imageRect, dX, dY); |
| 243 [arrowImage_ drawInRect:drawRect | 243 [arrowImage_ drawInRect:drawRect |
| 244 fromRect:imageRect | 244 fromRect:imageRect |
| 245 operation:NSCompositeSourceOver | 245 operation:NSCompositeSourceOver |
| 246 fraction:[self isEnabled] ? 1.0 : 0.5 | 246 fraction:[self isEnabled] ? 1.0 : 0.5 |
| 247 neverFlipped:YES]; | 247 neverFlipped:YES]; |
| 248 } | 248 } |
| 249 } | 249 } |
| 250 | 250 |
| 251 @end | 251 @end |
| OLD | NEW |