blob: 58383afcca7b33041900d6caa8736aaf00a33282 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_COCOA_TAB_VIEW_H_
#define CHROME_BROWSER_COCOA_TAB_VIEW_H_
#import <Cocoa/Cocoa.h>
#include "base/scoped_nsobject.h"
#import "chrome/browser/cocoa/background_gradient_view.h"
#import "chrome/browser/cocoa/hover_close_button.h"
@class TabController, TabWindowController;
// A view that handles the event tracking (clicking and dragging) for a tab
// on the tab strip. Relies on an associated TabController to provide a
// target/action for selecting the tab.
@interface TabView : BackgroundGradientView {
@private
IBOutlet TabController* controller_;
// TODO(rohitrao): Add this button to a CoreAnimation layer so we can fade it
// in and out on mouseovers.
IBOutlet HoverCloseButton* closeButton_;
BOOL closing_;
// Tracking area for close button mouseover images.
scoped_nsobject<NSTrackingArea> closeTrackingArea_;
BOOL isMouseInside_; // Is the mouse hovering over?
CGFloat hoverAlpha_; // How strong the mouse hover state is.
NSTimeInterval lastHoverUpdate_; // Time the hover value was last updated.
NSPoint hoverPoint_; // Current location of hover in view coords.
// All following variables are valid for the duration of a drag.
// These are released on mouseUp:
BOOL moveWindowOnDrag_; // Set if the only tab of a window is dragged.
BOOL tabWasDragged_; // Has the tab been dragged?
BOOL draggingWithinTabStrip_; // Did drag stay in the current tab strip?
BOOL chromeIsVisible_;
NSTimeInterval tearTime_; // Time since tear happened
NSPoint tearOrigin_; // Origin of the tear rect
NSPoint dragOrigin_; // Origin point of the drag
// TODO(alcor): these references may need to be strong to avoid crashes
// due to JS closing windows
TabWindowController* sourceController_; // weak. controller starting the drag
NSWindow* sourceWindow_; // weak. The window starting the drag
NSRect sourceWindowFrame_;
NSRect sourceTabFrame_;
TabWindowController* draggedController_; // weak. Controller being dragged.
NSWindow* dragWindow_; // weak. The window being dragged
NSWindow* dragOverlay_; // weak. The overlay being dragged
TabWindowController* targetController_; // weak. Controller being targeted
NSCellStateValue state_;
}
@property(assign, nonatomic) NSCellStateValue state;
@property(assign, nonatomic) CGFloat hoverAlpha;
// Determines if the tab is in the process of animating closed. It may still
// be visible on-screen, but should not respond to/initiate any events. Upon
// setting to NO, clears the target/action of the close button to prevent
// clicks inside it from sending messages.
@property(assign, nonatomic, getter=isClosing) BOOL closing;
// Enables/Disables tracking regions for the tab.
- (void)setTrackingEnabled:(BOOL)enabled;
@end
#endif // CHROME_BROWSER_COCOA_TAB_VIEW_H_
|