| 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_VIEW_H_ | 5 #ifndef CHROME_BROWSER_COCOA_TAB_VIEW_H_ |
| 6 #define CHROME_BROWSER_COCOA_TAB_VIEW_H_ | 6 #define CHROME_BROWSER_COCOA_TAB_VIEW_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" |
| 11 #import "chrome/browser/cocoa/background_gradient_view.h" | 11 #import "chrome/browser/cocoa/background_gradient_view.h" |
| 12 | 12 |
| 13 @class TabController, TabWindowController; | 13 @class TabController, TabWindowController; |
| 14 | 14 |
| 15 // A view that handles the event tracking (clicking and dragging) for a tab | 15 // A view that handles the event tracking (clicking and dragging) for a tab |
| 16 // on the tab strip. Relies on an associated TabController to provide a | 16 // on the tab strip. Relies on an associated TabController to provide a |
| 17 // target/action for selecting the tab. | 17 // target/action for selecting the tab. |
| 18 | 18 |
| 19 @interface TabView : BackgroundGradientView { | 19 @interface TabView : BackgroundGradientView { |
| 20 @private | 20 @private |
| 21 IBOutlet TabController* controller_; | 21 IBOutlet TabController* controller_; |
| 22 // TODO(rohitrao): Add this button to a CoreAnimation layer so we can fade it | 22 // TODO(rohitrao): Add this button to a CoreAnimation layer so we can fade it |
| 23 // in and out on mouseovers. | 23 // in and out on mouseovers. |
| 24 IBOutlet NSButton* closeButton_; | 24 IBOutlet NSButton* closeButton_; |
| 25 | 25 |
| 26 // Tracking area for close button mouseover images. | 26 // Tracking area for close button mouseover images. |
| 27 scoped_nsobject<NSTrackingArea> closeTrackingArea_; | 27 scoped_nsobject<NSTrackingArea> trackingArea_; |
| 28 | 28 |
| 29 // All following variables are valid for the duration of a drag. | 29 // All following variables are valid for the duration of a drag. |
| 30 // These are released on mouseUp: | 30 // These are released on mouseUp: |
| 31 BOOL moveWindowOnDrag_; // Set if the only tab of a window is dragged. | 31 BOOL moveWindowOnDrag_; // Set if the only tab of a window is dragged. |
| 32 BOOL tabWasDragged_; // Has the tab been dragged? | 32 BOOL tabWasDragged_; // Has the tab been dragged? |
| 33 BOOL draggingWithinTabStrip_; // Did drag stay in the current tab strip? | 33 BOOL draggingWithinTabStrip_; // Did drag stay in the current tab strip? |
| 34 BOOL chromeIsVisible_; | 34 BOOL chromeIsVisible_; |
| 35 BOOL isMouseInside_; // Is the mouse hovering over? | |
| 36 CGFloat hoverAlpha_; // How strong the mouse hover state is. | |
| 37 NSTimeInterval lastHoverUpdate_; // Time the hover value was last updated. | |
| 38 NSPoint hoverPoint_; // Current location of hover in view coords. | |
| 39 | 35 |
| 40 NSTimeInterval tearTime_; // Time since tear happened | 36 NSTimeInterval tearTime_; // Time since tear happened |
| 41 NSPoint tearOrigin_; // Origin of the tear rect | 37 NSPoint tearOrigin_; // Origin of the tear rect |
| 42 NSPoint dragOrigin_; // Origin point of the drag | 38 NSPoint dragOrigin_; // Origin point of the drag |
| 43 // TODO(alcor): these references may need to be strong to avoid crashes | 39 // TODO(alcor): these references may need to be strong to avoid crashes |
| 44 // due to JS closing windows | 40 // due to JS closing windows |
| 45 TabWindowController* sourceController_; // weak. controller starting the drag | 41 TabWindowController* sourceController_; // weak. controller starting the drag |
| 46 NSWindow* sourceWindow_; // weak. The window starting the drag | 42 NSWindow* sourceWindow_; // weak. The window starting the drag |
| 47 NSRect sourceWindowFrame_; | 43 NSRect sourceWindowFrame_; |
| 48 NSRect sourceTabFrame_; | 44 NSRect sourceTabFrame_; |
| 49 | 45 |
| 50 TabWindowController* draggedController_; // weak. Controller being dragged. | 46 TabWindowController* draggedController_; // weak. Controller being dragged. |
| 51 NSWindow* dragWindow_; // weak. The window being dragged | 47 NSWindow* dragWindow_; // weak. The window being dragged |
| 52 NSWindow* dragOverlay_; // weak. The overlay being dragged | 48 NSWindow* dragOverlay_; // weak. The overlay being dragged |
| 53 | 49 |
| 54 TabWindowController* targetController_; // weak. Controller being targeted | 50 TabWindowController* targetController_; // weak. Controller being targeted |
| 55 NSCellStateValue state_; | 51 NSCellStateValue state_; |
| 56 } | 52 } |
| 57 @property(assign) NSCellStateValue state; | 53 @property(assign) NSCellStateValue state; |
| 58 @property(assign, nonatomic)CGFloat hoverAlpha; | |
| 59 @end | 54 @end |
| 60 | 55 |
| 61 #endif // CHROME_BROWSER_COCOA_TAB_VIEW_H_ | 56 #endif // CHROME_BROWSER_COCOA_TAB_VIEW_H_ |
| OLD | NEW |