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 #import "chrome/browser/cocoa/tab_strip_view.h" | 5 #import "chrome/browser/cocoa/tab_strip_view.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 @implementation TabStripView | 9 @implementation TabStripView |
10 | 10 |
11 - (id)initWithFrame:(NSRect)frame { | 11 - (id)initWithFrame:(NSRect)frame { |
12 self = [super initWithFrame:frame]; | 12 self = [super initWithFrame:frame]; |
13 if (self) { | 13 if (self) { |
14 // Set lastMouseUp_ = -1000.0 so that timestamp-lastMouseUp_ is big unless | 14 // Set lastMouseUp_ = -1000.0 so that timestamp-lastMouseUp_ is big unless |
15 // lastMouseUp_ has been reset. | 15 // lastMouseUp_ has been reset. |
16 lastMouseUp_ = -1000.0; | 16 lastMouseUp_ = -1000.0; |
17 } | 17 } |
18 return self; | 18 return self; |
19 } | 19 } |
20 | 20 |
21 - (void)drawRect:(NSRect)rect { | 21 - (void)drawRect:(NSRect)rect { |
22 NSRect boundsRect = [self bounds]; | 22 NSRect boundsRect = [self bounds]; |
23 NSRect borderRect, contentRect; | 23 NSRect borderRect, contentRect; |
24 NSDivideRect(boundsRect, &borderRect, &contentRect, 1, NSMinYEdge); | 24 NSDivideRect(boundsRect, &borderRect, &contentRect, 1, NSMinYEdge); |
25 [[NSColor colorWithCalibratedWhite:0.0 alpha:0.2] set]; | 25 [[NSColor colorWithCalibratedWhite:0.0 alpha:0.3] set]; |
26 | 26 |
27 NSRectFillUsingOperation(borderRect, NSCompositeSourceOver); | 27 NSRectFillUsingOperation(borderRect, NSCompositeSourceOver); |
28 } | 28 } |
29 | 29 |
30 // We accept first mouse so clicks onto close/zoom/miniaturize buttons and | 30 // We accept first mouse so clicks onto close/zoom/miniaturize buttons and |
31 // title bar double-clicks are properly detected even when the window is in the | 31 // title bar double-clicks are properly detected even when the window is in the |
32 // background. | 32 // background. |
33 - (BOOL)acceptsFirstMouse:(NSEvent*)event { | 33 - (BOOL)acceptsFirstMouse:(NSEvent*)event { |
34 return YES; | 34 return YES; |
35 } | 35 } |
(...skipping 28 matching lines...) Expand all Loading... |
64 [[self window] performMiniaturize:self]; | 64 [[self window] performMiniaturize:self]; |
65 } else { | 65 } else { |
66 [super mouseUp:event]; | 66 [super mouseUp:event]; |
67 } | 67 } |
68 | 68 |
69 // If clickCount is 0, the drag threshold was passed. | 69 // If clickCount is 0, the drag threshold was passed. |
70 lastMouseUp_ = (clickCount == 1) ? timestamp : -1000.0; | 70 lastMouseUp_ = (clickCount == 1) ? timestamp : -1000.0; |
71 } | 71 } |
72 | 72 |
73 @end | 73 @end |
OLD | NEW |