summaryrefslogtreecommitdiff
path: root/indra/llui/lltextutil.cpp
diff options
context:
space:
mode:
authorVadim Savchuk <vsavchuk@productengine.com>2010-07-08 14:32:45 +0300
committerVadim Savchuk <vsavchuk@productengine.com>2010-07-08 14:32:45 +0300
commit222cd49ad556b883168b57c7f8839a4887864602 (patch)
tree39ff74fee67d6ba0f0f9524d910bb3d3ae1870b8 /indra/llui/lltextutil.cpp
parent510958f6c4f4f1c1377fec0e484d7ef4d1d95030 (diff)
parent8cda9a026691690fd7e4bb0013cbccc287ef96d5 (diff)
Merge from default branch
--HG-- branch : product-engine
Diffstat (limited to 'indra/llui/lltextutil.cpp')
-rw-r--r--indra/llui/lltextutil.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/indra/llui/lltextutil.cpp b/indra/llui/lltextutil.cpp
index c5f3929fb1..56664071b7 100644
--- a/indra/llui/lltextutil.cpp
+++ b/indra/llui/lltextutil.cpp
@@ -34,7 +34,9 @@
#include "lluicolor.h"
#include "lltextbox.h"
+#include "llurlmatch.h"
+boost::function<bool(LLUrlMatch*,LLTextBase*)> LLTextUtil::TextHelpers::iconCallbackCreationFunction = 0;
void LLTextUtil::textboxSetHighlightedVal(LLTextBox *txtbox, const LLStyle::Params& normal_style, const std::string& text, const std::string& hl)
{
@@ -76,4 +78,36 @@ const std::string& LLTextUtil::formatPhoneNumber(const std::string& phone_str)
return formatted_phone_str;
}
+bool LLTextUtil::processUrlMatch(LLUrlMatch* match,LLTextBase* text_base)
+{
+ if (match == 0 || text_base == 0)
+ return false;
+
+ if(match->getID() != LLUUID::null && TextHelpers::iconCallbackCreationFunction)
+ {
+ bool segment_created = TextHelpers::iconCallbackCreationFunction(match,text_base);
+ if(segment_created)
+ return true;
+ }
+
+ // output an optional icon before the Url
+ if (!match->getIcon().empty() )
+ {
+ LLUIImagePtr image = LLUI::getUIImage(match->getIcon());
+ if (image)
+ {
+ LLStyle::Params icon;
+ icon.image = image;
+ // Text will be replaced during rendering with the icon,
+ // but string cannot be empty or the segment won't be
+ // added (or drawn).
+ text_base->appendImageSegment(icon);
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
// EOF