PageRenderTime 49ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llcommon/llcursortypes.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 85 lines | 51 code | 9 blank | 25 comment | 3 complexity | 9b66128de38810f5a941014bb50d8b87 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llcursortypes.cpp
  3. * @brief Cursor types and lookup of types from a string
  4. *
  5. * $LicenseInfo:firstyear=2008&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #include "linden_common.h"
  27. #include "llcursortypes.h"
  28. ECursorType getCursorFromString(const std::string& cursor_string)
  29. {
  30. static std::map<std::string,U32> cursor_string_table;
  31. if (cursor_string_table.empty())
  32. {
  33. cursor_string_table["UI_CURSOR_ARROW"] = UI_CURSOR_ARROW;
  34. cursor_string_table["UI_CURSOR_WAIT"] = UI_CURSOR_WAIT;
  35. cursor_string_table["UI_CURSOR_HAND"] = UI_CURSOR_HAND;
  36. cursor_string_table["UI_CURSOR_IBEAM"] = UI_CURSOR_IBEAM;
  37. cursor_string_table["UI_CURSOR_CROSS"] = UI_CURSOR_CROSS;
  38. cursor_string_table["UI_CURSOR_SIZENWSE"] = UI_CURSOR_SIZENWSE;
  39. cursor_string_table["UI_CURSOR_SIZENESW"] = UI_CURSOR_SIZENESW;
  40. cursor_string_table["UI_CURSOR_SIZEWE"] = UI_CURSOR_SIZEWE;
  41. cursor_string_table["UI_CURSOR_SIZENS"] = UI_CURSOR_SIZENS;
  42. cursor_string_table["UI_CURSOR_NO"] = UI_CURSOR_NO;
  43. cursor_string_table["UI_CURSOR_WORKING"] = UI_CURSOR_WORKING;
  44. cursor_string_table["UI_CURSOR_TOOLGRAB"] = UI_CURSOR_TOOLGRAB;
  45. cursor_string_table["UI_CURSOR_TOOLLAND"] = UI_CURSOR_TOOLLAND;
  46. cursor_string_table["UI_CURSOR_TOOLFOCUS"] = UI_CURSOR_TOOLFOCUS;
  47. cursor_string_table["UI_CURSOR_TOOLCREATE"] = UI_CURSOR_TOOLCREATE;
  48. cursor_string_table["UI_CURSOR_ARROWDRAG"] = UI_CURSOR_ARROWDRAG;
  49. cursor_string_table["UI_CURSOR_ARROWCOPY"] = UI_CURSOR_ARROWCOPY;
  50. cursor_string_table["UI_CURSOR_ARROWDRAGMULTI"] = UI_CURSOR_ARROWDRAGMULTI;
  51. cursor_string_table["UI_CURSOR_ARROWCOPYMULTI"] = UI_CURSOR_ARROWCOPYMULTI;
  52. cursor_string_table["UI_CURSOR_NOLOCKED"] = UI_CURSOR_NOLOCKED;
  53. cursor_string_table["UI_CURSOR_ARROWLOCKED"] = UI_CURSOR_ARROWLOCKED;
  54. cursor_string_table["UI_CURSOR_GRABLOCKED"] = UI_CURSOR_GRABLOCKED;
  55. cursor_string_table["UI_CURSOR_TOOLTRANSLATE"] = UI_CURSOR_TOOLTRANSLATE;
  56. cursor_string_table["UI_CURSOR_TOOLROTATE"] = UI_CURSOR_TOOLROTATE;
  57. cursor_string_table["UI_CURSOR_TOOLSCALE"] = UI_CURSOR_TOOLSCALE;
  58. cursor_string_table["UI_CURSOR_TOOLCAMERA"] = UI_CURSOR_TOOLCAMERA;
  59. cursor_string_table["UI_CURSOR_TOOLPAN"] = UI_CURSOR_TOOLPAN;
  60. cursor_string_table["UI_CURSOR_TOOLZOOMIN"] = UI_CURSOR_TOOLZOOMIN;
  61. cursor_string_table["UI_CURSOR_TOOLPICKOBJECT3"] = UI_CURSOR_TOOLPICKOBJECT3;
  62. cursor_string_table["UI_CURSOR_TOOLPLAY"] = UI_CURSOR_TOOLPLAY;
  63. cursor_string_table["UI_CURSOR_TOOLPAUSE"] = UI_CURSOR_TOOLPAUSE;
  64. cursor_string_table["UI_CURSOR_TOOLMEDIAOPEN"] = UI_CURSOR_TOOLMEDIAOPEN;
  65. cursor_string_table["UI_CURSOR_PIPETTE"] = UI_CURSOR_PIPETTE;
  66. cursor_string_table["UI_CURSOR_TOOLSIT"] = UI_CURSOR_TOOLSIT;
  67. cursor_string_table["UI_CURSOR_TOOLBUY"] = UI_CURSOR_TOOLBUY;
  68. cursor_string_table["UI_CURSOR_TOOLOPEN"] = UI_CURSOR_TOOLOPEN;
  69. }
  70. std::map<std::string,U32>::const_iterator iter = cursor_string_table.find(cursor_string);
  71. if (iter != cursor_string_table.end())
  72. {
  73. return (ECursorType)iter->second;
  74. }
  75. return UI_CURSOR_ARROW;
  76. }