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

Unified Diff: ui/app_list/cocoa/app_list_pager_view.mm

Issue 14999013: Allow pages on the OSX app launcher to be turned while dragging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: respond to comments Created 7 years, 7 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 | « ui/app_list/cocoa/app_list_pager_view.h ('k') | ui/app_list/cocoa/app_list_view_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/cocoa/app_list_pager_view.mm
diff --git a/ui/app_list/cocoa/app_list_pager_view.mm b/ui/app_list/cocoa/app_list_pager_view.mm
index 28a971e78712b3fac902ae8631603235a3254c57..70cd9e40e2172d0473eb6613ed8f5ebdbd8f8846 100644
--- a/ui/app_list/cocoa/app_list_pager_view.mm
+++ b/ui/app_list/cocoa/app_list_pager_view.mm
@@ -21,7 +21,7 @@ const CGFloat kButtonStripPadding = 20;
@property(assign, nonatomic) NSInteger hoveredSegment;
-- (NSInteger)segmentUnderEvent:(NSEvent*)theEvent;
+- (NSInteger)segmentUnderLocation:(NSPoint)locationInWindow;
@end
@@ -52,6 +52,12 @@ const CGFloat kButtonStripPadding = 20;
return self;
}
+- (NSInteger)findAndHighlightSegmentAtLocation:(NSPoint)locationInWindow {
+ NSInteger segment = [self segmentUnderLocation:locationInWindow];
+ [self setHoveredSegment:segment];
+ return segment;
+}
+
- (void)setHoveredSegment:(NSInteger)segment {
if (segment == hoveredSegment_)
return;
@@ -61,11 +67,11 @@ const CGFloat kButtonStripPadding = 20;
return;
}
-- (NSInteger)segmentUnderEvent:(NSEvent*)theEvent {
+- (NSInteger)segmentUnderLocation:(NSPoint)locationInWindow {
if ([self segmentCount] == 0)
return -1;
- NSPoint pointInView = [self convertPoint:[theEvent locationInWindow]
+ NSPoint pointInView = [self convertPoint:locationInWindow
fromView:nil];
if (![self mouse:pointInView inRect:[self bounds]])
return -1;
@@ -83,7 +89,7 @@ const CGFloat kButtonStripPadding = 20;
}
- (void)mouseMoved:(NSEvent*)theEvent {
- [self setHoveredSegment:[self segmentUnderEvent:theEvent]];
+ [self findAndHighlightSegmentAtLocation:[theEvent locationInWindow]];
}
- (void)mouseDown:(NSEvent*)theEvent {
@@ -94,7 +100,7 @@ const CGFloat kButtonStripPadding = 20;
// The stock NSSegmentedControl ignores any clicks outside the non-default
// control height, so process all clicks here.
- (void)mouseUp:(NSEvent*)theEvent {
- [self setHoveredSegment:[self segmentUnderEvent:theEvent]];
+ [self findAndHighlightSegmentAtLocation:[theEvent locationInWindow]];
if (hoveredSegment_ < 0)
return;
« no previous file with comments | « ui/app_list/cocoa/app_list_pager_view.h ('k') | ui/app_list/cocoa/app_list_view_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698