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 // |
| 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 |
| 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 |
| 19 // swap out subviews. |
14 | 20 |
15 #import <Cocoa/Cocoa.h> | 21 #import <Cocoa/Cocoa.h> |
16 | 22 |
17 @class TabStripView; | 23 @class TabStripView; |
18 @class TabView; | 24 @class TabView; |
19 | 25 |
20 @interface TabWindowController : NSWindowController { | 26 @interface TabWindowController : NSWindowController { |
21 @private | 27 @private |
22 IBOutlet NSBox* contentBox_; // Only valid at window creation time, used | 28 IBOutlet NSView* tabContentArea_; |
23 // to position the tab strip. nil afterwards. | |
24 // TODO(pinkerton): get rid of this. | |
25 IBOutlet TabStripView* tabStripView_; | 29 IBOutlet TabStripView* tabStripView_; |
26 NSWindow* overlayWindow_; // Used during dragging for window opacity tricks | 30 NSWindow* overlayWindow_; // Used during dragging for window opacity tricks |
27 NSView* cachedContentView_; // Used during dragging for identifying which | 31 NSView* cachedContentView_; // Used during dragging for identifying which |
28 // view is the proper content area in the overlay | 32 // view is the proper content area in the overlay |
29 // (weak) | 33 // (weak) |
30 } | 34 } |
31 @property(readonly, nonatomic) TabStripView* tabStripView; | 35 @property(readonly, nonatomic) TabStripView* tabStripView; |
| 36 @property(readonly, nonatomic) NSView* tabContentArea; |
32 | 37 |
33 // Used during tab dragging to turn on/off the overlay window when a tab | 38 // Used during tab dragging to turn on/off the overlay window when a tab |
34 // is torn off. | 39 // is torn off. |
35 - (void)showOverlay; | 40 - (void)showOverlay; |
36 - (void)removeOverlay; | 41 - (void)removeOverlay; |
37 - (void)removeOverlayAfterDelay:(NSTimeInterval)delay; | 42 - (void)removeOverlayAfterDelay:(NSTimeInterval)delay; |
38 - (NSWindow*)overlayWindow; | 43 - (NSWindow*)overlayWindow; |
39 | 44 |
40 // A collection of methods, stubbed out in this base class, that provide | 45 // A collection of methods, stubbed out in this base class, that provide |
41 // the implementation of tab dragging based on whatever model is most | 46 // the implementation of tab dragging based on whatever model is most |
(...skipping 13 matching lines...) Expand all Loading... |
55 | 60 |
56 // Removes the placeholder installed by |-insertPlaceholderForTab:atLocation:|. | 61 // Removes the placeholder installed by |-insertPlaceholderForTab:atLocation:|. |
57 - (void)removePlaceholder; | 62 - (void)removePlaceholder; |
58 | 63 |
59 // Number of tabs in the tab strip. Useful, for example, to know if we're | 64 // Number of tabs in the tab strip. Useful, for example, to know if we're |
60 // dragging the only tab in the window. | 65 // dragging the only tab in the window. |
61 - (NSInteger)numberOfTabs; | 66 - (NSInteger)numberOfTabs; |
62 | 67 |
63 @end | 68 @end |
64 | 69 |
| 70 @interface TabWindowController(ProtectedMethods) |
| 71 // A list of all the views that need to move to the overlay window. Subclasses |
| 72 // can override this to add more things besides the tab strip. Be sure to |
| 73 // call the superclass' version if overridden. |
| 74 - (NSArray*)viewsToMoveToOverlay; |
| 75 @end |
| 76 |
65 #endif // CHROME_BROWSER_TAB_WINDOW_CONTROLLER_H_ | 77 #endif // CHROME_BROWSER_TAB_WINDOW_CONTROLLER_H_ |
OLD | NEW |