diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index bdd20327a4..d2f11173a4 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -140,6 +140,16 @@ LLTextBase::LineSpacingParams::LineSpacingParams() { } +// Optional icon position +namespace LLInitParam +{ + void TypeValues::declareValues() + { + declare("left", LLTextBaseEnums::LEFT); + declare("right", LLTextBaseEnums::RIGHT); + } +} +// Optional icon position LLTextBase::Params::Params() : cursor_color("cursor_color"), @@ -169,6 +179,9 @@ LLTextBase::Params::Params() font_shadow("font_shadow"), wrap("wrap"), use_ellipses("use_ellipses", false), + // Optional icon position + icon_positioning("icon_positioning", LLTextBaseEnums::RIGHT), + // Optional icon position parse_urls("parse_urls", false), parse_highlights("parse_highlights", false) { @@ -226,6 +239,9 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) mParseHighlights(p.parse_highlights), mBGVisible(p.bg_visible), mScroller(NULL), + // Optional icon position + mIconPositioning(p.icon_positioning), + // Optional icon position mStyleDirty(true) { if(p.allow_scroll) @@ -2003,6 +2019,13 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para while ( LLUrlRegistry::instance().findUrl(text, match, boost::bind(&LLTextBase::replaceUrl, this, _1, _2, _3)) ) { + // Optional icon position + if (mIconPositioning == LLTextBaseEnums::LEFT) + { + LLTextUtil::processUrlMatch(&match,this); + } + // Optional icon position + start = match.getStart(); end = match.getEnd()+1; @@ -2038,7 +2061,13 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para } } - LLTextUtil::processUrlMatch(&match,this); + // Optional icon position + //LLTextUtil::processUrlMatch(&match,this); + if (mIconPositioning == LLTextBaseEnums::RIGHT) + { + LLTextUtil::processUrlMatch(&match,this); + } + // Optional icon position // move on to the rest of the text after the Url if (end < (S32)text.length()) diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 17a9f842fa..1bd005e70d 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -230,6 +230,26 @@ private: typedef LLPointer LLTextSegmentPtr; +// Optional icon position +namespace LLTextBaseEnums +{ + enum EIconPositioning + { + LEFT, + RIGHT + }; +} + +namespace LLInitParam +{ + template<> + struct TypeValues : public TypeValuesHelper + { + static void declareValues(); + }; +} +// Optional icon position + /// /// The LLTextBase class provides a base class for all text fields, such /// as LLTextEditor and LLTextBox. It implements shared functionality @@ -291,6 +311,9 @@ public: Optional font_shadow; + // Optional icon position + Optional icon_positioning; + Params(); }; @@ -633,6 +656,8 @@ protected: // Fired when a URL link is clicked commit_signal_t* mURLClickSignal; + // Optional icon position + LLTextBaseEnums::EIconPositioning mIconPositioning; }; #endif