| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_COCOA_TABS_TAB_WINDOW_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_TABS_TAB_WINDOW_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_TABS_TAB_WINDOW_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_TABS_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 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // Returns YES if it is ok to constrain the window's frame to fit the screen. | 52 // Returns YES if it is ok to constrain the window's frame to fit the screen. |
| 53 - (BOOL)shouldConstrainFrameRect; | 53 - (BOOL)shouldConstrainFrameRect; |
| 54 | 54 |
| 55 // A collection of methods, stubbed out in this base class, that provide | 55 // A collection of methods, stubbed out in this base class, that provide |
| 56 // the implementation of tab dragging based on whatever model is most | 56 // the implementation of tab dragging based on whatever model is most |
| 57 // appropriate. | 57 // appropriate. |
| 58 | 58 |
| 59 // Layout the tabs based on the current ordering of the model. | 59 // Layout the tabs based on the current ordering of the model. |
| 60 - (void)layoutTabs; | 60 - (void)layoutTabs; |
| 61 | 61 |
| 62 // Creates a new window by pulling the given tab out and placing it in | 62 // Creates a new window by pulling the given tabs out and placing it in |
| 63 // the new window. Returns the controller for the new window. The size of the | 63 // the new window. Returns the controller for the new window. The size of the |
| 64 // new window will be the same size as this window. | 64 // new window will be the same size as this window. |
| 65 - (TabWindowController*)detachTabToNewWindow:(TabView*)tabView; | 65 - (TabWindowController*)detachTabsToNewWindow:(NSArray*)tabViews |
| 66 draggedTab:(NSView*)draggedTab; |
| 66 | 67 |
| 67 // Make room in the tab strip for |tab| at the given x coordinate. Will hide the | 68 // Make room in the tab strip for |tab| at the given x coordinate. Will hide the |
| 68 // new tab button while there's a placeholder. Subclasses need to call the | 69 // new tab button while there's a placeholder. Subclasses need to call the |
| 69 // superclass implementation. | 70 // superclass implementation. |
| 70 - (void)insertPlaceholderForTab:(TabView*)tab frame:(NSRect)frame; | 71 - (void)insertPlaceholderForTab:(TabView*)tab frame:(NSRect)frame; |
| 71 | 72 |
| 72 // Removes the placeholder installed by |-insertPlaceholderForTab:atLocation:| | 73 // Removes the placeholder installed by |-insertPlaceholderForTab:atLocation:| |
| 73 // and restores the new tab button. Subclasses need to call the superclass | 74 // and restores the new tab button. Subclasses need to call the superclass |
| 74 // implementation. | 75 // implementation. |
| 75 - (void)removePlaceholder; | 76 - (void)removePlaceholder; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 92 // Returns whether or not |tab| can still be fully seen in the tab strip or if | 93 // Returns whether or not |tab| can still be fully seen in the tab strip or if |
| 93 // its current position would cause it be obscured by things such as the edge | 94 // its current position would cause it be obscured by things such as the edge |
| 94 // of the window or the window decorations. Returns YES only if the entire tab | 95 // of the window or the window decorations. Returns YES only if the entire tab |
| 95 // is visible. The default implementation always returns YES. | 96 // is visible. The default implementation always returns YES. |
| 96 - (BOOL)isTabFullyVisible:(TabView*)tab; | 97 - (BOOL)isTabFullyVisible:(TabView*)tab; |
| 97 | 98 |
| 98 // Called to check if the receiver can receive dragged tabs from | 99 // Called to check if the receiver can receive dragged tabs from |
| 99 // source. Return YES if so. The default implementation returns NO. | 100 // source. Return YES if so. The default implementation returns NO. |
| 100 - (BOOL)canReceiveFrom:(TabWindowController*)source; | 101 - (BOOL)canReceiveFrom:(TabWindowController*)source; |
| 101 | 102 |
| 102 // Move a given tab view to the location of the current placeholder. If there is | 103 // Move given tab views to the location of the current placeholder. If there is |
| 103 // no placeholder, it will go at the end. |controller| is the window controller | 104 // no placeholder, it will go at the end. |controller| is the window controller |
| 104 // of a tab being dropped from a different window. It will be nil if the drag is | 105 // of a tab being dropped from a different window. It will be nil if the drag is |
| 105 // within the window, otherwise the tab is removed from that window before being | 106 // within the window, otherwise the tab is removed from that window before being |
| 106 // placed into this one. The implementation will call |-removePlaceholder| since | 107 // placed into this one. The implementation will call |-removePlaceholder| since |
| 107 // the drag is now complete. This also calls |-layoutTabs| internally so | 108 // the drag is now complete. This also calls |-layoutTabs| internally so |
| 108 // clients do not need to call it again. | 109 // clients do not need to call it again. |
| 109 - (void)moveTabView:(NSView*)view | 110 - (void)moveTabViews:(NSArray*)views |
| 110 fromController:(TabWindowController*)controller; | 111 fromController:(TabWindowController*)controller; |
| 111 | 112 |
| 112 // Number of tabs in the tab strip. Useful, for example, to know if we're | 113 // Number of tabs in the tab strip. Useful, for example, to know if we're |
| 113 // dragging the only tab in the window. This includes pinned tabs (both live | 114 // dragging the only tab in the window. This includes pinned tabs (both live |
| 114 // and not). | 115 // and not). |
| 115 - (NSInteger)numberOfTabs; | 116 - (NSInteger)numberOfTabs; |
| 116 | 117 |
| 117 // YES if there are tabs in the tab strip which have content, allowing for | 118 // YES if there are tabs in the tab strip which have content, allowing for |
| 118 // the notion of tabs in the tab strip that are placeholders but currently have | 119 // the notion of tabs in the tab strip that are placeholders but currently have |
| 119 // no content. | 120 // no content. |
| 120 - (BOOL)hasLiveTabs; | 121 - (BOOL)hasLiveTabs; |
| 121 | 122 |
| 123 // Returns all tab views. |
| 124 - (NSArray*)tabViews; |
| 125 |
| 122 // Return the view of the active tab. | 126 // Return the view of the active tab. |
| 123 - (NSView*)activeTabView; | 127 - (NSView*)activeTabView; |
| 124 | 128 |
| 125 // The title of the active tab. | 129 // The title of the active tab. |
| 126 - (NSString*)activeTabTitle; | 130 - (NSString*)activeTabTitle; |
| 127 | 131 |
| 128 // Called to check whether or not this controller's window has a tab strip (YES | 132 // Called to check whether or not this controller's window has a tab strip (YES |
| 129 // if it does, NO otherwise). The default implementation returns YES. | 133 // if it does, NO otherwise). The default implementation returns YES. |
| 130 - (BOOL)hasTabStrip; | 134 - (BOOL)hasTabStrip; |
| 131 | 135 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 143 // Tells the tab strip to forget about this tab in preparation for it being | 147 // Tells the tab strip to forget about this tab in preparation for it being |
| 144 // put into a different tab strip, such as during a drop on another window. | 148 // put into a different tab strip, such as during a drop on another window. |
| 145 - (void)detachTabView:(NSView*)view; | 149 - (void)detachTabView:(NSView*)view; |
| 146 | 150 |
| 147 // Called when the size of the window content area has changed. Override to | 151 // Called when the size of the window content area has changed. Override to |
| 148 // position specific views. Base class implementation does nothing. | 152 // position specific views. Base class implementation does nothing. |
| 149 - (void)layoutSubviews; | 153 - (void)layoutSubviews; |
| 150 @end | 154 @end |
| 151 | 155 |
| 152 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_WINDOW_CONTROLLER_H_ | 156 #endif // CHROME_BROWSER_UI_COCOA_TABS_TAB_WINDOW_CONTROLLER_H_ |
| OLD | NEW |