1// Copyright 2013 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 UI_APP_LIST_COCOA_APP_LIST_PAGER_VIEW_H_ 6#define UI_APP_LIST_COCOA_APP_LIST_PAGER_VIEW_H_ 7 8#import <Cocoa/Cocoa.h> 9 10#import "ui/base/cocoa/tracking_area.h" 11 12@class AppListPagerView; 13 14// Delegate to obtain the visible portion of a page and respond to clicks. 15@protocol AppListPagerDelegate<NSObject> 16 17// Returns the portion of a page that is visible, in the range (-1.0, 1.0]. 18// Positive indicates the left side is visible, negative indicates the right. 19- (CGFloat)visiblePortionOfPage:(int)page; 20 21// Invoked when the pager is clicked. 22- (void)onPagerClicked:(AppListPagerView*)sender; 23 24@end 25 26// AppListPagerView draws a button strip with buttons representing pages, and a 27// highlight that mirrors the visible portion of the page. 28@interface AppListPagerView : NSSegmentedControl { 29 @private 30 // Used to auto-select a segment on hover. 31 ui::ScopedCrTrackingArea trackingArea_; 32 33 // The segment currently highlighted with a mouse hover, or -1 for none. 34 NSInteger hoveredSegment_; 35} 36 37// Returns -1 if |locationInWindow| is not over a segment. Otherwise returns the 38// segment index and highlights it. 39- (NSInteger)findAndHighlightSegmentAtLocation:(NSPoint)locationInWindow; 40 41@end 42 43#endif // UI_APP_LIST_COCOA_APP_LIST_PAGER_VIEW_H_ 44