PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llui/lltextutil.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 81 lines | 22 code | 12 blank | 47 comment | 0 complexity | 06b22ee0d4d1868ffbd9385f36fb6249 MD5 | raw file
 1/** 
 2 * @file lltextutil.h
 3 * @brief Misc text-related auxiliary methods
 4 *
 5 * $LicenseInfo:firstyear=2009&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#ifndef LL_LLTEXTUTIL_H
28#define LL_LLTEXTUTIL_H
29
30#include "llstyle.h"
31
32class LLTextBox;
33class LLUrlMatch;
34class LLTextBase;
35
36namespace LLTextUtil
37{
38
39	/**
40	 * Set value for text box, highlighting substring hl_uc.
41	 * 
42	 * Used to highlight filter matches.
43	 * 
44	 * @param txtbox        Text box to set value for
45	 * @param normal_style  Style to use for non-highlighted text
46	 * @param text          Text to set
47	 * @param hl            Upper-cased string to highlight
48	 */
49	void textboxSetHighlightedVal(
50		LLTextBox *txtbox,
51		const LLStyle::Params& normal_style,
52		const std::string& text,
53		const std::string& hl);
54
55	/**
56	 * Formats passed phone number to be more human readable.
57	 *
58	 * It just divides the number on parts by two digits from right to left. The first left part
59	 * can have 2 or 3 digits, i.e. +44-33-33-44-55-66 or 12-34-56-78-90. Separator is set in
60	 * application settings (AvalinePhoneSeparator)
61	 *
62	 * @param[in] phone_str string with original phone number
63	 * @return reference to string with formatted phone number
64	 */
65	const std::string& formatPhoneNumber(const std::string& phone_str);
66
67	bool processUrlMatch(LLUrlMatch* match,LLTextBase* text_base);
68
69	class TextHelpers
70	{
71
72		//we need this special callback since we need to create LLAvataIconCtrls while parsing
73		//avatar/group url but can't create LLAvataIconCtrl from LLUI
74		public:
75			static boost::function<bool(LLUrlMatch*,LLTextBase*)> iconCallbackCreationFunction;
76	};
77
78	
79}
80
81#endif // LL_LLTEXTUTIL_H