Chromium Code Reviews| Index: ui/base/cursor/cursor.h |
| diff --git a/ui/base/cursor/cursor.h b/ui/base/cursor/cursor.h |
| index c04bca7c40c9c68b3a4f4ccf836242d190799ae9..ff09a4e751af471a094e926b0c38635dbac3cf33 100644 |
| --- a/ui/base/cursor/cursor.h |
| +++ b/ui/base/cursor/cursor.h |
| @@ -24,62 +24,63 @@ typedef unsigned long PlatformCursor; |
| typedef void* PlatformCursor; |
| #endif |
| -// TODO(jamescook): Once we're on C++0x we could change these constants |
| -// to an enum and forward declare it in native_widget_types.h. |
| - |
| -// Equivalent to a NULL HCURSOR on Windows. |
| -const int kCursorNull = 0; |
| - |
| -// These cursors mirror WebKit cursors from WebCursorInfo, but are replicated |
| -// here so we don't introduce a WebKit dependency. |
| -const int kCursorPointer = 1; |
| -const int kCursorCross = 2; |
| -const int kCursorHand = 3; |
| -const int kCursorIBeam = 4; |
| -const int kCursorWait = 5; |
| -const int kCursorHelp = 6; |
| -const int kCursorEastResize = 7; |
| -const int kCursorNorthResize = 8; |
| -const int kCursorNorthEastResize = 9; |
| -const int kCursorNorthWestResize = 10; |
| -const int kCursorSouthResize = 11; |
| -const int kCursorSouthEastResize = 12; |
| -const int kCursorSouthWestResize = 13; |
| -const int kCursorWestResize = 14; |
| -const int kCursorNorthSouthResize = 15; |
| -const int kCursorEastWestResize = 16; |
| -const int kCursorNorthEastSouthWestResize = 17; |
| -const int kCursorNorthWestSouthEastResize = 18; |
| -const int kCursorColumnResize = 19; |
| -const int kCursorRowResize = 20; |
| -const int kCursorMiddlePanning = 21; |
| -const int kCursorEastPanning = 22; |
| -const int kCursorNorthPanning = 23; |
| -const int kCursorNorthEastPanning = 24; |
| -const int kCursorNorthWestPanning = 25; |
| -const int kCursorSouthPanning = 26; |
| -const int kCursorSouthEastPanning = 27; |
| -const int kCursorSouthWestPanning = 28; |
| -const int kCursorWestPanning = 29; |
| -const int kCursorMove = 30; |
| -const int kCursorVerticalText = 31; |
| -const int kCursorCell = 32; |
| -const int kCursorContextMenu = 33; |
| -const int kCursorAlias = 34; |
| -const int kCursorProgress = 35; |
| -const int kCursorNoDrop = 36; |
| -const int kCursorCopy = 37; |
| -const int kCursorNone = 38; |
| -const int kCursorNotAllowed = 39; |
| -const int kCursorZoomIn = 40; |
| -const int kCursorZoomOut = 41; |
| -const int kCursorGrab = 42; |
| -const int kCursorGrabbing = 43; |
| -const int kCursorCustom = 44; |
| -const int kCursorDndNone = 45; |
| -const int kCursorDndMove = 46; |
| -const int kCursorDndCopy = 47; |
| -const int kCursorDndLink = 48; |
| +enum class CursorType { |
| + // Equivalent to a NULL HCURSOR on Windows. |
| + CURSOR_NULL = 0, |
|
sky
2017/04/24 20:12:43
Sorry to mention this here, but the new style is k
Elliot Glaysher
2017/04/25 17:16:45
Done.
|
| + |
| + // These cursors mirror WebKit cursors from WebCursorInfo, but are replicated |
| + // here so we don't introduce a WebKit dependency. |
| + POINTER = 1, |
| + CROSS = 2, |
| + HAND = 3, |
| + IBEAM = 4, |
| + WAIT = 5, |
| + HELP = 6, |
| + EAST_RESIZE = 7, |
| + NORTH_RESIZE = 8, |
| + NORTH_EAST_RESIZE = 9, |
| + NORTH_WEST_RESIZE = 10, |
| + SOUTH_RESIZE = 11, |
| + SOUTH_EAST_RESIZE = 12, |
| + SOUTH_WEST_RESIZE = 13, |
| + WEST_RESIZE = 14, |
| + NORTH_SOUTH_RESIZE = 15, |
| + EAST_WEST_RESIZE = 16, |
| + NORTH_EAST_SOUTH_WEST_RESIZE = 17, |
| + NORTH_WEST_SOUTH_EAST_RESIZE = 18, |
| + COLUMN_RESIZE = 19, |
| + ROW_RESIZE = 20, |
| + MIDDLE_PANNING = 21, |
| + EAST_PANNING = 22, |
| + NORTH_PANNING = 23, |
| + NORTH_EAST_PANNING = 24, |
| + NORTH_WEST_PANNING = 25, |
| + SOUTH_PANNING = 26, |
| + SOUTH_EAST_PANNING = 27, |
| + SOUTH_WEST_PANNING = 28, |
| + WEST_PANNING = 29, |
| + MOVE = 30, |
| + VERTICAL_TEXT = 31, |
| + CELL = 32, |
| + CONTEXT_MENU = 33, |
| + ALIAS = 34, |
| + PROGRESS = 35, |
| + NO_DROP = 36, |
| + COPY = 37, |
| + NONE = 38, |
| + NOT_ALLOWED = 39, |
| + ZOOM_IN = 40, |
| + ZOOM_OUT = 41, |
| + GRAB = 42, |
| + GRABBING = 43, |
| + CUSTOM = 44, |
| + |
| + // These additional drag and drop cursors are not listed in WebCursorInfo. |
| + DND_NONE = 45, |
| + DND_MOVE = 46, |
| + DND_COPY = 47, |
| + DND_LINK = 48, |
| +}; |
| enum CursorSetType { |
| CURSOR_SET_NORMAL, |
| @@ -92,7 +93,7 @@ class UI_BASE_EXPORT Cursor { |
| Cursor(); |
| // Implicit constructor. |
| - Cursor(int type); |
| + Cursor(CursorType type); |
|
sky
2017/04/24 20:12:43
explicit (I'm not sure why it wasn't explicit befo
Elliot Glaysher
2017/04/25 17:16:45
This can't be explicit.
gfx::NativeCursor is the
|
| // Allow copy. |
| Cursor(const Cursor& cursor); |
| @@ -104,7 +105,7 @@ class UI_BASE_EXPORT Cursor { |
| void RefCustomCursor(); |
| void UnrefCustomCursor(); |
| - int native_type() const { return native_type_; } |
| + CursorType native_type() const { return native_type_; } |
| PlatformCursor platform() const { return platform_cursor_; } |
| float device_scale_factor() const { |
| return device_scale_factor_; |
| @@ -113,13 +114,13 @@ class UI_BASE_EXPORT Cursor { |
| device_scale_factor_ = device_scale_factor; |
| } |
| - bool operator==(int type) const { return native_type_ == type; } |
| + bool operator==(CursorType type) const { return native_type_ == type; } |
| bool operator==(const Cursor& cursor) const { |
| return native_type_ == cursor.native_type_ && |
| platform_cursor_ == cursor.platform_cursor_ && |
| device_scale_factor_ == cursor.device_scale_factor_; |
| } |
| - bool operator!=(int type) const { return native_type_ != type; } |
| + bool operator!=(CursorType type) const { return native_type_ != type; } |
| bool operator!=(const Cursor& cursor) const { |
| return native_type_ != cursor.native_type_ || |
| platform_cursor_ != cursor.platform_cursor_ || |
| @@ -134,7 +135,7 @@ class UI_BASE_EXPORT Cursor { |
| void Assign(const Cursor& cursor); |
| // See definitions above. |
| - int native_type_; |
| + CursorType native_type_; |
| PlatformCursor platform_cursor_; |