| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_BASE_COCOA_BASE_VIEW_H_ | 5 #ifndef UI_BASE_COCOA_BASE_VIEW_H_ |
| 6 #define UI_BASE_COCOA_BASE_VIEW_H_ | 6 #define UI_BASE_COCOA_BASE_VIEW_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/memory/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| 11 #import "ui/base/cocoa/tracking_area.h" |
| 11 #include "ui/base/ui_export.h" | 12 #include "ui/base/ui_export.h" |
| 12 #import "ui/base/cocoa/tracking_area.h" | |
| 13 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
| 14 | 14 |
| 15 // A view that provides common functionality that many views will need: | 15 // A view that provides common functionality that many views will need: |
| 16 // - Automatic registration for mouse-moved events. | 16 // - Automatic registration for mouse-moved events. |
| 17 // - Funneling of mouse and key events to two methods | 17 // - Funneling of mouse and key events to two methods |
| 18 // - Coordinate conversion utilities | 18 // - Coordinate conversion utilities |
| 19 UI_EXPORT | 19 UI_EXPORT |
| 20 @interface BaseView : NSView { | 20 @interface BaseView : NSView { |
| 21 @private | 21 @private |
| 22 ui::ScopedCrTrackingArea trackingArea_; | 22 ui::ScopedCrTrackingArea trackingArea_; |
| 23 BOOL dragging_; | 23 BOOL dragging_; |
| 24 scoped_nsobject<NSEvent> pendingExitEvent_; | 24 base::scoped_nsobject<NSEvent> pendingExitEvent_; |
| 25 } | 25 } |
| 26 | 26 |
| 27 // Override these methods in a subclass. | 27 // Override these methods in a subclass. |
| 28 - (void)mouseEvent:(NSEvent *)theEvent; | 28 - (void)mouseEvent:(NSEvent *)theEvent; |
| 29 - (void)keyEvent:(NSEvent *)theEvent; | 29 - (void)keyEvent:(NSEvent *)theEvent; |
| 30 | 30 |
| 31 // Useful rect conversions (doing coordinate flipping) | 31 // Useful rect conversions (doing coordinate flipping) |
| 32 - (gfx::Rect)flipNSRectToRect:(NSRect)rect; | 32 - (gfx::Rect)flipNSRectToRect:(NSRect)rect; |
| 33 - (NSRect)flipRectToNSRect:(gfx::Rect)rect; | 33 - (NSRect)flipRectToNSRect:(gfx::Rect)rect; |
| 34 | 34 |
| 35 @end | 35 @end |
| 36 | 36 |
| 37 // A notification that a view may issue when it receives first responder status. | 37 // A notification that a view may issue when it receives first responder status. |
| 38 // The name is |kViewDidBecomeFirstResponder|, the object is the view, and the | 38 // The name is |kViewDidBecomeFirstResponder|, the object is the view, and the |
| 39 // NSSelectionDirection is wrapped in an NSNumber under the key | 39 // NSSelectionDirection is wrapped in an NSNumber under the key |
| 40 // |kSelectionDirection|. | 40 // |kSelectionDirection|. |
| 41 UI_EXPORT extern NSString* kViewDidBecomeFirstResponder; | 41 UI_EXPORT extern NSString* kViewDidBecomeFirstResponder; |
| 42 UI_EXPORT extern NSString* kSelectionDirection; | 42 UI_EXPORT extern NSString* kSelectionDirection; |
| 43 | 43 |
| 44 #endif // UI_BASE_COCOA_BASE_VIEW_H_ | 44 #endif // UI_BASE_COCOA_BASE_VIEW_H_ |
| OLD | NEW |