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

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: fix win build 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 #include "ui/base/cursor/cursor.h"
8
7 namespace ui { 9 namespace ui {
8 10
11 namespace {
12
13 const wchar_t* GetCursorId(gfx::NativeCursor native_cursor) {
14 #if defined(USE_AURA)
15 switch (native_cursor.native_type()) {
16 case kCursorNull:
17 return IDC_ARROW;
18 case kCursorPointer:
19 return IDC_ARROW;
20 case kCursorCross:
21 return IDC_CROSS;
22 case kCursorHand:
23 return IDC_HAND;
24 case kCursorIBeam:
25 return IDC_IBEAM;
26 case kCursorWait:
27 return IDC_WAIT;
28 case kCursorHelp:
29 return IDC_HELP;
30 case kCursorEastResize:
31 return IDC_SIZEWE;
32 case kCursorNorthResize:
33 return IDC_SIZENS;
34 case kCursorNorthEastResize:
35 return IDC_SIZENESW;
36 case kCursorNorthWestResize:
37 return IDC_SIZENWSE;
38 case kCursorSouthResize:
39 return IDC_SIZENS;
40 case kCursorSouthEastResize:
41 return IDC_SIZENWSE;
42 case kCursorSouthWestResize:
43 return IDC_SIZENESW;
44 case kCursorWestResize:
45 return IDC_SIZEWE;
46 case kCursorNorthSouthResize:
47 return IDC_SIZENS;
48 case kCursorEastWestResize:
49 return IDC_SIZEWE;
50 case kCursorNorthEastSouthWestResize:
51 return IDC_SIZENESW;
52 case kCursorNorthWestSouthEastResize:
53 return IDC_SIZENWSE;
54 case kCursorMove:
55 return IDC_SIZEALL;
56 case kCursorProgress:
57 return IDC_APPSTARTING;
58 case kCursorNoDrop:
59 return IDC_NO;
60 case kCursorNotAllowed:
61 return IDC_NO;
62 case kCursorColumnResize:
63 case kCursorRowResize:
64 case kCursorMiddlePanning:
65 case kCursorEastPanning:
66 case kCursorNorthPanning:
67 case kCursorNorthEastPanning:
68 case kCursorNorthWestPanning:
69 case kCursorSouthPanning:
70 case kCursorSouthEastPanning:
71 case kCursorSouthWestPanning:
72 case kCursorWestPanning:
73 case kCursorVerticalText:
74 case kCursorCell:
75 case kCursorContextMenu:
76 case kCursorAlias:
77 case kCursorCopy:
78 case kCursorNone:
79 case kCursorZoomIn:
80 case kCursorZoomOut:
81 case kCursorGrab:
82 case kCursorGrabbing:
83 case kCursorCustom:
84 // TODO(jamescook): Should we use WebKit glue resources for these?
85 // Or migrate those resources to someplace ui/aura can share?
86 NOTIMPLEMENTED();
87 return IDC_ARROW;
88 default:
89 NOTREACHED();
90 return IDC_ARROW;
91 }
92 #else
93 return native_cursor;
94 #endif
95 }
96
97 }
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 const wchar_t* cursor_id = GetCursorId(*cursor);
128
129 // TODO(jamescook): Support for non-system cursors will require finding
130 // the appropriate module to pass to LoadCursor().
131 cursor->SetPlatformCursor(LoadCursor(NULL, cursor_id));
38 } 132 }
39 133
40 } // namespace ui 134 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698