| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_COCOA_TAB_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_COCOA_TAB_CONTROLLER_H_ | 6 #define CHROME_BROWSER_COCOA_TAB_CONTROLLER_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 #import "chrome/browser/cocoa/hover_close_button.h" | 9 #import "chrome/browser/cocoa/hover_close_button.h" |
| 10 #include "chrome/browser/tab_menu_model.h" | 10 #include "chrome/browser/tab_menu_model.h" |
| 11 | 11 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 @interface TabController : NSViewController { | 38 @interface TabController : NSViewController { |
| 39 @private | 39 @private |
| 40 IBOutlet NSView* iconView_; | 40 IBOutlet NSView* iconView_; |
| 41 IBOutlet NSTextField* titleView_; | 41 IBOutlet NSTextField* titleView_; |
| 42 IBOutlet HoverCloseButton* closeButton_; | 42 IBOutlet HoverCloseButton* closeButton_; |
| 43 | 43 |
| 44 NSRect originalIconFrame_; // frame of iconView_ as loaded from nib | 44 NSRect originalIconFrame_; // frame of iconView_ as loaded from nib |
| 45 BOOL isIconShowing_; // last state of iconView_ in updateVisibility | 45 BOOL isIconShowing_; // last state of iconView_ in updateVisibility |
| 46 BOOL selected_; | 46 BOOL selected_; |
| 47 BOOL pinned_; | 47 BOOL mini_; |
| 48 BOOL phantom_; |
| 48 TabLoadingState loadingState_; | 49 TabLoadingState loadingState_; |
| 49 CGFloat iconTitleXOffset_; // between left edges of icon and title | 50 CGFloat iconTitleXOffset_; // between left edges of icon and title |
| 50 CGFloat titleCloseWidthOffset_; // between right edges of icon and close btn. | 51 CGFloat titleCloseWidthOffset_; // between right edges of icon and close btn. |
| 51 id<TabControllerTarget> target_; // weak, where actions are sent | 52 id<TabControllerTarget> target_; // weak, where actions are sent |
| 52 SEL action_; // selector sent when tab is selected by clicking | 53 SEL action_; // selector sent when tab is selected by clicking |
| 53 scoped_ptr<TabMenuModel> contextMenuModel_; | 54 scoped_ptr<TabMenuModel> contextMenuModel_; |
| 54 scoped_ptr<TabControllerInternal::MenuDelegate> contextMenuDelegate_; | 55 scoped_ptr<TabControllerInternal::MenuDelegate> contextMenuDelegate_; |
| 55 scoped_nsobject<MenuController> contextMenuController_; | 56 scoped_nsobject<MenuController> contextMenuController_; |
| 56 } | 57 } |
| 57 | 58 |
| 58 @property(assign, nonatomic) TabLoadingState loadingState; | 59 @property(assign, nonatomic) TabLoadingState loadingState; |
| 59 | 60 |
| 60 @property(assign, nonatomic) BOOL selected; | 61 @property(assign, nonatomic) BOOL selected; |
| 61 @property(assign, nonatomic) BOOL pinned; | 62 @property(assign, nonatomic) BOOL mini; |
| 63 @property(assign, nonatomic) BOOL phantom; |
| 62 @property(assign, nonatomic) id target; | 64 @property(assign, nonatomic) id target; |
| 63 @property(assign, nonatomic) SEL action; | 65 @property(assign, nonatomic) SEL action; |
| 64 | 66 |
| 65 // Minimum and maximum allowable tab width. The minimum width does not show | 67 // Minimum and maximum allowable tab width. The minimum width does not show |
| 66 // the icon or the close button. The selected tab always has at least a close | 68 // the icon or the close button. The selected tab always has at least a close |
| 67 // button so it has a different minimum width. | 69 // button so it has a different minimum width. |
| 68 + (CGFloat)minTabWidth; | 70 + (CGFloat)minTabWidth; |
| 69 + (CGFloat)maxTabWidth; | 71 + (CGFloat)maxTabWidth; |
| 70 + (CGFloat)minSelectedTabWidth; | 72 + (CGFloat)minSelectedTabWidth; |
| 71 + (CGFloat)pinnedTabWidth; | 73 + (CGFloat)miniTabWidth; |
| 72 | 74 |
| 73 // The view associated with this controller, pre-casted as a TabView | 75 // The view associated with this controller, pre-casted as a TabView |
| 74 - (TabView*)tabView; | 76 - (TabView*)tabView; |
| 75 | 77 |
| 76 // Closes the associated TabView by relaying the message to |target_| to | 78 // Closes the associated TabView by relaying the message to |target_| to |
| 77 // perform the close. | 79 // perform the close. |
| 78 - (IBAction)closeTab:(id)sender; | 80 - (IBAction)closeTab:(id)sender; |
| 79 | 81 |
| 80 // Replace the current icon view with the given view. |iconView| will be | 82 // Replace the current icon view with the given view. |iconView| will be |
| 81 // resized to the size of the current icon view. | 83 // resized to the size of the current icon view. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 97 @end | 99 @end |
| 98 | 100 |
| 99 @interface TabController(TestingAPI) | 101 @interface TabController(TestingAPI) |
| 100 - (NSString*)toolTip; | 102 - (NSString*)toolTip; |
| 101 - (int)iconCapacity; | 103 - (int)iconCapacity; |
| 102 - (BOOL)shouldShowIcon; | 104 - (BOOL)shouldShowIcon; |
| 103 - (BOOL)shouldShowCloseButton; | 105 - (BOOL)shouldShowCloseButton; |
| 104 @end // TabController(TestingAPI) | 106 @end // TabController(TestingAPI) |
| 105 | 107 |
| 106 #endif // CHROME_BROWSER_COCOA_TAB_CONTROLLER_H_ | 108 #endif // CHROME_BROWSER_COCOA_TAB_CONTROLLER_H_ |
| OLD | NEW |