diff options
author | Igor Borovkov <iborovkov@productengine.com> | 2010-05-13 17:20:29 +0300 |
---|---|---|
committer | Igor Borovkov <iborovkov@productengine.com> | 2010-05-13 17:20:29 +0300 |
commit | 2b4c9469f180093bd53b1c11be74e2716f57ad58 (patch) | |
tree | dc4f4ae7dd166c5dbef83dc5d20f75f85e1c6d37 /indra/newview/llcofwearables.h | |
parent | 5975650a8b9b3d7a5844d6478fb3bbd475592be1 (diff) |
EXT-7254 FIXED added a comparator for wearable items (panel outfit edit)
added a flat list view comparator for names of wearable list items
Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/384/
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/llcofwearables.h')
-rw-r--r-- | indra/newview/llcofwearables.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/indra/newview/llcofwearables.h b/indra/newview/llcofwearables.h index 32acba5a3e..612bb103d2 100644 --- a/indra/newview/llcofwearables.h +++ b/indra/newview/llcofwearables.h @@ -40,6 +40,53 @@ class LLFlatListView; + +/** Abstract comparator of wearable list items */ +class LLWearableListItemComparator : public LLFlatListView::ItemComparator +{ + LOG_CLASS(LLWearableListItemComparator); + +public: + LLWearableListItemComparator() {}; + virtual ~LLWearableListItemComparator() {}; + + virtual bool compare(const LLPanel* item1, const LLPanel* item2) const + { + const LLPanelWearableListItem* wearable_item1 = dynamic_cast<const LLPanelWearableListItem*>(item1); + const LLPanelWearableListItem* wearable_item2 = dynamic_cast<const LLPanelWearableListItem*>(item2); + + if (!wearable_item1 || !wearable_item2) + { + llwarning("item1 and item2 cannot be null", 0); + return true; + } + + return doCompare(wearable_item1, wearable_item2); + } + +protected: + + /** + * Returns true if wearable_item1 < wearable_item2, false otherwise + * Implement this method in your particular comparator. + */ + virtual bool doCompare(const LLPanelWearableListItem* wearable_item1, const LLPanelWearableListItem* wearable_item2) const = 0; +}; + + +class LLWearableItemNameComparator : public LLWearableListItemComparator +{ + LOG_CLASS(LLWearableItemNameComparator); + +public: + LLWearableItemNameComparator() {}; + virtual ~LLWearableItemNameComparator() {}; + +protected: + virtual bool doCompare(const LLPanelWearableListItem* wearable_item1, const LLPanelWearableListItem* wearable_item2) const; +}; + + /** * Adaptor between LLAccordionCtrlTab and LLFlatListView to facilitate communication between them * (notify, notifyParent) regarding size changes of a list and selection changes across accordion tabs. |