bool LLFlatListView::selectItemPair(item_pair_t* item_pair, bool select) { llassert(item_pair); if (!mAllowSelection && select) return false; if (isSelected(item_pair) == select) return true; //already in specified selection state if (select) { mSelectedItemPairs.push_back(item_pair); } else { mSelectedItemPairs.remove(item_pair); } //a way of notifying panel of selection state changes LLPanel* item = item_pair->first; item->setValue(select ? SELECTED_EVENT : UNSELECTED_EVENT); if (mCommitOnSelectionChange) { onCommit(); } // Stretch selected item rect to ensure it won't be clipped mSelectedItemsBorder->setRect(getLastSelectedItemRect().stretch(-1)); return true; }
bool LLFlatListView::selectAll() { if (!mAllowSelection) return false; mSelectedItemPairs.clear(); for (pairs_const_iterator_t it= mItemPairs.begin(); it != mItemPairs.end(); ++it) { item_pair_t* item_pair = *it; mSelectedItemPairs.push_back(item_pair); //a way of notifying panel of selection state changes LLPanel* item = item_pair->first; item->setValue(SELECTED_EVENT); } if (mCommitOnSelectionChange) { onCommit(); } // Stretch selected item rect to ensure it won't be clipped mSelectedItemsBorder->setRect(getLastSelectedItemRect().stretch(-1)); return true; }
void LLFlatListView::resetSelection(bool no_commit_on_deselection /*= false*/) { if (mSelectedItemPairs.empty()) return; for (pairs_iterator_t it= mSelectedItemPairs.begin(); it != mSelectedItemPairs.end(); ++it) { item_pair_t* pair_to_deselect = *it; LLPanel* item = pair_to_deselect->first; item->setValue(UNSELECTED_EVENT); } mSelectedItemPairs.clear(); if (mCommitOnSelectionChange && !no_commit_on_deselection) { onCommit(); } // Stretch selected item rect to ensure it won't be clipped mSelectedItemsBorder->setRect(getLastSelectedItemRect().stretch(-1)); }