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 // Initiates a dragging session with a mouseDown event. The tab controller
22 // passed here is the one used for the rest of the dragging session.
23 - (void)maybeStartDrag
:(NSEvent
*)event forTab
:(TabController
*)tab
;
27 ////////////////////////////////////////////////////////////////////////////////
29 // This controller is owned by the TabStripController and is used to delegate
30 // all the logic for tab dragging from the TabView's events.
31 @interface TabStripDragController
: NSObject
<TabDraggingEventTarget
> {
33 TabStripController
* tabStrip_
; // Weak; owns this.
35 // These are released on mouseUp:
36 BOOL moveWindowOnDrag_
; // Set if the only tab of a window is dragged.
37 BOOL tabWasDragged_
; // Has the tab been dragged?
38 BOOL draggingWithinTabStrip_
; // Did drag stay in the current tab strip?
39 BOOL chromeIsVisible_
;
41 NSTimeInterval tearTime_
; // Time since tear happened
42 NSPoint tearOrigin_
; // Origin of the tear rect
43 NSPoint dragOrigin_
; // Origin point of the drag
45 TabWindowController
* sourceController_
; // weak. controller starting the drag
46 NSWindow
* sourceWindow_
; // Weak. The window starting the drag.
47 NSRect sourceWindowFrame_
;
48 NSRect sourceTabFrame_
;
50 TabController
* draggedTab_
; // Weak. The tab controller being dragged.
52 TabWindowController
* draggedController_
; // Weak. Controller being dragged.
53 NSWindow
* dragWindow_
; // Weak. The window being dragged
54 NSWindow
* dragOverlay_
; // Weak. The overlay being dragged
56 TabWindowController
* targetController_
; // weak. Controller being targeted
59 // The tab being dragged, or nil if not dragging a tab.
60 @
property(readonly
) TabController
* draggedTab
;
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_