Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / app_list / cocoa / app_list_pager_view.h
blob0dcc44d9712703bba0c4654f4e80925ce080e46a
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.
5 #ifndef UI_APP_LIST_COCOA_APP_LIST_PAGER_VIEW_H_
6 #define UI_APP_LIST_COCOA_APP_LIST_PAGER_VIEW_H_
8 #import <Cocoa/Cocoa.h>
10 #import "ui/base/cocoa/tracking_area.h"
12 @class AppListPagerView;
14 // Delegate to obtain the visible portion of a page and respond to clicks.
15 @protocol AppListPagerDelegate<NSObject>
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;
21 // Invoked when the pager is clicked.
22 - (void)onPagerClicked:(AppListPagerView*)sender;
24 @end
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_;
33 // The segment currently highlighted with a mouse hover, or -1 for none.
34 NSInteger hoveredSegment_;
37 // Returns -1 if |locationInWindow| is not over a segment. Otherwise returns the
38 // segment index and highlights it.
39 - (NSInteger)findAndHighlightSegmentAtLocation:(NSPoint)locationInWindow;
41 @end
43 #endif // UI_APP_LIST_COCOA_APP_LIST_PAGER_VIEW_H_