mouse_util.cc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. // Copyright (c) 2015 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #include "atom/common/mouse_util.h"
  5. #include <string>
  6. using Cursor = blink::WebCursorInfo::Type;
  7. namespace atom {
  8. std::string CursorTypeToString(const content::CursorInfo& info) {
  9. switch (info.type) {
  10. case Cursor::kTypePointer:
  11. return "default";
  12. case Cursor::kTypeCross:
  13. return "crosshair";
  14. case Cursor::kTypeHand:
  15. return "pointer";
  16. case Cursor::kTypeIBeam:
  17. return "text";
  18. case Cursor::kTypeWait:
  19. return "wait";
  20. case Cursor::kTypeHelp:
  21. return "help";
  22. case Cursor::kTypeEastResize:
  23. return "e-resize";
  24. case Cursor::kTypeNorthResize:
  25. return "n-resize";
  26. case Cursor::kTypeNorthEastResize:
  27. return "ne-resize";
  28. case Cursor::kTypeNorthWestResize:
  29. return "nw-resize";
  30. case Cursor::kTypeSouthResize:
  31. return "s-resize";
  32. case Cursor::kTypeSouthEastResize:
  33. return "se-resize";
  34. case Cursor::kTypeSouthWestResize:
  35. return "sw-resize";
  36. case Cursor::kTypeWestResize:
  37. return "w-resize";
  38. case Cursor::kTypeNorthSouthResize:
  39. return "ns-resize";
  40. case Cursor::kTypeEastWestResize:
  41. return "ew-resize";
  42. case Cursor::kTypeNorthEastSouthWestResize:
  43. return "nesw-resize";
  44. case Cursor::kTypeNorthWestSouthEastResize:
  45. return "nwse-resize";
  46. case Cursor::kTypeColumnResize:
  47. return "col-resize";
  48. case Cursor::kTypeRowResize:
  49. return "row-resize";
  50. case Cursor::kTypeMiddlePanning:
  51. return "m-panning";
  52. case Cursor::kTypeEastPanning:
  53. return "e-panning";
  54. case Cursor::kTypeNorthPanning:
  55. return "n-panning";
  56. case Cursor::kTypeNorthEastPanning:
  57. return "ne-panning";
  58. case Cursor::kTypeNorthWestPanning:
  59. return "nw-panning";
  60. case Cursor::kTypeSouthPanning:
  61. return "s-panning";
  62. case Cursor::kTypeSouthEastPanning:
  63. return "se-panning";
  64. case Cursor::kTypeSouthWestPanning:
  65. return "sw-panning";
  66. case Cursor::kTypeWestPanning:
  67. return "w-panning";
  68. case Cursor::kTypeMove:
  69. return "move";
  70. case Cursor::kTypeVerticalText:
  71. return "vertical-text";
  72. case Cursor::kTypeCell:
  73. return "cell";
  74. case Cursor::kTypeContextMenu:
  75. return "context-menu";
  76. case Cursor::kTypeAlias:
  77. return "alias";
  78. case Cursor::kTypeProgress:
  79. return "progress";
  80. case Cursor::kTypeNoDrop:
  81. return "nodrop";
  82. case Cursor::kTypeCopy:
  83. return "copy";
  84. case Cursor::kTypeNone:
  85. return "none";
  86. case Cursor::kTypeNotAllowed:
  87. return "not-allowed";
  88. case Cursor::kTypeZoomIn:
  89. return "zoom-in";
  90. case Cursor::kTypeZoomOut:
  91. return "zoom-out";
  92. case Cursor::kTypeGrab:
  93. return "grab";
  94. case Cursor::kTypeGrabbing:
  95. return "grabbing";
  96. case Cursor::kTypeCustom:
  97. return "custom";
  98. default:
  99. return "default";
  100. }
  101. }
  102. } // namespace atom