diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-07-01 23:02:08 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-07-01 23:02:34 +0300 |
commit | 7a6b5a598487c6162c56246561bae205824c892b (patch) | |
tree | 86986681da787c66d4a5757eae30fcf470331c61 | |
parent | b15f30a9ce6f7ac7057a9daf7a4072426baf25d9 (diff) |
SL-15383 Fix combobox's search highlights
-rw-r--r-- | indra/llui/llcombobox.cpp | 37 | ||||
-rw-r--r-- | indra/llui/llcombobox.h | 7 |
2 files changed, 43 insertions, 1 deletions
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 52dc908655..bcc653a602 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -1037,6 +1037,43 @@ void LLComboBox::prearrangeList(std::string filter) } } + +//============================================================================ +// ll::ui::SearchableControl functions + +//virtual +std::string LLComboBox::_getSearchText() const +{ + std::string res; + if (mList) + { + // getAllData returns a full copy of content, might be a + // better option to implement an mList->getSearchText(column) + std::vector<LLScrollListItem*> data = mList->getAllData(); + std::vector<LLScrollListItem*>::iterator iter = data.begin(); + while (iter != data.end()) + { + LLScrollListCell* cell = (*iter)->getColumn(0); + if (cell) + { + std::string whitelist_url = cell->getValue().asString(); + res += cell->getValue().asString(); + } + iter++; + } + } + return res + getToolTip(); +} + +//virtual +void LLComboBox::onSetHighlight() const +{ + if (mButton) + { + mButton->ll::ui::SearchableControl::setHighlighted(ll::ui::SearchableControl::getHighlighted()); + } +} + //============================================================================ // LLCtrlListInterface functions diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 4af3313162..e17d6cdfb4 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -44,7 +44,9 @@ class LLFontGL; class LLViewBorder; class LLComboBox -: public LLUICtrl, public LLCtrlListInterface +: public LLUICtrl +, public LLCtrlListInterface +, public ll::ui::SearchableControl { public: typedef enum e_preferred_position @@ -100,6 +102,9 @@ protected: void initFromParams(const Params&); void prearrangeList(std::string filter = ""); + virtual std::string _getSearchText() const; + virtual void onSetHighlight() const; + public: // LLView interface virtual void onFocusLost(); |