summaryrefslogtreecommitdiffstats
path: root/ui/app_list/cocoa/item_drag_controller.h
blob: 4e1c74750c86454382f0a657c4837f8f40b7bb01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_APP_LIST_COCOA_ITEM_DRAG_WINDOW_CONTROLLER_H_
#define UI_APP_LIST_COCOA_ITEM_DRAG_WINDOW_CONTROLLER_H_

#import <Cocoa/Cocoa.h>
#import <QuartzCore/QuartzCore.h>

#include "base/mac/scoped_nsobject.h"

@class AppsGridViewItem;

// Controller to manage the animations and transient views that are used when
// dragging an app list item around the app list grid. When initiated, the item
// image (only) is grown in an animation, and sticks to the mouse cursor. When
// released, the label is added to the image and it shrinks and moves to the
// item location in the grid.
@interface ItemDragController : NSViewController {
 @private
  base::scoped_nsobject<CALayer> dragLayer_;
  base::scoped_nsobject<NSButton> buttonToRestore_;
  NSPoint mouseOffset_;
  NSTimeInterval growStart_;
  BOOL shrinking_;
}

- (id)initWithGridCellSize:(NSSize)size;

- (void)initiate:(AppsGridViewItem*)item
    mouseDownLocation:(NSPoint)mouseDownLocation
      currentLocation:(NSPoint)currentLocation
            timestamp:(NSTimeInterval)eventTimestamp;

- (void)update:(NSPoint)currentLocation
     timestamp:(NSTimeInterval)eventTimestamp;

- (void)complete:(AppsGridViewItem*)item
    targetOrigin:(NSPoint)targetOrigin;

@end

#endif  // UI_APP_LIST_COCOA_ITEM_DRAG_WINDOW_CONTROLLER_H_