Add getAllIDs to LLScrollListCtrl, and make getSelectedIDs a little better
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user