summaryrefslogtreecommitdiff
path: root/indra/llui/llflatlistview.cpp
diff options
context:
space:
mode:
authorRoxie Linden <roxie@lindenlab.com>2024-05-06 16:40:12 -0700
committerRoxie Linden <roxie@lindenlab.com>2024-05-06 16:40:12 -0700
commit4af9128db1fb65ff99d1e8086352698f46e049b4 (patch)
tree4b98d8afb138a4a1ac9f2d4b01a7d83dce314d17 /indra/llui/llflatlistview.cpp
parent05b2dd913fcb1c5485ce19885e4e60f26752e6b0 (diff)
parent10aa7f4254fd04c24f15f507188705146f92ee60 (diff)
Merge branch 'main' of https://github.com/secondlife/viewer into roxie/webrtc-voice
Diffstat (limited to 'indra/llui/llflatlistview.cpp')
-rw-r--r--indra/llui/llflatlistview.cpp49
1 files changed, 31 insertions, 18 deletions
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp
index 460bd0945b..fd4c33df30 100644
--- a/indra/llui/llflatlistview.cpp
+++ b/indra/llui/llflatlistview.cpp
@@ -1361,26 +1361,28 @@ void LLFlatListViewEx::setForceShowingUnmatchedItems(bool show)
mForceShowingUnmatchedItems = show;
}
-void LLFlatListViewEx::setFilterSubString(const std::string& filter_str)
+void LLFlatListViewEx::setFilterSubString(const std::string& filter_str, bool notify_parent)
{
if (0 != LLStringUtil::compareInsensitive(filter_str, mFilterSubString))
{
mFilterSubString = filter_str;
updateNoItemsMessage(mFilterSubString);
- filterItems();
+ filterItems(false, notify_parent);
}
}
-void LLFlatListViewEx::updateItemVisibility(LLPanel* item, const LLSD &action)
+bool LLFlatListViewEx::updateItemVisibility(LLPanel* item, const LLSD &action)
{
- if (!item) return;
+ if (!item)
+ return false;
+
+ BOOL visible = TRUE;
// 0 signifies that filter is matched,
// i.e. we don't hide items that don't support 'match_filter' action, separators etc.
if (0 == item->notify(action))
{
mHasMatchedItems = true;
- item->setVisible(true);
}
else
{
@@ -1388,34 +1390,45 @@ void LLFlatListViewEx::updateItemVisibility(LLPanel* item, const LLSD &action)
if (!mForceShowingUnmatchedItems)
{
selectItem(item, false);
+ visible = FALSE;
}
- item->setVisible(mForceShowingUnmatchedItems);
}
+
+ if (item->getVisible() != visible)
+ {
+ item->setVisible(visible);
+ return true;
+ }
+
+ return false;
}
-void LLFlatListViewEx::filterItems()
+void LLFlatListViewEx::filterItems(bool re_sort, bool notify_parent)
{
- typedef std::vector <LLPanel*> item_panel_list_t;
-
std::string cur_filter = mFilterSubString;
LLStringUtil::toUpper(cur_filter);
LLSD action;
action.with("match_filter", cur_filter);
- item_panel_list_t items;
- getItems(items);
-
mHasMatchedItems = false;
- item_panel_list_t::iterator iter = items.begin(), iter_end = items.end();
- while (iter < iter_end)
+ bool visibility_changed = false;
+ pairs_const_iterator_t iter = getItemPairs().begin(), iter_end = getItemPairs().end();
+ while (iter != iter_end)
{
- LLPanel* pItem = *(iter++);
- updateItemVisibility(pItem, action);
+ LLPanel* pItem = (*(iter++))->first;
+ visibility_changed |= updateItemVisibility(pItem, action);
}
- sort();
- notifyParentItemsRectChanged();
+ if (re_sort)
+ {
+ sort();
+ }
+
+ if (visibility_changed && notify_parent)
+ {
+ notifyParentItemsRectChanged();
+ }
}
bool LLFlatListViewEx::hasMatchedItems()