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

Side by Side Diff: ui/app_list/cocoa/apps_grid_controller.h

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: tests! 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_APP_LIST_COCOA_APPS_GRID_CONTROLLER_H_ 5 #ifndef UI_APP_LIST_COCOA_APPS_GRID_CONTROLLER_H_
6 #define UI_APP_LIST_COCOA_APPS_GRID_CONTROLLER_H_ 6 #define UI_APP_LIST_COCOA_APPS_GRID_CONTROLLER_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "base/memory/scoped_nsobject.h" 10 #include "base/memory/scoped_nsobject.h"
(...skipping 17 matching lines...) Expand all
28 @interface AppsGridController : NSViewController<GestureScrollDelegate, 28 @interface AppsGridController : NSViewController<GestureScrollDelegate,
29 AppListPagerDelegate> { 29 AppListPagerDelegate> {
30 @private 30 @private
31 scoped_ptr<app_list::AppListModel> model_; 31 scoped_ptr<app_list::AppListModel> model_;
32 app_list::AppListViewDelegate* delegate_; // Weak. Owned by view controller. 32 app_list::AppListViewDelegate* delegate_; // Weak. Owned by view controller.
33 scoped_ptr<app_list::AppsGridDelegateBridge> bridge_; 33 scoped_ptr<app_list::AppsGridDelegateBridge> bridge_;
34 34
35 scoped_nsobject<AppsCollectionViewDragManager> dragManager_; 35 scoped_nsobject<AppsCollectionViewDragManager> dragManager_;
36 scoped_nsobject<NSMutableArray> pages_; 36 scoped_nsobject<NSMutableArray> pages_;
37 scoped_nsobject<NSMutableArray> items_; 37 scoped_nsobject<NSMutableArray> items_;
38 scoped_nsobject<NSTimer> scrollWhileDraggingTimer_;
38 39
39 id<AppsPaginationModelObserver> paginationObserver_; 40 id<AppsPaginationModelObserver> paginationObserver_;
40 41
41 // Index of the currently visible page. 42 // Index of the currently visible page.
42 size_t visiblePage_; 43 size_t visiblePage_;
44 // The page to which the view is currently animating a scroll.
45 size_t targetScrollPage_;
46 // The page to start scrolling to when the timer expires.
47 size_t scheduledScrollPage_;
43 48
44 // Whether we are currently animating a scroll to the nearest page. 49 // Whether we are currently animating a scroll to the nearest page.
45 BOOL animatingScroll_; 50 BOOL animatingScroll_;
46 } 51 }
47 52
48 @property(assign, nonatomic) id<AppsPaginationModelObserver> paginationObserver; 53 @property(assign, nonatomic) id<AppsPaginationModelObserver> paginationObserver;
49 54
50 + (void)setScrollAnimationDuration:(NSTimeInterval)duration; 55 + (void)setScrollAnimationDuration:(NSTimeInterval)duration;
51 56
52 - (NSCollectionView*)collectionViewAtPageIndex:(size_t)pageIndex; 57 - (NSCollectionView*)collectionViewAtPageIndex:(size_t)pageIndex;
(...skipping 15 matching lines...) Expand all
68 73
69 // Return the number of pages of icons in the grid. 74 // Return the number of pages of icons in the grid.
70 - (size_t)pageCount; 75 - (size_t)pageCount;
71 76
72 // Return the number of items over all pages in the grid. 77 // Return the number of items over all pages in the grid.
73 - (size_t)itemCount; 78 - (size_t)itemCount;
74 79
75 // Scroll to a page in the grid view with an animation. 80 // Scroll to a page in the grid view with an animation.
76 - (void)scrollToPage:(size_t)pageIndex; 81 - (void)scrollToPage:(size_t)pageIndex;
77 82
83 // Start a timer to scroll to a new page, if |locationInWindow| is to the left
84 // or the right of the view, or if it is over a pager segment. Cancels any
85 // existing timer if the target page changes.
86 - (void)maybeChangePageForPoint:(NSPoint)locationInWindow;
87
88 // Cancel a timer that may have been set by maybeChangePageForPoint().
89 - (void)cancelScrollTimer;
90
78 // Moves an item within the view only, for dragging or in response to model 91 // Moves an item within the view only, for dragging or in response to model
79 // changes. 92 // changes.
80 - (void)moveItemInView:(size_t)fromIndex 93 - (void)moveItemInView:(size_t)fromIndex
81 toItemIndex:(size_t)toIndex; 94 toItemIndex:(size_t)toIndex;
82 95
83 // Moves an item in the item model. Does not adjust the view. 96 // Moves an item in the item model. Does not adjust the view.
84 - (void)moveItemWithIndex:(size_t)itemIndex 97 - (void)moveItemWithIndex:(size_t)itemIndex
85 toModelIndex:(size_t)modelIndex; 98 toModelIndex:(size_t)modelIndex;
86 99
87 // Return the index of the selected item. 100 // Return the index of the selected item.
88 - (NSUInteger)selectedItemIndex; 101 - (NSUInteger)selectedItemIndex;
89 102
90 // Moves the selection to the given index. 103 // Moves the selection to the given index.
91 - (void)selectItemAtIndex:(NSUInteger)index; 104 - (void)selectItemAtIndex:(NSUInteger)index;
92 105
93 // Handle key actions. Similar to doCommandBySelector from NSResponder but that 106 // Handle key actions. Similar to doCommandBySelector from NSResponder but that
94 // requires this class to be in the responder chain. Instead this method is 107 // requires this class to be in the responder chain. Instead this method is
95 // invoked by the AppListViewController. 108 // invoked by the AppListViewController.
96 // Returns YES if this handled navigation or launched an app. 109 // Returns YES if this handled navigation or launched an app.
97 - (BOOL)handleCommandBySelector:(SEL)command; 110 - (BOOL)handleCommandBySelector:(SEL)command;
98 111
99 @end 112 @end
100 113
101 @interface AppsGridController(TestingAPI) 114 @interface AppsGridController(TestingAPI)
102 115
103 - (AppsCollectionViewDragManager*)dragManager; 116 - (AppsCollectionViewDragManager*)dragManager;
117 - (size_t)scheduledScrollPage;
104 118
105 @end 119 @end
106 120
107 #endif // UI_APP_LIST_COCOA_APPS_GRID_CONTROLLER_H_ 121 #endif // UI_APP_LIST_COCOA_APPS_GRID_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698