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.
5 #ifndef CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_DRAG_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_DRAG_CONTROLLER_H_
8 #import <Cocoa/Cocoa.h>
12 @
class TabStripController
;
13 @
class TabWindowController
;
15 ////////////////////////////////////////////////////////////////////////////////
17 // This protocol is used to carry mouse events to the TabStripDragController,
18 // which manages the logic for actually dragging tabs.
19 @protocol TabDraggingEventTarget
21 // Returns YES if the tab represented by the controller can be dragged.
22 - (BOOL
)tabCanBeDragged
:(TabController
*)tab
;
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
;
30 ////////////////////////////////////////////////////////////////////////////////
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
> {
36 TabStripController
* tabStrip_
; // Weak; owns this.
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_
;
44 NSTimeInterval tearTime_
; // Time since tear happened
45 NSPoint tearOrigin_
; // Origin of the tear rect
46 NSPoint dragOrigin_
; // Origin point of the drag
48 TabWindowController
* sourceController_
; // weak. controller starting the drag
49 NSWindow
* sourceWindow_
; // Weak. The window starting the drag.
50 NSRect sourceWindowFrame_
;
51 NSRect sourceTabFrame_
;
53 TabController
* draggedTab_
; // Weak. The tab controller being dragged.
55 TabWindowController
* draggedController_
; // Weak. Controller being dragged.
56 NSWindow
* dragWindow_
; // Weak. The window being dragged
57 NSWindow
* dragOverlay_
; // Weak. The overlay being dragged
59 TabWindowController
* targetController_
; // weak. Controller being targeted
62 // Designated initializer.
63 - (id
)initWithTabStripController
:(TabStripController
*)controller
;
65 // TabDraggingEventTarget methods are also implemented.
69 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_STRIP_DRAG_CONTROLLER_H_