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

Side by Side Diff: ui/base/cursor/cursor_loader_win.cc

Issue 10939006: Make cursors work on win aura. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « ui/base/cursor/cursor_loader_win.h ('k') | ui/views/view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "ui/base/cursor/cursor_loader_win.h" 5 #include "ui/base/cursor/cursor_loader_win.h"
6 6
7 #include "ui/base/cursor/cursor.h"
8
7 namespace ui { 9 namespace ui {
8 10
11 #if defined(USE_AURA)
12
13 namespace {
14
15 const wchar_t* GetCursorId(gfx::NativeCursor native_cursor) {
16 switch (native_cursor.native_type()) {
17 case kCursorNull:
18 return IDC_ARROW;
19 case kCursorPointer:
20 return IDC_ARROW;
21 case kCursorCross:
22 return IDC_CROSS;
23 case kCursorHand:
24 return IDC_HAND;
25 case kCursorIBeam:
26 return IDC_IBEAM;
27 case kCursorWait:
28 return IDC_WAIT;
29 case kCursorHelp:
30 return IDC_HELP;
31 case kCursorEastResize:
32 return IDC_SIZEWE;
33 case kCursorNorthResize:
34 return IDC_SIZENS;
35 case kCursorNorthEastResize:
36 return IDC_SIZENESW;
37 case kCursorNorthWestResize:
38 return IDC_SIZENWSE;
39 case kCursorSouthResize:
40 return IDC_SIZENS;
41 case kCursorSouthEastResize:
42 return IDC_SIZENWSE;
43 case kCursorSouthWestResize:
44 return IDC_SIZENESW;
45 case kCursorWestResize:
46 return IDC_SIZEWE;
47 case kCursorNorthSouthResize:
48 return IDC_SIZENS;
49 case kCursorEastWestResize:
50 return IDC_SIZEWE;
51 case kCursorNorthEastSouthWestResize:
52 return IDC_SIZENESW;
53 case kCursorNorthWestSouthEastResize:
54 return IDC_SIZENWSE;
55 case kCursorMove:
56 return IDC_SIZEALL;
57 case kCursorProgress:
58 return IDC_APPSTARTING;
59 case kCursorNoDrop:
60 return IDC_NO;
61 case kCursorNotAllowed:
62 return IDC_NO;
63 case kCursorColumnResize:
64 case kCursorRowResize:
65 case kCursorMiddlePanning:
66 case kCursorEastPanning:
67 case kCursorNorthPanning:
68 case kCursorNorthEastPanning:
69 case kCursorNorthWestPanning:
70 case kCursorSouthPanning:
71 case kCursorSouthEastPanning:
72 case kCursorSouthWestPanning:
73 case kCursorWestPanning:
74 case kCursorVerticalText:
75 case kCursorCell:
76 case kCursorContextMenu:
77 case kCursorAlias:
78 case kCursorCopy:
79 case kCursorNone:
80 case kCursorZoomIn:
81 case kCursorZoomOut:
82 case kCursorGrab:
83 case kCursorGrabbing:
84 case kCursorCustom:
85 // TODO(jamescook): Should we use WebKit glue resources for these?
86 // Or migrate those resources to someplace ui/aura can share?
87 NOTIMPLEMENTED();
88 return IDC_ARROW;
89 default:
90 NOTREACHED();
91 return IDC_ARROW;
92 }
93 }
94
95 } // namespace
96
97 #endif
98
9 CursorLoader* CursorLoader::Create() { 99 CursorLoader* CursorLoader::Create() {
10 return new CursorLoaderWin; 100 return new CursorLoaderWin;
11 } 101 }
12 102
13 CursorLoaderWin::CursorLoaderWin() { 103 CursorLoaderWin::CursorLoaderWin() {
14 } 104 }
15 105
16 CursorLoaderWin::~CursorLoaderWin() { 106 CursorLoaderWin::~CursorLoaderWin() {
17 } 107 }
18 108
19 void CursorLoaderWin::LoadImageCursor(int id, 109 void CursorLoaderWin::LoadImageCursor(int id,
20 int resource_id, 110 int resource_id,
21 const gfx::Point& hot) { 111 const gfx::Point& hot) {
22 // NOTIMPLEMENTED(); 112 // NOTIMPLEMENTED();
23 } 113 }
24 114
25 void CursorLoaderWin::LoadAnimatedCursor(int id, 115 void CursorLoaderWin::LoadAnimatedCursor(int id,
26 int resource_id, 116 int resource_id,
27 const gfx::Point& hot, 117 const gfx::Point& hot,
28 int frame_delay_ms) { 118 int frame_delay_ms) {
29 // NOTIMPLEMENTED(); 119 // NOTIMPLEMENTED();
30 } 120 }
31 121
32 void CursorLoaderWin::UnloadAll() { 122 void CursorLoaderWin::UnloadAll() {
33 // NOTIMPLEMENTED(); 123 // NOTIMPLEMENTED();
34 } 124 }
35 125
36 void CursorLoaderWin::SetPlatformCursor(gfx::NativeCursor* cursor) { 126 void CursorLoaderWin::SetPlatformCursor(gfx::NativeCursor* cursor) {
37 // NOTIMPLEMENTED(); 127 #if defined(USE_AURA)
128 const wchar_t* cursor_id = GetCursorId(*cursor);
129
130 // TODO(jamescook): Support for non-system cursors will require finding
131 // the appropriate module to pass to LoadCursor().
132 cursor->SetPlatformCursor(LoadCursor(NULL, cursor_id));
133 #endif
38 } 134 }
39 135
40 } // namespace ui 136 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/cursor/cursor_loader_win.h ('k') | ui/views/view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698