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 #include "ui/base/cursor/image_cursors.h" | 5 #include "ui/base/cursor/image_cursors.h" |
6 | 6 |
7 #include <float.h> | 7 #include <float.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "ui/base/cursor/cursor.h" | 13 #include "ui/base/cursor/cursor.h" |
14 #include "ui/base/cursor/cursor_loader.h" | 14 #include "ui/base/cursor/cursor_loader.h" |
15 #include "ui/base/cursor/cursors_aura.h" | 15 #include "ui/base/cursor/cursors_aura.h" |
16 #include "ui/display/display.h" | 16 #include "ui/display/display.h" |
17 #include "ui/gfx/geometry/point.h" | 17 #include "ui/gfx/geometry/point.h" |
18 | 18 |
19 namespace ui { | 19 namespace ui { |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 const int kImageCursorIds[] = { | 23 const CursorType kImageCursorIds[] = { |
24 kCursorNull, | 24 CursorType::CURSOR_NULL, |
25 kCursorPointer, | 25 CursorType::POINTER, |
26 kCursorNoDrop, | 26 CursorType::NO_DROP, |
27 kCursorNotAllowed, | 27 CursorType::NOT_ALLOWED, |
28 kCursorCopy, | 28 CursorType::COPY, |
29 kCursorHand, | 29 CursorType::HAND, |
30 kCursorMove, | 30 CursorType::MOVE, |
31 kCursorNorthEastResize, | 31 CursorType::NORTH_EAST_RESIZE, |
32 kCursorSouthWestResize, | 32 CursorType::SOUTH_WEST_RESIZE, |
33 kCursorSouthEastResize, | 33 CursorType::SOUTH_EAST_RESIZE, |
34 kCursorNorthWestResize, | 34 CursorType::NORTH_WEST_RESIZE, |
35 kCursorNorthResize, | 35 CursorType::NORTH_RESIZE, |
36 kCursorSouthResize, | 36 CursorType::SOUTH_RESIZE, |
37 kCursorEastResize, | 37 CursorType::EAST_RESIZE, |
38 kCursorWestResize, | 38 CursorType::WEST_RESIZE, |
39 kCursorIBeam, | 39 CursorType::IBEAM, |
40 kCursorAlias, | 40 CursorType::ALIAS, |
41 kCursorCell, | 41 CursorType::CELL, |
42 kCursorContextMenu, | 42 CursorType::CONTEXT_MENU, |
43 kCursorCross, | 43 CursorType::CROSS, |
44 kCursorHelp, | 44 CursorType::HELP, |
45 kCursorVerticalText, | 45 CursorType::VERTICAL_TEXT, |
46 kCursorZoomIn, | 46 CursorType::ZOOM_IN, |
47 kCursorZoomOut, | 47 CursorType::ZOOM_OUT, |
48 kCursorRowResize, | 48 CursorType::ROW_RESIZE, |
49 kCursorColumnResize, | 49 CursorType::COLUMN_RESIZE, |
50 kCursorEastWestResize, | 50 CursorType::EAST_WEST_RESIZE, |
51 kCursorNorthSouthResize, | 51 CursorType::NORTH_SOUTH_RESIZE, |
52 kCursorNorthEastSouthWestResize, | 52 CursorType::NORTH_EAST_SOUTH_WEST_RESIZE, |
53 kCursorNorthWestSouthEastResize, | 53 CursorType::NORTH_WEST_SOUTH_EAST_RESIZE, |
54 kCursorGrab, | 54 CursorType::GRAB, |
55 kCursorGrabbing, | 55 CursorType::GRABBING, |
56 }; | 56 }; |
57 | 57 |
58 const int kAnimatedCursorIds[] = { | 58 const CursorType kAnimatedCursorIds[] = {CursorType::WAIT, |
59 kCursorWait, | 59 CursorType::PROGRESS}; |
60 kCursorProgress | |
61 }; | |
62 | 60 |
63 } // namespace | 61 } // namespace |
64 | 62 |
65 ImageCursors::ImageCursors() : cursor_set_(CURSOR_SET_NORMAL) { | 63 ImageCursors::ImageCursors() : cursor_set_(CURSOR_SET_NORMAL) { |
66 } | 64 } |
67 | 65 |
68 ImageCursors::~ImageCursors() { | 66 ImageCursors::~ImageCursors() { |
69 } | 67 } |
70 | 68 |
71 float ImageCursors::GetScale() const { | 69 float ImageCursors::GetScale() const { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 141 |
144 if (cursor_loader_.get()) | 142 if (cursor_loader_.get()) |
145 ReloadCursors(); | 143 ReloadCursors(); |
146 } | 144 } |
147 | 145 |
148 void ImageCursors::SetPlatformCursor(gfx::NativeCursor* cursor) { | 146 void ImageCursors::SetPlatformCursor(gfx::NativeCursor* cursor) { |
149 cursor_loader_->SetPlatformCursor(cursor); | 147 cursor_loader_->SetPlatformCursor(cursor); |
150 } | 148 } |
151 | 149 |
152 } // namespace ui | 150 } // namespace ui |
OLD | NEW |