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

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: 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
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 namespace ui { 7 namespace ui {
8 8
9 namespace {
10
11 const wchar_t* GetCursorId(gfx::NativeCursor native_cursor) {
12 switch (native_cursor.native_type()) {
13 case kCursorNull:
14 return IDC_ARROW;
15 case kCursorPointer:
16 return IDC_ARROW;
17 case kCursorCross:
18 return IDC_CROSS;
19 case kCursorHand:
20 return IDC_HAND;
21 case kCursorIBeam:
22 return IDC_IBEAM;
23 case kCursorWait:
24 return IDC_WAIT;
25 case kCursorHelp:
26 return IDC_HELP;
27 case kCursorEastResize:
28 return IDC_SIZEWE;
29 case kCursorNorthResize:
30 return IDC_SIZENS;
31 case kCursorNorthEastResize:
32 return IDC_SIZENESW;
33 case kCursorNorthWestResize:
34 return IDC_SIZENWSE;
35 case kCursorSouthResize:
36 return IDC_SIZENS;
37 case kCursorSouthEastResize:
38 return IDC_SIZENWSE;
39 case kCursorSouthWestResize:
40 return IDC_SIZENESW;
41 case kCursorWestResize:
42 return IDC_SIZEWE;
43 case kCursorNorthSouthResize:
44 return IDC_SIZENS;
45 case kCursorEastWestResize:
46 return IDC_SIZEWE;
47 case kCursorNorthEastSouthWestResize:
48 return IDC_SIZENESW;
49 case kCursorNorthWestSouthEastResize:
50 return IDC_SIZENWSE;
51 case kCursorMove:
52 return IDC_SIZEALL;
53 case kCursorProgress:
54 return IDC_APPSTARTING;
55 case kCursorNoDrop:
56 return IDC_NO;
57 case kCursorNotAllowed:
58 return IDC_NO;
59 case kCursorColumnResize:
60 case kCursorRowResize:
61 case kCursorMiddlePanning:
62 case kCursorEastPanning:
63 case kCursorNorthPanning:
64 case kCursorNorthEastPanning:
65 case kCursorNorthWestPanning:
66 case kCursorSouthPanning:
67 case kCursorSouthEastPanning:
68 case kCursorSouthWestPanning:
69 case kCursorWestPanning:
70 case kCursorVerticalText:
71 case kCursorCell:
72 case kCursorContextMenu:
73 case kCursorAlias:
74 case kCursorCopy:
75 case kCursorNone:
76 case kCursorZoomIn:
77 case kCursorZoomOut:
78 case kCursorGrab:
79 case kCursorGrabbing:
80 case kCursorCustom:
81 // TODO(jamescook): Should we use WebKit glue resources for these?
82 // Or migrate those resources to someplace ui/aura can share?
83 NOTIMPLEMENTED();
84 return IDC_ARROW;
85 default:
86 NOTREACHED();
87 return IDC_ARROW;
88 }
89 }
90
91 }
92
9 CursorLoader* CursorLoader::Create() { 93 CursorLoader* CursorLoader::Create() {
10 return new CursorLoaderWin; 94 return new CursorLoaderWin;
11 } 95 }
12 96
13 CursorLoaderWin::CursorLoaderWin() { 97 CursorLoaderWin::CursorLoaderWin() {
14 } 98 }
15 99
16 CursorLoaderWin::~CursorLoaderWin() { 100 CursorLoaderWin::~CursorLoaderWin() {
17 } 101 }
18 102
19 void CursorLoaderWin::LoadImageCursor(int id, 103 void CursorLoaderWin::LoadImageCursor(int id,
20 int resource_id, 104 int resource_id,
21 const gfx::Point& hot) { 105 const gfx::Point& hot) {
22 // NOTIMPLEMENTED(); 106 // NOTIMPLEMENTED();
23 } 107 }
24 108
25 void CursorLoaderWin::LoadAnimatedCursor(int id, 109 void CursorLoaderWin::LoadAnimatedCursor(int id,
26 int resource_id, 110 int resource_id,
27 const gfx::Point& hot, 111 const gfx::Point& hot,
28 int frame_delay_ms) { 112 int frame_delay_ms) {
29 // NOTIMPLEMENTED(); 113 // NOTIMPLEMENTED();
30 } 114 }
31 115
32 void CursorLoaderWin::UnloadAll() { 116 void CursorLoaderWin::UnloadAll() {
33 // NOTIMPLEMENTED(); 117 // NOTIMPLEMENTED();
34 } 118 }
35 119
36 void CursorLoaderWin::SetPlatformCursor(gfx::NativeCursor* cursor) { 120 void CursorLoaderWin::SetPlatformCursor(gfx::NativeCursor* cursor) {
37 // NOTIMPLEMENTED(); 121 const wchar_t* cursor_id = GetCursorId(*cursor);
122
123 // TODO(jamescook): Support for non-system cursors will require finding
124 // the appropriate module to pass to LoadCursor().
125 cursor->SetPlatformCursor(LoadCursor(NULL, cursor_id));
38 } 126 }
39 127
40 } // namespace ui 128 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698