Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(797)

Unified Diff: chrome/browser/cocoa/tab_view.mm

Issue 43137: Add a TabController class to manage a TabView (with corresponding xib). Rewri... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/cocoa/tab_view.mm
===================================================================
--- chrome/browser/cocoa/tab_view.mm (revision 0)
+++ chrome/browser/cocoa/tab_view.mm (revision 0)
@@ -0,0 +1,49 @@
+// 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.
+
+#include "chrome/browser/cocoa/tab_view.h"
+
+@implementation TabView
+
+- (id)initWithFrame:(NSRect)frame {
+ self = [super initWithFrame:frame];
+ if (self) {
+ // [self gtm_registerForThemeNotifications];
TVL 2009/03/12 15:56:42 ? - pending custom drawing?
+ }
+ return self;
+}
+
+- (void)dealloc {
+ // [self gtm_unregisterForThemeNotifications];
TVL 2009/03/12 15:56:42 ?
+ [super dealloc];
+}
+
+// Overridden so that mouse clicks come to this view (the parent of the
+// hierarchy) first. We want to handle clicks and drags in this class and
+// leave the background button for display purposes only.
+- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent {
+ return YES;
+}
+
+// Determines which view a click in our frame actually hit. It's always this
+// view, never a child.
+// TODO(alcor): Figure out what to do with the close button. Are we using a
+// NSButton for it, or drawing it ourselves with a cell?
+- (NSView *)hitTest:(NSPoint)aPoint {
+ if (NSPointInRect(aPoint, [self frame])) return self;
+ return nil;
+}
+
+// Handle clicks and drags in this button. We get here because we have
+// overridden acceptsFirstMouse: and the click is within our bounds.
+- (void)mouseDown:(NSEvent *)theEvent {
+ // fire the action to select the tab
+ if ([[controller_ target] respondsToSelector:[controller_ action]])
+ [[controller_ target] performSelector:[controller_ action]
+ withObject:self];
+
+ // TODO(alcor): handle dragging...
+}
+
+@end
Property changes on: chrome/browser/cocoa/tab_view.mm
___________________________________________________________________
Name: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698