Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Side by Side Diff: ui/views/cocoa/views_nswindow_delegate.mm

Issue 891003004: MacViews: Implement SetCursor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20150129-MacViews-Bringup5
Patch Set: cl format Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #import "ui/views/cocoa/views_nswindow_delegate.h" 5 #import "ui/views/cocoa/views_nswindow_delegate.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #import "ui/views/cocoa/bridged_content_view.h" 8 #import "ui/views/cocoa/bridged_content_view.h"
9 #import "ui/views/cocoa/bridged_native_widget.h" 9 #import "ui/views/cocoa/bridged_native_widget.h"
10 #include "ui/views/widget/native_widget_mac.h" 10 #include "ui/views/widget/native_widget_mac.h"
11 11
12 @implementation ViewsNSWindowDelegate 12 @implementation ViewsNSWindowDelegate
13 13
14 - (id)initWithBridgedNativeWidget:(views::BridgedNativeWidget*)parent { 14 - (id)initWithBridgedNativeWidget:(views::BridgedNativeWidget*)parent {
15 DCHECK(parent); 15 DCHECK(parent);
16 if ((self = [super init])) { 16 if ((self = [super init])) {
17 parent_ = parent; 17 parent_ = parent;
18 } 18 }
19 return self; 19 return self;
20 } 20 }
21 21
22 - (views::NativeWidgetMac*)nativeWidgetMac { 22 - (views::NativeWidgetMac*)nativeWidgetMac {
23 return parent_->native_widget_mac(); 23 return parent_->native_widget_mac();
24 } 24 }
25 25
26 - (NSCursor*)cursor {
27 return cursor_.get();
28 }
29
30 - (void)setCursor:(NSCursor*)newCursor {
31 if (cursor_.get() == newCursor)
32 return;
33
34 cursor_.reset([newCursor retain]);
35 [parent_->ns_window() resetCursorRects];
36 }
37
26 - (void)onWindowOrderWillChange:(NSWindowOrderingMode)orderingMode { 38 - (void)onWindowOrderWillChange:(NSWindowOrderingMode)orderingMode {
27 parent_->OnVisibilityChangedTo(orderingMode != NSWindowOut); 39 parent_->OnVisibilityChangedTo(orderingMode != NSWindowOut);
28 } 40 }
29 41
30 - (void)onWindowOrderChanged:(NSNotification*)notification { 42 - (void)onWindowOrderChanged:(NSNotification*)notification {
31 parent_->OnVisibilityChanged(); 43 parent_->OnVisibilityChanged();
32 } 44 }
33 45
34 - (void)onWindowWillDisplay { 46 - (void)onWindowWillDisplay {
35 parent_->OnVisibilityChangedTo(true); 47 parent_->OnVisibilityChangedTo(true);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 103
92 - (void)windowWillExitFullScreen:(NSNotification*)notification { 104 - (void)windowWillExitFullScreen:(NSNotification*)notification {
93 parent_->OnFullscreenTransitionStart(false); 105 parent_->OnFullscreenTransitionStart(false);
94 } 106 }
95 107
96 - (void)windowDidExitFullScreen:(NSNotification*)notification { 108 - (void)windowDidExitFullScreen:(NSNotification*)notification {
97 parent_->OnFullscreenTransitionComplete(false); 109 parent_->OnFullscreenTransitionComplete(false);
98 } 110 }
99 111
100 @end 112 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698