OLD | NEW |
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 #ifndef UI_BASE_CURSOR_CURSOR_H_ | 5 #ifndef UI_BASE_CURSOR_CURSOR_H_ |
6 #define UI_BASE_CURSOR_CURSOR_H_ | 6 #define UI_BASE_CURSOR_CURSOR_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "ui/base/cursor/cursor_type.h" |
9 #include "ui/base/ui_base_export.h" | 10 #include "ui/base/ui_base_export.h" |
10 | 11 |
11 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
12 typedef struct HINSTANCE__* HINSTANCE; | 13 typedef struct HINSTANCE__* HINSTANCE; |
13 typedef struct HICON__* HICON; | 14 typedef struct HICON__* HICON; |
14 typedef HICON HCURSOR; | 15 typedef HICON HCURSOR; |
15 #endif | 16 #endif |
16 | 17 |
17 namespace ui { | 18 namespace ui { |
18 | 19 |
19 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
20 typedef ::HCURSOR PlatformCursor; | 21 typedef ::HCURSOR PlatformCursor; |
21 #elif defined(USE_X11) | 22 #elif defined(USE_X11) |
22 typedef unsigned long PlatformCursor; | 23 typedef unsigned long PlatformCursor; |
23 #else | 24 #else |
24 typedef void* PlatformCursor; | 25 typedef void* PlatformCursor; |
25 #endif | 26 #endif |
26 | 27 |
27 enum class CursorType { | |
28 // Equivalent to a NULL HCURSOR on Windows. | |
29 kNull = 0, | |
30 | |
31 // These cursors mirror WebKit cursors from WebCursorInfo, but are replicated | |
32 // here so we don't introduce a WebKit dependency. | |
33 kPointer = 1, | |
34 kCross = 2, | |
35 kHand = 3, | |
36 kIBeam = 4, | |
37 kWait = 5, | |
38 kHelp = 6, | |
39 kEastResize = 7, | |
40 kNorthResize = 8, | |
41 kNorthEastResize = 9, | |
42 kNorthWestResize = 10, | |
43 kSouthResize = 11, | |
44 kSouthEastResize = 12, | |
45 kSouthWestResize = 13, | |
46 kWestResize = 14, | |
47 kNorthSouthResize = 15, | |
48 kEastWestResize = 16, | |
49 kNorthEastSouthWestResize = 17, | |
50 kNorthWestSouthEastResize = 18, | |
51 kColumnResize = 19, | |
52 kRowResize = 20, | |
53 kMiddlePanning = 21, | |
54 kEastPanning = 22, | |
55 kNorthPanning = 23, | |
56 kNorthEastPanning = 24, | |
57 kNorthWestPanning = 25, | |
58 kSouthPanning = 26, | |
59 kSouthEastPanning = 27, | |
60 kSouthWestPanning = 28, | |
61 kWestPanning = 29, | |
62 kMove = 30, | |
63 kVerticalText = 31, | |
64 kCell = 32, | |
65 kContextMenu = 33, | |
66 kAlias = 34, | |
67 kProgress = 35, | |
68 kNoDrop = 36, | |
69 kCopy = 37, | |
70 kNone = 38, | |
71 kNotAllowed = 39, | |
72 kZoomIn = 40, | |
73 kZoomOut = 41, | |
74 kGrab = 42, | |
75 kGrabbing = 43, | |
76 kCustom = 44, | |
77 | |
78 // These additional drag and drop cursors are not listed in WebCursorInfo. | |
79 kDndNone = 45, | |
80 kDndMove = 46, | |
81 kDndCopy = 47, | |
82 kDndLink = 48, | |
83 }; | |
84 | |
85 enum CursorSetType { | |
86 CURSOR_SET_NORMAL, | |
87 CURSOR_SET_LARGE | |
88 }; | |
89 | |
90 // Ref-counted cursor that supports both default and custom cursors. | 28 // Ref-counted cursor that supports both default and custom cursors. |
91 class UI_BASE_EXPORT Cursor { | 29 class UI_BASE_EXPORT Cursor { |
92 public: | 30 public: |
93 Cursor(); | 31 Cursor(); |
94 | 32 |
95 // Implicit constructor. | 33 // Implicit constructor. |
96 Cursor(CursorType type); | 34 Cursor(CursorType type); |
97 | 35 |
98 // Allow copy. | 36 // Allow copy. |
99 Cursor(const Cursor& cursor); | 37 Cursor(const Cursor& cursor); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 77 |
140 PlatformCursor platform_cursor_; | 78 PlatformCursor platform_cursor_; |
141 | 79 |
142 // The device scale factor for the cursor. | 80 // The device scale factor for the cursor. |
143 float device_scale_factor_; | 81 float device_scale_factor_; |
144 }; | 82 }; |
145 | 83 |
146 } // namespace ui | 84 } // namespace ui |
147 | 85 |
148 #endif // UI_BASE_CURSOR_CURSOR_H_ | 86 #endif // UI_BASE_CURSOR_CURSOR_H_ |
OLD | NEW |