| OLD | NEW |
| (Empty) |
| 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_APPS_COLLECTION_VIEW_DRAG_MANAGER_H_ | |
| 6 #define UI_APP_LIST_COCOA_APPS_COLLECTION_VIEW_DRAG_MANAGER_H_ | |
| 7 | |
| 8 #import <Cocoa/Cocoa.h> | |
| 9 #include <stddef.h> | |
| 10 | |
| 11 #include "base/mac/scoped_nsobject.h" | |
| 12 #include "ui/app_list/app_list_export.h" | |
| 13 | |
| 14 @class AppsGridController; | |
| 15 @class ItemDragController; | |
| 16 | |
| 17 // Manager for the state associated with dragging an NSCollectionViewItem in the | |
| 18 // AppsGridController. It is also a factory for the NSCollectionView pages in | |
| 19 // the grid, allowing items to be dragged between pages. | |
| 20 APP_LIST_EXPORT | |
| 21 @interface AppsCollectionViewDragManager : NSObject { | |
| 22 @private | |
| 23 base::scoped_nsobject<ItemDragController> itemDragController_; | |
| 24 AppsGridController* gridController_; // Weak. Owns us. | |
| 25 | |
| 26 NSSize cellSize_; | |
| 27 size_t rows_; | |
| 28 size_t columns_; | |
| 29 | |
| 30 // Index of the last known position of the item currently being dragged. | |
| 31 size_t itemDragIndex_; | |
| 32 | |
| 33 // Model index of the item being dragged, or NSNotFound if nothing was hit on | |
| 34 // the last mouseDown. | |
| 35 size_t itemHitIndex_; | |
| 36 | |
| 37 // Location in the window of the last mouseDown event. | |
| 38 NSPoint mouseDownLocation_; | |
| 39 | |
| 40 // Whether the current mouse action has converted into an item drag. | |
| 41 BOOL dragging_; | |
| 42 } | |
| 43 | |
| 44 - (id)initWithCellSize:(NSSize)cellSize | |
| 45 rows:(size_t)rows | |
| 46 columns:(size_t)columns | |
| 47 gridController:(AppsGridController*)gridController; | |
| 48 | |
| 49 // Make an empty NSCollectionView with draggable items in the given |pageFrame|. | |
| 50 - (NSCollectionView*)makePageWithFrame:(NSRect)pageFrame; | |
| 51 | |
| 52 - (void)cancelDrag; | |
| 53 | |
| 54 @end | |
| 55 | |
| 56 @interface AppsCollectionViewDragManager (TestingAPI) | |
| 57 | |
| 58 - (void)onMouseDownInPage:(NSCollectionView*)page | |
| 59 withEvent:(NSEvent*)theEvent; | |
| 60 - (void)onMouseDragged:(NSEvent*)theEvent; | |
| 61 - (void)onMouseUp:(NSEvent*)theEvent; | |
| 62 | |
| 63 @end | |
| 64 | |
| 65 #endif // UI_APP_LIST_COCOA_APPS_COLLECTION_VIEW_DRAG_MANAGER_H_ | |
| OLD | NEW |