| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_TAB_WINDOW_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_TAB_WINDOW_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_TAB_WINDOW_CONTROLLER_H_ | 6 #define CHROME_BROWSER_TAB_WINDOW_CONTROLLER_H_ |
| 7 | 7 |
| 8 // A class acting as the Objective-C window controller for a window that has | 8 // A class acting as the Objective-C window controller for a window that has |
| 9 // tabs which can be dragged around. Tabs can be re-arranged within the same | 9 // tabs which can be dragged around. Tabs can be re-arranged within the same |
| 10 // window or dragged into other TabWindowController windows. This class doesn't | 10 // window or dragged into other TabWindowController windows. This class doesn't |
| 11 // know anything about the actual tab implementation or model, as that is fairly | 11 // know anything about the actual tab implementation or model, as that is fairly |
| 12 // application-specific. It only provides an API to be overridden by subclasses | 12 // application-specific. It only provides an API to be overridden by subclasses |
| 13 // to fill in the details. | 13 // to fill in the details. |
| 14 // | 14 // |
| 15 // This assumes that there will be a view in the nib, connected to | 15 // This assumes that there will be a view in the nib, connected to |
| 16 // |tabContentArea_|, that indicates the content that it switched when switching | 16 // |tabContentArea_|, that indicates the content that it switched when switching |
| 17 // between tabs. It needs to be a regular NSView, not something like an NSBox | 17 // between tabs. It needs to be a regular NSView, not something like an NSBox |
| 18 // because the TabStripController makes certain assumptions about how it can | 18 // because the TabStripController makes certain assumptions about how it can |
| 19 // swap out subviews. | 19 // swap out subviews. |
| 20 | 20 |
| 21 #import <Cocoa/Cocoa.h> | 21 #import <Cocoa/Cocoa.h> |
| 22 | 22 |
| 23 #include "base/scoped_nsobject.h" |
| 24 |
| 23 @class TabStripView; | 25 @class TabStripView; |
| 24 @class TabView; | 26 @class TabView; |
| 25 | 27 |
| 26 @interface TabWindowController : NSWindowController { | 28 @interface TabWindowController : NSWindowController { |
| 27 @private | 29 @private |
| 28 IBOutlet NSView* tabContentArea_; | 30 IBOutlet NSView* tabContentArea_; |
| 29 IBOutlet TabStripView* tabStripView_; | 31 IBOutlet TabStripView* tabStripView_; |
| 30 NSWindow* overlayWindow_; // Used during dragging for window opacity tricks | 32 NSWindow* overlayWindow_; // Used during dragging for window opacity tricks |
| 31 NSView* cachedContentView_; // Used during dragging for identifying which | 33 NSView* cachedContentView_; // Used during dragging for identifying which |
| 32 // view is the proper content area in the overlay | 34 // view is the proper content area in the overlay |
| 33 // (weak) | 35 // (weak) |
| 36 scoped_nsobject<NSMutableSet> lockedTabs_; |
| 34 } | 37 } |
| 35 @property(readonly, nonatomic) TabStripView* tabStripView; | 38 @property(readonly, nonatomic) TabStripView* tabStripView; |
| 36 @property(readonly, nonatomic) NSView* tabContentArea; | 39 @property(readonly, nonatomic) NSView* tabContentArea; |
| 37 | 40 |
| 38 // Used during tab dragging to turn on/off the overlay window when a tab | 41 // Used during tab dragging to turn on/off the overlay window when a tab |
| 39 // is torn off. | 42 // is torn off. |
| 40 - (void)showOverlay; | 43 - (void)showOverlay; |
| 41 - (void)removeOverlay; | 44 - (void)removeOverlay; |
| 42 - (void)removeOverlayAfterDelay:(NSTimeInterval)delay; | 45 - (void)removeOverlayAfterDelay:(NSTimeInterval)delay; |
| 43 - (NSWindow*)overlayWindow; | 46 - (NSWindow*)overlayWindow; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 - (NSView *)selectedTabView; | 95 - (NSView *)selectedTabView; |
| 93 | 96 |
| 94 // The title of the selected tab. | 97 // The title of the selected tab. |
| 95 - (NSString*)selectedTabTitle; | 98 - (NSString*)selectedTabTitle; |
| 96 | 99 |
| 97 // Called to check if we are a normal window (e.g. not a pop-up) and | 100 // Called to check if we are a normal window (e.g. not a pop-up) and |
| 98 // want normal behavior (e.g. a tab strip). Return YES if so. The | 101 // want normal behavior (e.g. a tab strip). Return YES if so. The |
| 99 // default implementation returns YES. | 102 // default implementation returns YES. |
| 100 - (BOOL)isNormalWindow; | 103 - (BOOL)isNormalWindow; |
| 101 | 104 |
| 105 - (BOOL)isTabDraggable:(NSView*)tabView; |
| 106 - (void)setTab:(NSView*)tabView isDraggable:(BOOL)draggable; |
| 102 | 107 |
| 103 @end | 108 @end |
| 104 | 109 |
| 105 @interface TabWindowController(ProtectedMethods) | 110 @interface TabWindowController(ProtectedMethods) |
| 106 // A list of all the views that need to move to the overlay window. Subclasses | 111 // A list of all the views that need to move to the overlay window. Subclasses |
| 107 // can override this to add more things besides the tab strip. Be sure to | 112 // can override this to add more things besides the tab strip. Be sure to |
| 108 // call the superclass' version if overridden. | 113 // call the superclass' version if overridden. |
| 109 - (NSArray*)viewsToMoveToOverlay; | 114 - (NSArray*)viewsToMoveToOverlay; |
| 110 | 115 |
| 111 // Tells the tab strip to forget about this tab in preparation for it being | 116 // Tells the tab strip to forget about this tab in preparation for it being |
| 112 // put into a different tab strip, such as during a drop on another window. | 117 // put into a different tab strip, such as during a drop on another window. |
| 113 - (void)detachTabView:(NSView*)view; | 118 - (void)detachTabView:(NSView*)view; |
| 114 @end | 119 @end |
| 115 | 120 |
| 116 #endif // CHROME_BROWSER_TAB_WINDOW_CONTROLLER_H_ | 121 #endif // CHROME_BROWSER_TAB_WINDOW_CONTROLLER_H_ |
| OLD | NEW |