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_ITEM_DRAG_CONTROLLER_H_
6#define UI_APP_LIST_COCOA_ITEM_DRAG_CONTROLLER_H_
7
8#import <Cocoa/Cocoa.h>
9#import <QuartzCore/QuartzCore.h>
10
11#include "base/mac/scoped_nsobject.h"
12
13@class AppsGridViewItem;
14
15// Controller to manage the animations and transient views that are used when
16// dragging an app list item around the app list grid. When initiated, the item
17// image (only) is grown in an animation, and sticks to the mouse cursor. When
18// released, the label is added to the image and it shrinks and moves to the
19// item location in the grid.
20@interface ItemDragController : NSViewController {
21 @private
22  base::scoped_nsobject<CALayer> dragLayer_;
23  base::scoped_nsobject<NSButton> buttonToRestore_;
24  NSPoint mouseOffset_;
25  NSTimeInterval growStart_;
26  BOOL shrinking_;
27}
28
29- (id)initWithGridCellSize:(NSSize)size;
30
31- (void)initiate:(AppsGridViewItem*)item
32    mouseDownLocation:(NSPoint)mouseDownLocation
33      currentLocation:(NSPoint)currentLocation
34            timestamp:(NSTimeInterval)eventTimestamp;
35
36- (void)update:(NSPoint)currentLocation
37     timestamp:(NSTimeInterval)eventTimestamp;
38
39- (void)complete:(AppsGridViewItem*)item
40    targetOrigin:(NSPoint)targetOrigin;
41
42@end
43
44#endif  // UI_APP_LIST_COCOA_ITEM_DRAG_CONTROLLER_H_
45