PageRenderTime 82ms CodeModel.GetById 71ms app.highlight 9ms RepoModel.GetById 1ms 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
 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
27#include "linden_common.h"
28
29#include "llcursortypes.h"
30
31ECursorType getCursorFromString(const std::string& cursor_string)
32{
33	static std::map<std::string,U32> cursor_string_table;
34	if (cursor_string_table.empty())
35	{
36		cursor_string_table["UI_CURSOR_ARROW"] = UI_CURSOR_ARROW;
37		cursor_string_table["UI_CURSOR_WAIT"] = UI_CURSOR_WAIT;
38		cursor_string_table["UI_CURSOR_HAND"] = UI_CURSOR_HAND;
39		cursor_string_table["UI_CURSOR_IBEAM"] = UI_CURSOR_IBEAM;
40		cursor_string_table["UI_CURSOR_CROSS"] = UI_CURSOR_CROSS;
41		cursor_string_table["UI_CURSOR_SIZENWSE"] = UI_CURSOR_SIZENWSE;
42		cursor_string_table["UI_CURSOR_SIZENESW"] = UI_CURSOR_SIZENESW;
43		cursor_string_table["UI_CURSOR_SIZEWE"] = UI_CURSOR_SIZEWE;
44		cursor_string_table["UI_CURSOR_SIZENS"] = UI_CURSOR_SIZENS;
45		cursor_string_table["UI_CURSOR_NO"] = UI_CURSOR_NO;
46		cursor_string_table["UI_CURSOR_WORKING"] = UI_CURSOR_WORKING;
47		cursor_string_table["UI_CURSOR_TOOLGRAB"] = UI_CURSOR_TOOLGRAB;
48		cursor_string_table["UI_CURSOR_TOOLLAND"] = UI_CURSOR_TOOLLAND;
49		cursor_string_table["UI_CURSOR_TOOLFOCUS"] = UI_CURSOR_TOOLFOCUS;
50		cursor_string_table["UI_CURSOR_TOOLCREATE"] = UI_CURSOR_TOOLCREATE;
51		cursor_string_table["UI_CURSOR_ARROWDRAG"] = UI_CURSOR_ARROWDRAG;
52		cursor_string_table["UI_CURSOR_ARROWCOPY"] = UI_CURSOR_ARROWCOPY;
53		cursor_string_table["UI_CURSOR_ARROWDRAGMULTI"] = UI_CURSOR_ARROWDRAGMULTI;
54		cursor_string_table["UI_CURSOR_ARROWCOPYMULTI"] = UI_CURSOR_ARROWCOPYMULTI;
55		cursor_string_table["UI_CURSOR_NOLOCKED"] = UI_CURSOR_NOLOCKED;
56		cursor_string_table["UI_CURSOR_ARROWLOCKED"] = UI_CURSOR_ARROWLOCKED;
57		cursor_string_table["UI_CURSOR_GRABLOCKED"] = UI_CURSOR_GRABLOCKED;
58		cursor_string_table["UI_CURSOR_TOOLTRANSLATE"] = UI_CURSOR_TOOLTRANSLATE;
59		cursor_string_table["UI_CURSOR_TOOLROTATE"] = UI_CURSOR_TOOLROTATE;
60		cursor_string_table["UI_CURSOR_TOOLSCALE"] = UI_CURSOR_TOOLSCALE;
61		cursor_string_table["UI_CURSOR_TOOLCAMERA"] = UI_CURSOR_TOOLCAMERA;
62		cursor_string_table["UI_CURSOR_TOOLPAN"] = UI_CURSOR_TOOLPAN;
63		cursor_string_table["UI_CURSOR_TOOLZOOMIN"] = UI_CURSOR_TOOLZOOMIN;
64		cursor_string_table["UI_CURSOR_TOOLPICKOBJECT3"] = UI_CURSOR_TOOLPICKOBJECT3;
65		cursor_string_table["UI_CURSOR_TOOLPLAY"] = UI_CURSOR_TOOLPLAY;
66		cursor_string_table["UI_CURSOR_TOOLPAUSE"] = UI_CURSOR_TOOLPAUSE;
67		cursor_string_table["UI_CURSOR_TOOLMEDIAOPEN"] = UI_CURSOR_TOOLMEDIAOPEN;
68		cursor_string_table["UI_CURSOR_PIPETTE"] = UI_CURSOR_PIPETTE;
69		cursor_string_table["UI_CURSOR_TOOLSIT"] = UI_CURSOR_TOOLSIT;
70		cursor_string_table["UI_CURSOR_TOOLBUY"] = UI_CURSOR_TOOLBUY;
71		cursor_string_table["UI_CURSOR_TOOLOPEN"] = UI_CURSOR_TOOLOPEN;
72	}
73
74	std::map<std::string,U32>::const_iterator iter = cursor_string_table.find(cursor_string);
75	
76	if (iter != cursor_string_table.end())
77	{
78		return (ECursorType)iter->second;
79	}
80
81	return UI_CURSOR_ARROW;
82}
83
84
85