summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/base_view.h
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-17 22:04:50 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-17 22:04:50 +0000
commit98f8d9c1248dc678ef09af9436976ca5af72f42a (patch)
tree81bc7d0de54f586d15cdb978270b43c53afb64cf /chrome/browser/cocoa/base_view.h
parent401efff5d553c57124790696503f0f06fff31344 (diff)
downloadchromium_src-98f8d9c1248dc678ef09af9436976ca5af72f42a.zip
chromium_src-98f8d9c1248dc678ef09af9436976ca5af72f42a.tar.gz
chromium_src-98f8d9c1248dc678ef09af9436976ca5af72f42a.tar.bz2
Significantly rework coordinate handling for the Cocoa views. Fixes tons of redraw and scrolling issues.
Review URL: http://codereview.chromium.org/20435 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9905 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/base_view.h')
-rw-r--r--chrome/browser/cocoa/base_view.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/base_view.h b/chrome/browser/cocoa/base_view.h
new file mode 100644
index 0000000..5147451
--- /dev/null
+++ b/chrome/browser/cocoa/base_view.h
@@ -0,0 +1,34 @@
+// 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_BASE_VIEW_H_
+#define CHROME_BROWSER_COCOA_BASE_VIEW_H_
+
+#import <Cocoa/Cocoa.h>
+
+#include "base/gfx/rect.h"
+
+// A view that provides common functionality that many views will need:
+// - Automatic registration for mouse-moved events.
+// - Funneling of mouse and key events to two methods
+// - Coordinate conversion utilities
+
+@interface BaseView : NSView {
+ @private
+ NSTrackingArea *trackingArea_;
+}
+
+- (id)initWithFrame:(NSRect)frame;
+
+// Override these methods in a subclass.
+- (void)mouseEvent:(NSEvent *)theEvent;
+- (void)keyEvent:(NSEvent *)theEvent;
+
+// Useful rect conversions (doing coordinate flipping)
+- (gfx::Rect)NSRectToRect:(NSRect)rect;
+- (NSRect)RectToNSRect:(gfx::Rect)rect;
+
+@end
+
+#endif // CHROME_BROWSER_COCOA_BASE_VIEW_H_