Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2148)

Unified Diff: chrome/browser/cocoa/bookmark_bar_folder_window.mm

Issue 1813003: Vertical scrolling arrows in bookmark bar folder windows when needed.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/cocoa/bookmark_bar_folder_window.h ('k') | chrome/chrome_dll.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/bookmark_bar_folder_window.mm
===================================================================
--- chrome/browser/cocoa/bookmark_bar_folder_window.mm (revision 46002)
+++ chrome/browser/cocoa/bookmark_bar_folder_window.mm (working copy)
@@ -5,6 +5,7 @@
#import "chrome/browser/cocoa/bookmark_bar_folder_window.h"
#import "base/logging.h"
+#include "base/nsimage_cache_mac.h"
#import "base/scoped_nsobject.h"
#import "chrome/browser/cocoa/bookmark_bar_folder_controller.h"
#import "third_party/GTM/AppKit/GTMNSColor+Luminance.h"
@@ -38,6 +39,46 @@
@implementation BookmarkBarFolderWindowContentView
+- (void)awakeFromNib {
+ arrowUpImage_.reset([nsimage_cache::ImageNamed(@"menu_overflow_up.pdf")
+ retain]);
+ arrowDownImage_.reset([nsimage_cache::ImageNamed(@"menu_overflow_down.pdf")
+ retain]);
+}
+
+// Draw the arrows at the top and bottom of the folder window as a
+// visual indication that scrolling is possible. We always draw the
+// scrolling arrows; when not relevant (e.g. when not scrollable), the
+// scroll view overlaps me and the arrows aren't visible.
+- (void)drawScrollArrows:(NSRect)rect {
+ NSRect visibleRect = [self bounds];
+
+ // On top
+ [arrowUpImage_ setFlipped:[self isFlipped]];
+ NSRect imageRect = NSZeroRect;
+ imageRect.size = [arrowUpImage_ size];
+ NSRect drawRect = NSOffsetRect(
+ imageRect,
+ (NSWidth(visibleRect) - NSWidth(imageRect)) / 2,
+ NSHeight(visibleRect) - NSHeight(imageRect));
+ [arrowUpImage_ drawInRect:drawRect
+ fromRect:imageRect
+ operation:NSCompositeSourceOver
+ fraction:1.0];
+
+ // On bottom
+ [arrowDownImage_ setFlipped:[self isFlipped]];
+ imageRect = NSZeroRect;
+ imageRect.size = [arrowDownImage_ size];
+ drawRect = NSOffsetRect(imageRect,
+ (NSWidth(visibleRect) - NSWidth(imageRect)) / 2,
+ 0);
+ [arrowDownImage_ drawInRect:drawRect
+ fromRect:imageRect
+ operation:NSCompositeSourceOver
+ fraction:1.0];
+}
+
- (void)drawRect:(NSRect)rect {
NSRect bounds = [self bounds];
// Like NSMenus, only the bottom corners are rounded.
@@ -71,6 +112,8 @@
glowColor, 0.75,
nil]);
[gradient drawInBezierPath:bezier angle:0.0];
+
+ [self drawScrollArrows:rect];
}
@end
@@ -89,5 +132,4 @@
[[[self window] windowController] scrollWheel:theEvent];
}
-
@end
« no previous file with comments | « chrome/browser/cocoa/bookmark_bar_folder_window.h ('k') | chrome/chrome_dll.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698