OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_VIEWS_COCOA_VIEWS_NSWINDOW_DELEGATE_H_ | 5 #ifndef UI_VIEWS_COCOA_VIEWS_NSWINDOW_DELEGATE_H_ |
6 #define UI_VIEWS_COCOA_VIEWS_NSWINDOW_DELEGATE_H_ | 6 #define UI_VIEWS_COCOA_VIEWS_NSWINDOW_DELEGATE_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
| 10 #import "base/mac/scoped_nsobject.h" |
| 11 |
10 namespace views { | 12 namespace views { |
11 class NativeWidgetMac; | 13 class NativeWidgetMac; |
12 class BridgedNativeWidget; | 14 class BridgedNativeWidget; |
13 } | 15 } |
14 | 16 |
15 // The delegate set on the NSWindow when a views::BridgedNativeWidget is | 17 // The delegate set on the NSWindow when a views::BridgedNativeWidget is |
16 // initialized. | 18 // initialized. |
17 @interface ViewsNSWindowDelegate : NSObject<NSWindowDelegate> { | 19 @interface ViewsNSWindowDelegate : NSObject<NSWindowDelegate> { |
18 @private | 20 @private |
19 views::BridgedNativeWidget* parent_; // Weak. Owns this. | 21 views::BridgedNativeWidget* parent_; // Weak. Owns this. |
| 22 base::scoped_nsobject<NSCursor> cursor_; |
20 } | 23 } |
21 | 24 |
22 // The NativeWidgetMac that created the window this is attached to. Returns | 25 // The NativeWidgetMac that created the window this is attached to. Returns |
23 // NULL if not created by NativeWidgetMac. | 26 // NULL if not created by NativeWidgetMac. |
24 @property(nonatomic, readonly) views::NativeWidgetMac* nativeWidgetMac; | 27 @property(nonatomic, readonly) views::NativeWidgetMac* nativeWidgetMac; |
25 | 28 |
| 29 // If set, the cursor set in -[NSResponder updateCursor:] when the window is |
| 30 // reached along the responder chain. |
| 31 @property(retain, nonatomic) NSCursor* cursor; |
| 32 |
26 // Initialize with the given |parent|. | 33 // Initialize with the given |parent|. |
27 - (id)initWithBridgedNativeWidget:(views::BridgedNativeWidget*)parent; | 34 - (id)initWithBridgedNativeWidget:(views::BridgedNativeWidget*)parent; |
28 | 35 |
29 // Notify that the window is about to be reordered on screen. This ensures a | 36 // Notify that the window is about to be reordered on screen. This ensures a |
30 // paint will occur, even if Cocoa has not yet updated the window visibility. | 37 // paint will occur, even if Cocoa has not yet updated the window visibility. |
31 - (void)onWindowOrderWillChange:(NSWindowOrderingMode)orderingMode; | 38 - (void)onWindowOrderWillChange:(NSWindowOrderingMode)orderingMode; |
32 | 39 |
33 // Notify that the window has been reordered in (or removed from) the window | 40 // Notify that the window has been reordered in (or removed from) the window |
34 // server's screen list. This is a substitute for -[NSWindowDelegate | 41 // server's screen list. This is a substitute for -[NSWindowDelegate |
35 // windowDidExpose:], which is only sent for nonretained windows (those without | 42 // windowDidExpose:], which is only sent for nonretained windows (those without |
36 // a backing store). |notification| is optional and can be set when redirecting | 43 // a backing store). |notification| is optional and can be set when redirecting |
37 // a notification such as NSApplicationDidHideNotification. | 44 // a notification such as NSApplicationDidHideNotification. |
38 - (void)onWindowOrderChanged:(NSNotification*)notification; | 45 - (void)onWindowOrderChanged:(NSNotification*)notification; |
39 | 46 |
40 // Notify when -[NSWindow display] is being called on the window. | 47 // Notify when -[NSWindow display] is being called on the window. |
41 - (void)onWindowWillDisplay; | 48 - (void)onWindowWillDisplay; |
42 | 49 |
43 @end | 50 @end |
44 | 51 |
45 #endif // UI_VIEWS_COCOA_VIEWS_NSWINDOW_DELEGATE_H_ | 52 #endif // UI_VIEWS_COCOA_VIEWS_NSWINDOW_DELEGATE_H_ |
OLD | NEW |