- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / tabs / tab_strip_drag_controller.h
1 // Copyright (c) 2011 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 CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_DRAG_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_DRAG_CONTROLLER_H_
7
8 #import <Cocoa/Cocoa.h>
9 #include <map>
10
11 @class TabController;
12 @class TabStripController;
13 @class TabWindowController;
14
15 ////////////////////////////////////////////////////////////////////////////////
16
17 // This protocol is used to carry mouse events to the TabStripDragController,
18 // which manages the logic for actually dragging tabs.
19 @protocol TabDraggingEventTarget
20
21 // Returns YES if the tab represented by the controller can be dragged.
22 - (BOOL)tabCanBeDragged:(TabController*)tab;
23
24 // Initiates a dragging session with a mouseDown event. The tab controller
25 // passed here is the one used for the rest of the dragging session.
26 - (void)maybeStartDrag:(NSEvent*)event forTab:(TabController*)tab;
27
28 @end
29
30 ////////////////////////////////////////////////////////////////////////////////
31
32 // This controller is owned by the TabStripController and is used to delegate
33 // all the logic for tab dragging from the TabView's events.
34 @interface TabStripDragController : NSObject<TabDraggingEventTarget> {
35  @private
36   TabStripController* tabStrip_;  // Weak; owns this.
37
38   // These are released on mouseUp:
39   BOOL moveWindowOnDrag_;  // Set if the only tab of a window is dragged.
40   BOOL tabWasDragged_;  // Has the tab been dragged?
41   BOOL draggingWithinTabStrip_;  // Did drag stay in the current tab strip?
42   BOOL chromeIsVisible_;
43
44   NSTimeInterval tearTime_;  // Time since tear happened
45   NSPoint tearOrigin_;  // Origin of the tear rect
46   NSPoint dragOrigin_;  // Origin point of the drag
47
48   TabWindowController* sourceController_;  // weak. controller starting the drag
49   NSWindow* sourceWindow_;  // Weak. The window starting the drag.
50   NSRect sourceWindowFrame_;
51   NSRect sourceTabFrame_;
52
53   TabController* draggedTab_;  // Weak. The tab controller being dragged.
54
55   TabWindowController* draggedController_;  // Weak. Controller being dragged.
56   NSWindow* dragWindow_;  // Weak. The window being dragged
57   NSWindow* dragOverlay_;  // Weak. The overlay being dragged
58
59   TabWindowController* targetController_;  // weak. Controller being targeted
60 }
61
62 // Designated initializer.
63 - (id)initWithTabStripController:(TabStripController*)controller;
64
65 // TabDraggingEventTarget methods are also implemented.
66
67 @end
68
69 #endif  // CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_DRAG_CONTROLLER_H_