diff options
author | Jon Wolk <jwolk@lindenlab.com> | 2007-12-19 00:56:59 +0000 |
---|---|---|
committer | Jon Wolk <jwolk@lindenlab.com> | 2007-12-19 00:56:59 +0000 |
commit | 7dd08303a3ebf9718c2c60a4d94b81d5d7845f8c (patch) | |
tree | 6195a8585cc7998647afcaec2167e728e4abd3c1 /indra/llui/llviewquery.cpp | |
parent | 4d87303e78c1accde85b217b325e0c08930b0c4c (diff) |
svn merge -r 75354:76103 svn+ssh://svn.lindenlab.com/svn/linden/branches/voice-group-moderation-3 -> release. Finished product of QAR-134
Diffstat (limited to 'indra/llui/llviewquery.cpp')
-rw-r--r-- | indra/llui/llviewquery.cpp | 61 |
1 files changed, 42 insertions, 19 deletions
diff --git a/indra/llui/llviewquery.cpp b/indra/llui/llviewquery.cpp index c07587f0ff..db00c76821 100644 --- a/indra/llui/llviewquery.cpp +++ b/indra/llui/llviewquery.cpp @@ -37,9 +37,14 @@ void LLQuerySorter::operator() (LLView * parent, viewList_t &children) const {} -filterResult_t LLNoLeavesFilter::operator() (const LLView* const view, const viewList_t & children) const +filterResult_t LLLeavesFilter::operator() (const LLView* const view, const viewList_t & children) const { - return filterResult_t(!(view->getChildList()->size() == 0), TRUE); + return filterResult_t(children.empty(), TRUE); +} + +filterResult_t LLRootsFilter::operator() (const LLView* const view, const viewList_t & children) const +{ + return filterResult_t(TRUE, FALSE); } filterResult_t LLVisibleFilter::operator() (const LLView* const view, const viewList_t & children) const @@ -56,6 +61,16 @@ filterResult_t LLTabStopFilter::operator() (const LLView* const view, const view view->canFocusChildren()); } +filterResult_t LLCtrlFilter::operator() (const LLView* const view, const viewList_t & children) const +{ + return filterResult_t(view->isCtrl(),TRUE); +} + +filterResult_t LLWidgetTypeFilter::operator() (const LLView* const view, const viewList_t & children) const +{ + return filterResult_t(view->getWidgetType() == mType, TRUE); +} + // LLViewQuery LLViewQuery::LLViewQuery(): mPreFilters(), mPostFilters(), mSorterp() @@ -73,45 +88,53 @@ const LLViewQuery::filterList_t & LLViewQuery::getPostFilters() const { return m void LLViewQuery::setSorter(const LLQuerySorter* sorterp) { mSorterp = sorterp; } const LLQuerySorter* LLViewQuery::getSorter() const { return mSorterp; } -viewList_t LLViewQuery::run(LLView * view) const +viewList_t LLViewQuery::run(LLView* view) const { viewList_t result; - filterResult_t pre = runFilters(view, viewList_t(), mPreFilters); + // prefilter gets immediate children of view + filterResult_t pre = runFilters(view, *view->getChildList(), mPreFilters); if(!pre.first && !pre.second) { - // skip post filters completely if we're not including ourselves or the children + // not including ourselves or the children + // nothing more to do return result; } + + viewList_t filtered_children; + filterResult_t post(TRUE, TRUE); if(pre.second) { // run filters on children - viewList_t filtered_children; filterChildren(view, filtered_children); - filterResult_t post = runFilters(view, filtered_children, mPostFilters); - if(pre.first && post.first) - { - result.push_back(view); - } - if(post.second) + // only run post filters if this element passed pre filters + // so if you failed to pass the pre filter, you can't filter out children in post + if (pre.first) { - result.insert(result.end(), filtered_children.begin(), filtered_children.end()); + post = runFilters(view, filtered_children, mPostFilters); } } - else + + if(pre.first && post.first) { - if(pre.first) - { - result.push_back(view); - } + result.push_back(view); + } + + if(pre.second && post.second) + { + result.insert(result.end(), filtered_children.begin(), filtered_children.end()); } + return result; } void LLViewQuery::filterChildren(LLView * view, viewList_t & filtered_children) const { LLView::child_list_t views(*(view->getChildList())); - (*mSorterp)(view, views); // sort the children per the sorter + if (mSorterp) + { + (*mSorterp)(view, views); // sort the children per the sorter + } for(LLView::child_list_iter_t iter = views.begin(); iter != views.end(); iter++) |