| 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/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 @public | 21 @public |
| 22 enum EventHandled { | 22 enum EventHandled { |
| 23 kEventNotHandled, | 23 kEventNotHandled, |
| 24 kEventHandled | 24 kEventHandled |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 @private | 27 @private |
| 28 ui::ScopedCrTrackingArea trackingArea_; | 28 ui::ScopedCrTrackingArea trackingArea_; |
| 29 BOOL dragging_; | 29 BOOL dragging_; |
| 30 base::scoped_nsobject<NSEvent> pendingExitEvent_; | 30 base::scoped_nsobject<NSEvent> pendingExitEvent_; |
| 31 id eventTap_; |
| 31 } | 32 } |
| 32 | 33 |
| 34 // NSTrackingInVisibleRect doesn't work correctly with Lion's window resizing, |
| 35 // http://crbug.com/176725 / http://openradar.appspot.com/radar?id=2773401 . |
| 36 // Setting |wantsReliableMouseEvents| to YES will avoid using the tracking area |
| 37 // for mouse moved handling, and will instead tap it from the application's |
| 38 // event stream. |
| 39 - (instancetype)initWithFrame:(NSRect)frame |
| 40 wantsReliableMouseEvents:(BOOL)wantsReliableMouseEvents; |
| 41 |
| 33 // Override these methods (mouseEvent, keyEvent) in a subclass. | 42 // Override these methods (mouseEvent, keyEvent) in a subclass. |
| 34 - (void)mouseEvent:(NSEvent *)theEvent; | 43 - (void)mouseEvent:(NSEvent *)theEvent; |
| 35 | 44 |
| 36 // keyEvent should return kEventHandled if it handled the event, or | 45 // keyEvent should return kEventHandled if it handled the event, or |
| 37 // kEventNotHandled if it should be forwarded to BaseView's super class. | 46 // kEventNotHandled if it should be forwarded to BaseView's super class. |
| 38 - (EventHandled)keyEvent:(NSEvent *)theEvent; | 47 - (EventHandled)keyEvent:(NSEvent *)theEvent; |
| 39 | 48 |
| 40 // Useful rect conversions (doing coordinate flipping) | 49 // Useful rect conversions (doing coordinate flipping) |
| 41 - (gfx::Rect)flipNSRectToRect:(NSRect)rect; | 50 - (gfx::Rect)flipNSRectToRect:(NSRect)rect; |
| 42 - (NSRect)flipRectToNSRect:(gfx::Rect)rect; | 51 - (NSRect)flipRectToNSRect:(gfx::Rect)rect; |
| 43 | 52 |
| 44 @end | 53 @end |
| 45 | 54 |
| 46 // A notification that a view may issue when it receives first responder status. | 55 // A notification that a view may issue when it receives first responder status. |
| 47 // The name is |kViewDidBecomeFirstResponder|, the object is the view, and the | 56 // The name is |kViewDidBecomeFirstResponder|, the object is the view, and the |
| 48 // NSSelectionDirection is wrapped in an NSNumber under the key | 57 // NSSelectionDirection is wrapped in an NSNumber under the key |
| 49 // |kSelectionDirection|. | 58 // |kSelectionDirection|. |
| 50 UI_BASE_EXPORT extern NSString* kViewDidBecomeFirstResponder; | 59 UI_BASE_EXPORT extern NSString* kViewDidBecomeFirstResponder; |
| 51 UI_BASE_EXPORT extern NSString* kSelectionDirection; | 60 UI_BASE_EXPORT extern NSString* kSelectionDirection; |
| 52 | 61 |
| 53 #endif // UI_BASE_COCOA_BASE_VIEW_H_ | 62 #endif // UI_BASE_COCOA_BASE_VIEW_H_ |
| OLD | NEW |