Add getAllIDs to LLScrollListCtrl, and make getSelectedIDs a little better

This commit is contained in:
Lirusaito
2019-07-18 18:55:52 -04:00
parent cf94149dc1
commit 3f921251ee
2 changed files with 16 additions and 4 deletions

View File

@@ -312,12 +312,12 @@ std::vector<LLScrollListItem*> LLScrollListCtrl::getAllSelected() const
uuid_vec_t LLScrollListCtrl::getSelectedIDs()
{
LLUUID selected_id;
uuid_vec_t ids;
std::vector<LLScrollListItem*> selected = this->getAllSelected();
for(std::vector<LLScrollListItem*>::iterator itr = selected.begin(); itr != selected.end(); ++itr)
if (!getCanSelect()) return ids;
for(const auto& item : mItemList)
{
ids.push_back((*itr)->getUUID());
if (item->getSelected()) ids.push_back(item->getUUID());
}
return ids;
}
@@ -400,6 +400,17 @@ std::vector<LLScrollListItem*> LLScrollListCtrl::getAllData() const
return ret;
}
uuid_vec_t LLScrollListCtrl::getAllIDs() const
{
uuid_vec_t ret;
ret.reserve(mItemList.size()); //Optimization
for(const auto& item : mItemList)
{
ret.push_back(item->getUUID());
}
return ret;
}
// returns first matching item
LLScrollListItem* LLScrollListCtrl::getItem(const LLSD& sd) const
{

View File

@@ -207,6 +207,7 @@ public:
LLScrollListItem* getFirstData() const;
LLScrollListItem* getLastData() const;
std::vector<LLScrollListItem*> getAllData() const;
uuid_vec_t getAllIDs() const; //Helper. Much like getAllData, but just provides a LLUUID vec
LLScrollListItem* getItem(const LLSD& sd) const;