From 979dc6257a2f69ade29662a879b0fcaa767201fb Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Tue, 6 Jul 2010 18:11:14 +0300 Subject: EXT-8061 FIXED resetting selection inside accordion (panel outfit edit) - added resetting lists selection on tabs state changes - added committing on tab selection change - added filtering wearables by at first by a selected tab and then by an expended tab Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/696 --HG-- branch : product-engine --- indra/newview/llcofwearables.cpp | 62 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) (limited to 'indra/newview/llcofwearables.cpp') diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp index f278fb6a7b..d83706de52 100644 --- a/indra/newview/llcofwearables.cpp +++ b/indra/newview/llcofwearables.cpp @@ -281,7 +281,11 @@ LLCOFWearables::LLCOFWearables() : LLPanel(), mAttachments(NULL), mClothing(NULL), mBodyParts(NULL), - mLastSelectedList(NULL) + mLastSelectedList(NULL), + mClothingTab(NULL), + mAttachmentsTab(NULL), + mBodyPartsTab(NULL), + mLastSelectedTab(NULL) { mClothingMenu = new CofClothingContextMenu(this); mAttachmentMenu = new CofAttachmentContextMenu(this); @@ -319,6 +323,16 @@ BOOL LLCOFWearables::postBuild() mAttachments->setComparator(&WEARABLE_NAME_COMPARATOR); mBodyParts->setComparator(&WEARABLE_NAME_COMPARATOR); + + mClothingTab = getChild("tab_clothing"); + mClothingTab->setDropDownStateChangedCallback(boost::bind(&LLCOFWearables::onAccordionTabStateChanged, this, _1, _2)); + + mAttachmentsTab = getChild("tab_attachments"); + mAttachmentsTab->setDropDownStateChangedCallback(boost::bind(&LLCOFWearables::onAccordionTabStateChanged, this, _1, _2)); + + mBodyPartsTab = getChild("tab_body_parts"); + mBodyPartsTab->setDropDownStateChangedCallback(boost::bind(&LLCOFWearables::onAccordionTabStateChanged, this, _1, _2)); + return LLPanel::postBuild(); } @@ -338,6 +352,28 @@ void LLCOFWearables::onSelectionChange(LLFlatListView* selected_list) onCommit(); } +void LLCOFWearables::onAccordionTabStateChanged(LLUICtrl* ctrl, const LLSD& expanded) +{ + bool had_selected_items = mClothing->numSelected() || mAttachments->numSelected() || mBodyParts->numSelected(); + mClothing->resetSelection(true); + mAttachments->resetSelection(true); + mBodyParts->resetSelection(true); + + bool tab_selection_changed = false; + LLAccordionCtrlTab* tab = dynamic_cast(ctrl); + if (tab && tab != mLastSelectedTab) + { + mLastSelectedTab = tab; + tab_selection_changed = true; + } + + if (had_selected_items || tab_selection_changed) + { + //sending commit signal to indicate selection changes + onCommit(); + } +} + void LLCOFWearables::refresh() { typedef std::vector values_vector_t; @@ -617,6 +653,30 @@ LLAssetType::EType LLCOFWearables::getExpandedAccordionAssetType() return result; } +LLAssetType::EType LLCOFWearables::getSelectedAccordionAssetType() +{ + //*TODO share the code with ::getExpandedAccordionAssetType(...) + static LLAccordionCtrl* accordion_ctrl = getChild("cof_wearables_accordion"); + const LLAccordionCtrlTab* selected_tab = accordion_ctrl->getSelectedTab(); + + if (selected_tab == mClothingTab) + { + return LLAssetType::AT_CLOTHING; + } + else if (selected_tab == mAttachmentsTab) + { + return LLAssetType::AT_OBJECT; + } + else if (selected_tab == mBodyPartsTab) + { + return LLAssetType::AT_BODYPART; + } + else + { + return LLAssetType::AT_NONE; + } +} + void LLCOFWearables::onListRightClick(LLUICtrl* ctrl, S32 x, S32 y, LLListContextMenu* menu) { if(menu) -- cgit v1.2.3