2016-01-31 01:27:14 +00:00
|
|
|
// Copyright (c) 2015 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2018-04-18 01:55:30 +00:00
|
|
|
#include <string>
|
2016-01-31 01:27:14 +00:00
|
|
|
|
2020-03-03 21:35:05 +00:00
|
|
|
#include "shell/common/mouse_util.h"
|
|
|
|
#include "ui/base/mojom/cursor_type.mojom-shared.h"
|
|
|
|
|
|
|
|
using Cursor = ui::mojom::CursorType;
|
2016-01-31 01:27:14 +00:00
|
|
|
|
2019-06-19 21:23:04 +00:00
|
|
|
namespace electron {
|
2016-01-31 01:27:14 +00:00
|
|
|
|
2017-06-16 20:59:57 +00:00
|
|
|
std::string CursorTypeToString(const content::CursorInfo& info) {
|
2016-02-01 06:17:58 +00:00
|
|
|
switch (info.type) {
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kPointer:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "default";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kCross:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "crosshair";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kHand:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "pointer";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kIBeam:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "text";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kWait:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "wait";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kHelp:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "help";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kEastResize:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "e-resize";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kNorthResize:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "n-resize";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kNorthEastResize:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "ne-resize";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kNorthWestResize:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "nw-resize";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kSouthResize:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "s-resize";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kSouthEastResize:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "se-resize";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kSouthWestResize:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "sw-resize";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kWestResize:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "w-resize";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kNorthSouthResize:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "ns-resize";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kEastWestResize:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "ew-resize";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kNorthEastSouthWestResize:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "nesw-resize";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kNorthWestSouthEastResize:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "nwse-resize";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kColumnResize:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "col-resize";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kRowResize:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "row-resize";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kMiddlePanning:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "m-panning";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kEastPanning:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "e-panning";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kNorthPanning:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "n-panning";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kNorthEastPanning:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "ne-panning";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kNorthWestPanning:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "nw-panning";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kSouthPanning:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "s-panning";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kSouthEastPanning:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "se-panning";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kSouthWestPanning:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "sw-panning";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kWestPanning:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "w-panning";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kMove:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "move";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kVerticalText:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "vertical-text";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kCell:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "cell";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kContextMenu:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "context-menu";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kAlias:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "alias";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kProgress:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "progress";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kNoDrop:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "nodrop";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kCopy:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "copy";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kNone:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "none";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kNotAllowed:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "not-allowed";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kZoomIn:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "zoom-in";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kZoomOut:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "zoom-out";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kGrab:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "grab";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kGrabbing:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "grabbing";
|
2019-07-03 01:22:09 +00:00
|
|
|
case Cursor::kCustom:
|
2018-04-18 01:55:30 +00:00
|
|
|
return "custom";
|
|
|
|
default:
|
|
|
|
return "default";
|
2016-01-31 01:27:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-19 21:23:04 +00:00
|
|
|
} // namespace electron
|