| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/cocoa/tab_view.h" |
| 6 |
| 7 @implementation TabView |
| 8 |
| 9 - (id)initWithFrame:(NSRect)frame { |
| 10 self = [super initWithFrame:frame]; |
| 11 if (self) { |
| 12 // [self gtm_registerForThemeNotifications]; |
| 13 } |
| 14 return self; |
| 15 } |
| 16 |
| 17 - (void)dealloc { |
| 18 // [self gtm_unregisterForThemeNotifications]; |
| 19 [super dealloc]; |
| 20 } |
| 21 |
| 22 // Overridden so that mouse clicks come to this view (the parent of the |
| 23 // hierarchy) first. We want to handle clicks and drags in this class and |
| 24 // leave the background button for display purposes only. |
| 25 - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent { |
| 26 return YES; |
| 27 } |
| 28 |
| 29 // Determines which view a click in our frame actually hit. It's always this |
| 30 // view, never a child. |
| 31 // TODO(alcor): Figure out what to do with the close button. Are we using a |
| 32 // NSButton for it, or drawing it ourselves with a cell? |
| 33 - (NSView *)hitTest:(NSPoint)aPoint { |
| 34 if (NSPointInRect(aPoint, [self frame])) return self; |
| 35 return nil; |
| 36 } |
| 37 |
| 38 // Handle clicks and drags in this button. We get here because we have |
| 39 // overridden acceptsFirstMouse: and the click is within our bounds. |
| 40 - (void)mouseDown:(NSEvent *)theEvent { |
| 41 // fire the action to select the tab |
| 42 if ([[controller_ target] respondsToSelector:[controller_ action]]) |
| 43 [[controller_ target] performSelector:[controller_ action] |
| 44 withObject:self]; |
| 45 |
| 46 // TODO(alcor): handle dragging... |
| 47 } |
| 48 |
| 49 @end |
| OLD | NEW |