| 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 #ifndef CHROME_BROWSER_COCOA_BASE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_COCOA_BASE_VIEW_H_ |
| 6 #define CHROME_BROWSER_COCOA_BASE_VIEW_H_ | 6 #define CHROME_BROWSER_COCOA_BASE_VIEW_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/scoped_nsobject.h" |
| 10 #include "gfx/rect.h" | 11 #include "gfx/rect.h" |
| 11 | 12 |
| 12 // A view that provides common functionality that many views will need: | 13 // A view that provides common functionality that many views will need: |
| 13 // - Automatic registration for mouse-moved events. | 14 // - Automatic registration for mouse-moved events. |
| 14 // - Funneling of mouse and key events to two methods | 15 // - Funneling of mouse and key events to two methods |
| 15 // - Coordinate conversion utilities | 16 // - Coordinate conversion utilities |
| 16 | 17 |
| 17 @interface BaseView : NSView { | 18 @interface BaseView : NSView { |
| 18 @private | 19 @private |
| 19 NSTrackingArea *trackingArea_; | 20 NSTrackingArea *trackingArea_; |
| 21 BOOL dragging_; |
| 22 scoped_nsobject<NSEvent> pendingExitEvent_; |
| 20 } | 23 } |
| 21 | 24 |
| 22 - (id)initWithFrame:(NSRect)frame; | 25 - (id)initWithFrame:(NSRect)frame; |
| 23 | 26 |
| 24 // Override these methods in a subclass. | 27 // Override these methods in a subclass. |
| 25 - (void)mouseEvent:(NSEvent *)theEvent; | 28 - (void)mouseEvent:(NSEvent *)theEvent; |
| 26 - (void)keyEvent:(NSEvent *)theEvent; | 29 - (void)keyEvent:(NSEvent *)theEvent; |
| 27 | 30 |
| 28 // Useful rect conversions (doing coordinate flipping) | 31 // Useful rect conversions (doing coordinate flipping) |
| 29 - (gfx::Rect)NSRectToRect:(NSRect)rect; | 32 - (gfx::Rect)NSRectToRect:(NSRect)rect; |
| 30 - (NSRect)RectToNSRect:(gfx::Rect)rect; | 33 - (NSRect)RectToNSRect:(gfx::Rect)rect; |
| 31 | 34 |
| 32 @end | 35 @end |
| 33 | 36 |
| 34 #endif // CHROME_BROWSER_COCOA_BASE_VIEW_H_ | 37 #endif // CHROME_BROWSER_COCOA_BASE_VIEW_H_ |
| OLD | NEW |