| 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_COCOA_TAB_STRIP_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_COCOA_TAB_STRIP_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_COCOA_TAB_STRIP_CONTROLLER_H_ | 6 #define CHROME_BROWSER_COCOA_TAB_STRIP_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/scoped_nsobject.h" | 10 #include "base/scoped_nsobject.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // using its index from the TabStripModelObserver calls. | 51 // using its index from the TabStripModelObserver calls. |
| 52 scoped_nsobject<NSMutableArray> tabContentsArray_; | 52 scoped_nsobject<NSMutableArray> tabContentsArray_; |
| 53 // an array of TabControllers which manage the actual tab views. As above, | 53 // an array of TabControllers which manage the actual tab views. As above, |
| 54 // this is kept in the same order as the tab strip model. | 54 // this is kept in the same order as the tab strip model. |
| 55 scoped_nsobject<NSMutableArray> tabArray_; | 55 scoped_nsobject<NSMutableArray> tabArray_; |
| 56 | 56 |
| 57 // These values are only used during a drag, and override tab positioning. | 57 // These values are only used during a drag, and override tab positioning. |
| 58 TabView* placeholderTab_; // weak. Tab being dragged | 58 TabView* placeholderTab_; // weak. Tab being dragged |
| 59 NSRect placeholderFrame_; // Frame to use | 59 NSRect placeholderFrame_; // Frame to use |
| 60 CGFloat placeholderStretchiness_; // Vertical force shown by streching tab. | 60 CGFloat placeholderStretchiness_; // Vertical force shown by streching tab. |
| 61 NSRect droppedTabFrame_; // Initial frame of a dropped tab, for animation. |
| 61 // Frame targets for all the current views. | 62 // Frame targets for all the current views. |
| 62 // target frames are used because repeated requests to [NSView animator]. | 63 // target frames are used because repeated requests to [NSView animator]. |
| 63 // aren't coalesced, so we store frames to avoid redundant calls. | 64 // aren't coalesced, so we store frames to avoid redundant calls. |
| 64 scoped_nsobject<NSMutableDictionary> targetFrames_; | 65 scoped_nsobject<NSMutableDictionary> targetFrames_; |
| 65 NSRect newTabTargetFrame_; | 66 NSRect newTabTargetFrame_; |
| 66 // If YES, do not show the new tab button during layout. | 67 // If YES, do not show the new tab button during layout. |
| 67 BOOL forceNewTabButtonHidden_; | 68 BOOL forceNewTabButtonHidden_; |
| 68 // YES if we've successfully completed the initial layout. When this is | 69 // YES if we've successfully completed the initial layout. When this is |
| 69 // NO, we probably don't want to do any animation because we're just coming | 70 // NO, we probably don't want to do any animation because we're just coming |
| 70 // into being. | 71 // into being. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // Set the frame of the selected tab, also updates the internal frame dict. | 104 // Set the frame of the selected tab, also updates the internal frame dict. |
| 104 - (void)setFrameOfSelectedTab:(NSRect)frame; | 105 - (void)setFrameOfSelectedTab:(NSRect)frame; |
| 105 | 106 |
| 106 // Move the given tab at index |from| in this window to the location of the | 107 // Move the given tab at index |from| in this window to the location of the |
| 107 // current placeholder. | 108 // current placeholder. |
| 108 - (void)moveTabFromIndex:(NSInteger)from; | 109 - (void)moveTabFromIndex:(NSInteger)from; |
| 109 | 110 |
| 110 // Drop a given TabContents at the location of the current placeholder. If there | 111 // Drop a given TabContents at the location of the current placeholder. If there |
| 111 // is no placeholder, it will go at the end. Used when dragging from another | 112 // is no placeholder, it will go at the end. Used when dragging from another |
| 112 // window when we don't have access to the TabContents as part of our strip. | 113 // window when we don't have access to the TabContents as part of our strip. |
| 113 - (void)dropTabContents:(TabContents*)contents; | 114 // |frame| is in the coordinate system of the tab strip view and represents |
| 115 // where the user dropped the new tab so it can be animated into its correct |
| 116 // location when the tab is added to the model. |
| 117 - (void)dropTabContents:(TabContents*)contents withFrame:(NSRect)frame; |
| 114 | 118 |
| 115 // Given a tab view in the strip, return its index. Returns -1 if not present. | 119 // Given a tab view in the strip, return its index. Returns -1 if not present. |
| 116 - (NSInteger)indexForTabView:(NSView*)view; | 120 - (NSInteger)indexForTabView:(NSView*)view; |
| 117 | 121 |
| 118 // return the view at a given index | 122 // return the view at a given index |
| 119 - (NSView*)viewAtIndex:(NSUInteger)index; | 123 - (NSView*)viewAtIndex:(NSUInteger)index; |
| 120 | 124 |
| 121 // Set the placeholder for a dragged tab, allowing the |frame| and |strechiness| | 125 // Set the placeholder for a dragged tab, allowing the |frame| and |strechiness| |
| 122 // to be specified. This causes this tab to be rendered in an arbitrary position | 126 // to be specified. This causes this tab to be rendered in an arbitrary position |
| 123 - (void)insertPlaceholderForTab:(TabView*)tab | 127 - (void)insertPlaceholderForTab:(TabView*)tab |
| (...skipping 28 matching lines...) Expand all Loading... |
| 152 - (void)attachConstrainedWindow:(ConstrainedWindowMac*)window; | 156 - (void)attachConstrainedWindow:(ConstrainedWindowMac*)window; |
| 153 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window; | 157 - (void)removeConstrainedWindow:(ConstrainedWindowMac*)window; |
| 154 | 158 |
| 155 @end | 159 @end |
| 156 | 160 |
| 157 // Notification sent when the number of tabs changes. The object will be this | 161 // Notification sent when the number of tabs changes. The object will be this |
| 158 // controller. | 162 // controller. |
| 159 extern NSString* const kTabStripNumberOfTabsChanged; | 163 extern NSString* const kTabStripNumberOfTabsChanged; |
| 160 | 164 |
| 161 #endif // CHROME_BROWSER_COCOA_TAB_STRIP_CONTROLLER_H_ | 165 #endif // CHROME_BROWSER_COCOA_TAB_STRIP_CONTROLLER_H_ |
| OLD | NEW |