Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
|
tapted
2016/09/21 10:07:05
CL description - can you flesh it out with some of
| |
| 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" |
| 11 #include "base/mac/sdk_forward_declarations.h" | 11 #include "base/mac/sdk_forward_declarations.h" |
| 12 #import "ui/base/cocoa/tracking_area.h" | 12 #import "ui/base/cocoa/tracking_area.h" |
| 13 #include "ui/base/ui_base_export.h" | 13 #include "ui/base/ui_base_export.h" |
| 14 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
| 15 | 15 |
| 16 // A view that provides common functionality that many views will need: | 16 // A view that provides common functionality that many views will need: |
| 17 // - Automatic registration for mouse-moved events. | 17 // - Automatic registration for mouse-moved events. |
| 18 // - Funneling of mouse and key events to two methods | 18 // - Funneling of mouse and key events to two methods |
| 19 // - Coordinate conversion utilities | 19 // - Coordinate conversion utilities |
| 20 UI_BASE_EXPORT | 20 UI_BASE_EXPORT |
| 21 @interface BaseView : NSView { | 21 @interface BaseView : NSView { |
| 22 @public | 22 @public |
| 23 enum EventHandled { | 23 enum EventHandled { |
| 24 kEventNotHandled, | 24 kEventNotHandled, |
| 25 kEventHandled | 25 kEventHandled |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 @private | 28 @private |
| 29 ui::ScopedCrTrackingArea trackingArea_; | 29 ui::ScopedCrTrackingArea trackingArea_; |
| 30 BOOL dragging_; | |
| 31 base::scoped_nsobject<NSEvent> pendingExitEvent_; | |
|
tapted
2016/09/19 00:31:01
spqchan is right - we can't change BaseView -- too
snake
2016/09/20 15:04:26
was
tapted
2016/09/21 10:07:05
So a possible alternative fix may be to generate a
| |
| 32 NSInteger pressureEventStage_; | 30 NSInteger pressureEventStage_; |
| 33 } | 31 } |
| 34 | 32 |
| 35 // Override these methods (mouseEvent, keyEvent, forceTouchEvent) in a | 33 // Override these methods (mouseEvent, keyEvent, forceTouchEvent) in a |
| 36 // subclass. | 34 // subclass. |
| 37 - (void)mouseEvent:(NSEvent *)theEvent; | 35 - (void)mouseEvent:(NSEvent *)theEvent; |
| 38 | 36 |
| 39 // keyEvent should return kEventHandled if it handled the event, or | 37 // keyEvent should return kEventHandled if it handled the event, or |
| 40 // kEventNotHandled if it should be forwarded to BaseView's super class. | 38 // kEventNotHandled if it should be forwarded to BaseView's super class. |
| 41 - (EventHandled)keyEvent:(NSEvent *)theEvent; | 39 - (EventHandled)keyEvent:(NSEvent *)theEvent; |
| 42 | 40 |
| 43 - (void)forceTouchEvent:(NSEvent*)theEvent; | 41 - (void)forceTouchEvent:(NSEvent*)theEvent; |
| 44 | 42 |
| 45 // Useful rect conversions (doing coordinate flipping) | 43 // Useful rect conversions (doing coordinate flipping) |
| 46 - (gfx::Rect)flipNSRectToRect:(NSRect)rect; | 44 - (gfx::Rect)flipNSRectToRect:(NSRect)rect; |
| 47 - (NSRect)flipRectToNSRect:(gfx::Rect)rect; | 45 - (NSRect)flipRectToNSRect:(gfx::Rect)rect; |
| 48 | 46 |
| 49 @end | 47 @end |
| 50 | 48 |
| 51 // A notification that a view may issue when it receives first responder status. | 49 // A notification that a view may issue when it receives first responder status. |
| 52 // The name is |kViewDidBecomeFirstResponder|, the object is the view, and the | 50 // The name is |kViewDidBecomeFirstResponder|, the object is the view, and the |
| 53 // NSSelectionDirection is wrapped in an NSNumber under the key | 51 // NSSelectionDirection is wrapped in an NSNumber under the key |
| 54 // |kSelectionDirection|. | 52 // |kSelectionDirection|. |
| 55 UI_BASE_EXPORT extern NSString* kViewDidBecomeFirstResponder; | 53 UI_BASE_EXPORT extern NSString* kViewDidBecomeFirstResponder; |
| 56 UI_BASE_EXPORT extern NSString* kSelectionDirection; | 54 UI_BASE_EXPORT extern NSString* kSelectionDirection; |
| 57 | 55 |
| 58 #endif // UI_BASE_COCOA_BASE_VIEW_H_ | 56 #endif // UI_BASE_COCOA_BASE_VIEW_H_ |
| OLD | NEW |