summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/bookmark_bar_folder_window.mm
diff options
context:
space:
mode:
authorjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-30 20:59:53 +0000
committerjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-30 20:59:53 +0000
commitfdc04cc5d7d91c38efcfb6c9f7881930e4baa1c0 (patch)
tree914d030330c7221ed57b81f8146283ef08abdddb /chrome/browser/cocoa/bookmark_bar_folder_window.mm
parent7cd363601dfdaad7d3c9a36f4a4085e5e039fa05 (diff)
downloadchromium_src-fdc04cc5d7d91c38efcfb6c9f7881930e4baa1c0.zip
chromium_src-fdc04cc5d7d91c38efcfb6c9f7881930e4baa1c0.tar.gz
chromium_src-fdc04cc5d7d91c38efcfb6c9f7881930e4baa1c0.tar.bz2
Vertical scrolling arrows in bookmark bar folder windows when needed.
pdfs from Cole. BUG=42026 TEST=\ 1) Small folders --> no arrows. 2) Big folders --> arrow at bottom initially. 3) Move browser to bottom of screen so a small folder falls off the bottom and has an arrow. Open it and gently use scroll wheel to scroll. Make sure transition to "no arrow" looks good. Close and reopen. Scroll super-fast. Make sure it ends up in the same nice place. 4) Open big big folder. Scroll so top goes offscreen so you now have 2 scroll arrows. Use scroll wheel to gently go up and down (arrow hides and shows). Make sure transitions OK. Scroll all the way so bottom arrow disappears. Gently up and down; watch for transitions. Now FAST up and down. Make sure destination looks OK. BookmarkBarFolderWindow.xib change: BookmarkBarFolderWindowScrollView border turned off. Review URL: http://codereview.chromium.org/1813003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46114 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/bookmark_bar_folder_window.mm')
-rw-r--r--chrome/browser/cocoa/bookmark_bar_folder_window.mm44
1 files changed, 43 insertions, 1 deletions
diff --git a/chrome/browser/cocoa/bookmark_bar_folder_window.mm b/chrome/browser/cocoa/bookmark_bar_folder_window.mm
index 732bed1..841fa7c 100644
--- a/chrome/browser/cocoa/bookmark_bar_folder_window.mm
+++ b/chrome/browser/cocoa/bookmark_bar_folder_window.mm
@@ -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 @@ const CGFloat kViewCornerRadius = 4.0;
@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 @@ const CGFloat kViewCornerRadius = 4.0;
glowColor, 0.75,
nil]);
[gradient drawInBezierPath:bezier angle:0.0];
+
+ [self drawScrollArrows:rect];
}
@end
@@ -89,5 +132,4 @@ const CGFloat kViewCornerRadius = 4.0;
[[[self window] windowController] scrollWheel:theEvent];
}
-
@end