| 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_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 | 9 |
| 10 // The loading/waiting state of the tab. | 10 // The loading/waiting state of the tab. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // progress. The default in the nib is an image view so nothing special is | 33 // progress. The default in the nib is an image view so nothing special is |
| 34 // required if that's all you need. | 34 // required if that's all you need. |
| 35 | 35 |
| 36 @interface TabController : NSViewController { | 36 @interface TabController : NSViewController { |
| 37 @private | 37 @private |
| 38 IBOutlet NSView* iconView_; | 38 IBOutlet NSView* iconView_; |
| 39 IBOutlet NSTextField* titleView_; | 39 IBOutlet NSTextField* titleView_; |
| 40 IBOutlet NSMenu* contextMenu_; | 40 IBOutlet NSMenu* contextMenu_; |
| 41 IBOutlet NSButton* closeButton_; | 41 IBOutlet NSButton* closeButton_; |
| 42 | 42 |
| 43 NSRect originalIconFrame_; // frame of iconView_ as loaded from nib |
| 44 BOOL isIconShowing_; // last state of iconView_ in updateVisibility |
| 43 BOOL selected_; | 45 BOOL selected_; |
| 44 TabLoadingState loadingState_; | 46 TabLoadingState loadingState_; |
| 47 float iconTitleXOffset_; // between left edges of icon and title |
| 48 float titleCloseWidthOffset_; // between right edges of icon and close button |
| 45 id<TabControllerTarget> target_; // weak, where actions are sent | 49 id<TabControllerTarget> target_; // weak, where actions are sent |
| 46 SEL action_; // selector sent when tab is selected by clicking | 50 SEL action_; // selector sent when tab is selected by clicking |
| 47 } | 51 } |
| 48 | 52 |
| 49 @property(assign, nonatomic) TabLoadingState loadingState; | 53 @property(assign, nonatomic) TabLoadingState loadingState; |
| 50 | 54 |
| 51 @property(assign, nonatomic) BOOL selected; | 55 @property(assign, nonatomic) BOOL selected; |
| 52 @property(assign, nonatomic) id target; | 56 @property(assign, nonatomic) id target; |
| 53 @property(assign, nonatomic) SEL action; | 57 @property(assign, nonatomic) SEL action; |
| 54 | 58 |
| 55 // Minimum and maximum allowable tab width. The minimum width does not show | 59 // Minimum and maximum allowable tab width. The minimum width does not show |
| 56 // the icon or the close box. The selected tab always has at least a close box | 60 // the icon or the close button. The selected tab always has at least a close |
| 57 // so it has a different minimum width. | 61 // button so it has a different minimum width. |
| 58 + (float)minTabWidth; | 62 + (float)minTabWidth; |
| 59 + (float)maxTabWidth; | 63 + (float)maxTabWidth; |
| 60 + (float)minSelectedTabWidth; | 64 + (float)minSelectedTabWidth; |
| 61 | 65 |
| 62 // The view associated with this controller, pre-casted as a TabView | 66 // The view associated with this controller, pre-casted as a TabView |
| 63 - (TabView *)tabView; | 67 - (TabView *)tabView; |
| 64 | 68 |
| 65 // Closes the associated TabView by relaying the message to |target_| to | 69 // Closes the associated TabView by relaying the message to |target_| to |
| 66 // perform the close. | 70 // perform the close. |
| 67 - (IBAction)closeTab:(id)sender; | 71 - (IBAction)closeTab:(id)sender; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 81 // In this mode, we handle clicks slightly differently due to animation. | 85 // In this mode, we handle clicks slightly differently due to animation. |
| 82 // Ideally, tabs would know about their own animation and wouldn't need this. | 86 // Ideally, tabs would know about their own animation and wouldn't need this. |
| 83 - (BOOL)inRapidClosureMode; | 87 - (BOOL)inRapidClosureMode; |
| 84 | 88 |
| 85 @end | 89 @end |
| 86 | 90 |
| 87 @interface TabController(TestingAPI) | 91 @interface TabController(TestingAPI) |
| 88 - (NSString *)toolTip; | 92 - (NSString *)toolTip; |
| 89 - (int)iconCapacity; | 93 - (int)iconCapacity; |
| 90 - (BOOL)shouldShowIcon; | 94 - (BOOL)shouldShowIcon; |
| 91 - (BOOL)shouldShowCloseBox; | 95 - (BOOL)shouldShowCloseButton; |
| 92 @end // TabController(TestingAPI) | 96 @end // TabController(TestingAPI) |
| 93 | 97 |
| 94 #endif // CHROME_BROWSER_COCOA_TAB_CONTROLLER_H_ | 98 #endif // CHROME_BROWSER_COCOA_TAB_CONTROLLER_H_ |
| OLD | NEW |