diff options
| author | Nat Goodspeed <nat@lindenlab.com> | 2022-12-13 20:51:27 -0500 |
|---|---|---|
| committer | Nat Goodspeed <nat@lindenlab.com> | 2022-12-13 20:51:27 -0500 |
| commit | d4822f10142887daa9ef2d5575a2c2e1bb24b389 (patch) | |
| tree | 3b0b66779887ce2dcc3b2d027ce9b9d68c145d3b /indra/llui/llscrolllistctrl.cpp | |
| parent | 424d3ef83cdb354e66789f22f65394f4db523128 (diff) | |
| parent | 9e7829c9cb140f994c9aa12dddcd4518c4c43a40 (diff) | |
Merge branch 'DRTVWR-559' of github.com:secondlife/viewer into DRTVWR-559
Diffstat (limited to 'indra/llui/llscrolllistctrl.cpp')
| -rw-r--r-- | indra/llui/llscrolllistctrl.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 65c7b420ce..88c1bdc0d5 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -3395,3 +3395,42 @@ boost::signals2::connection LLScrollListCtrl::setIsFriendCallback(const is_frien } return mIsFriendSignal->connect(cb); } + +bool LLScrollListCtrl::highlightMatchingItems(const std::string& filter_str) +{ + if (filter_str == "" || filter_str == " ") + { + clearHighlightedItems(); + return false; + } + + bool res = false; + + setHighlightedColor(LLUIColorTable::instance().getColor("SearchableControlHighlightColor", LLColor4::red)); + + std::string filter_str_lc(filter_str); + LLStringUtil::toLower(filter_str_lc); + + std::vector<LLScrollListItem*> data = getAllData(); + std::vector<LLScrollListItem*>::iterator iter = data.begin(); + while (iter != data.end()) + { + LLScrollListCell* cell = (*iter)->getColumn(0); + if (cell) + { + std::string value = cell->getValue().asString(); + LLStringUtil::toLower(value); + if (value.find(filter_str_lc) == std::string::npos) + { + (*iter)->setHighlighted(false); + } + else + { + (*iter)->setHighlighted(true); + res = true; + } + } + iter++; + } + return res; +} |
