diff options
author | AndreyL ProductEngine <alihatskiy@productengine.com> | 2016-08-04 21:11:32 +0300 |
---|---|---|
committer | AndreyL ProductEngine <alihatskiy@productengine.com> | 2016-08-04 21:11:32 +0300 |
commit | 6de863132756ffdf3778721ec9dd0f3a15bf464a (patch) | |
tree | 6bc5a3c515fe92cb785b7eaf9b6860e7e7110b61 /indra/llui/lltextutil.cpp | |
parent | 2339e759fc2d6f36a4b9425022a22a747ec55dad (diff) | |
parent | ce3658455230cf392f45cc99f44a737ee59f13bd (diff) |
Merged in lindenlab/viewer-lynx
Diffstat (limited to 'indra/llui/lltextutil.cpp')
-rw-r--r-- | indra/llui/lltextutil.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/indra/llui/lltextutil.cpp b/indra/llui/lltextutil.cpp index fff04b34f2..f6b2ee1dc0 100644 --- a/indra/llui/lltextutil.cpp +++ b/indra/llui/lltextutil.cpp @@ -56,6 +56,26 @@ void LLTextUtil::textboxSetHighlightedVal(LLTextBox *txtbox, const LLStyle::Para txtbox->appendText(text.substr(hl_begin + hl_len), false, normal_style); } +void LLTextUtil::textboxSetGreyedVal(LLTextBox *txtbox, const LLStyle::Params& normal_style, const std::string& text, const std::string& greyed) +{ + static LLUIColor sGreyedTextColor = LLUIColorTable::instance().getColor("Gray", LLColor4::grey); + + size_t greyed_begin = 0, greyed_len = greyed.size(); + + if (greyed_len == 0 || (greyed_begin = text.find(greyed)) == std::string::npos) + { + txtbox->setText(text, normal_style); + return; + } + + LLStyle::Params greyed_style = normal_style; + greyed_style.color = sGreyedTextColor; + txtbox->setText(LLStringUtil::null); // clear text + txtbox->appendText(text.substr(0, greyed_begin), false, normal_style); + txtbox->appendText(text.substr(greyed_begin, greyed_len), false, greyed_style); + txtbox->appendText(text.substr(greyed_begin + greyed_len), false, normal_style); +} + const std::string& LLTextUtil::formatPhoneNumber(const std::string& phone_str) { static const std::string PHONE_SEPARATOR = LLUI::sSettingGroups["config"]->getString("AvalinePhoneSeparator"); |