summaryrefslogtreecommitdiff
path: root/indra/newview/llpaneloutfitsinventory.cpp
diff options
context:
space:
mode:
authorLoren Shih <seraph@lindenlab.com>2009-11-23 15:25:31 -0500
committerLoren Shih <seraph@lindenlab.com>2009-11-23 15:25:31 -0500
commitfc1860bcc6bab4b538692662db2da4be1def5af4 (patch)
tree2452ea008050749c15be1dcd2b7f392ef499e796 /indra/newview/llpaneloutfitsinventory.cpp
parent0c3bd94da9ba2244613b6c1f1f0e4ce9723c46d3 (diff)
EXT-2705 : Create accordion panel to show COF contents
Also made several infrastructure improvements that help inventory panels defer generating their folders/views until after inventory has been loaded up. This was pretty haphazard before. --HG-- branch : avatar-pipeline
Diffstat (limited to 'indra/newview/llpaneloutfitsinventory.cpp')
-rw-r--r--indra/newview/llpaneloutfitsinventory.cpp69
1 files changed, 59 insertions, 10 deletions
diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index c4bde369db..2550962d76 100644
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -59,7 +59,7 @@
static LLRegisterPanelClassWrapper<LLPanelOutfitsInventory> t_inventory("panel_outfits_inventory");
LLPanelOutfitsInventory::LLPanelOutfitsInventory() :
- mInventoryPanel(NULL),
+ mActivePanel(NULL),
mParent(NULL)
{
mSavedFolderState = new LLSaveFolderState();
@@ -74,12 +74,8 @@ LLPanelOutfitsInventory::~LLPanelOutfitsInventory()
// virtual
BOOL LLPanelOutfitsInventory::postBuild()
{
- mInventoryPanel = getChild<LLInventoryPanel>("outfits_list");
- mInventoryPanel->setFilterTypes(1LL << LLFolderType::FT_OUTFIT, TRUE);
- mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
- mInventoryPanel->openDefaultFolderForType(LLFolderType::FT_MY_OUTFITS);
- mInventoryPanel->setSelectCallback(boost::bind(&LLPanelOutfitsInventory::onSelectionChange, this, _1, _2));
+ initAccordionPanels();
initListCommandsHandlers();
return TRUE;
}
@@ -102,7 +98,7 @@ void LLPanelOutfitsInventory::onSearchEdit(const std::string& string)
{
if (string == "")
{
- mInventoryPanel->setFilterSubString(LLStringUtil::null);
+ mActivePanel->setFilterSubString(LLStringUtil::null);
// re-open folders that were initially open
mSavedFolderState->setApply(TRUE);
@@ -114,7 +110,7 @@ void LLPanelOutfitsInventory::onSearchEdit(const std::string& string)
gInventory.startBackgroundFetch();
- if (mInventoryPanel->getFilterSubString().empty() && string.empty())
+ if (mActivePanel->getFilterSubString().empty() && string.empty())
{
// current filter and new filter empty, do nothing
return;
@@ -128,7 +124,7 @@ void LLPanelOutfitsInventory::onSearchEdit(const std::string& string)
}
// set new filter string
- mInventoryPanel->setFilterSubString(string);
+ mActivePanel->setFilterSubString(string);
}
void LLPanelOutfitsInventory::onWear()
@@ -207,7 +203,7 @@ bool LLPanelOutfitsInventory::getIsCorrectType(const LLFolderViewEventListener *
LLFolderView *LLPanelOutfitsInventory::getRootFolder()
{
- return mInventoryPanel->getRootFolder();
+ return mActivePanel->getRootFolder();
}
//////////////////////////////////////////////////////////////////////////////////
@@ -349,3 +345,56 @@ bool LLPanelOutfitsInventory::handleDragAndDropToTrash(BOOL drop, EDragAndDropTy
// List Commands //
////////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////////
+// Accordion //
+
+void LLPanelOutfitsInventory::initAccordionPanels()
+{
+ mAccordionPanels.resize(2);
+
+ LLInventoryPanel *myoutfits_panel = getChild<LLInventoryPanel>("outfitslist_accordionpanel");
+ myoutfits_panel->setFilterTypes(1LL << LLFolderType::FT_OUTFIT, TRUE);
+ myoutfits_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
+ mAccordionPanels[0] = myoutfits_panel;
+ mActivePanel = myoutfits_panel;
+
+ LLInventoryPanel *cof_panel = getChild<LLInventoryPanel>("cof_accordionpanel");
+ cof_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
+ mAccordionPanels[1] = cof_panel;
+
+ for (accordionpanels_vec_t::iterator iter = mAccordionPanels.begin();
+ iter != mAccordionPanels.end();
+ ++iter)
+ {
+ LLInventoryPanel *panel = (*iter);
+ panel->setSelectCallback(boost::bind(&LLPanelOutfitsInventory::onAccordionSelectionChange, this, panel, _1, _2));
+ }
+}
+
+void LLPanelOutfitsInventory::onAccordionSelectionChange(LLInventoryPanel* accordion_panel, const std::deque<LLFolderViewItem*> &items, BOOL user_action)
+{
+ if (user_action && items.size() > 0)
+ {
+ for (accordionpanels_vec_t::iterator iter = mAccordionPanels.begin();
+ iter != mAccordionPanels.end();
+ ++iter)
+ {
+ LLInventoryPanel *panel = (*iter);
+ if (panel == accordion_panel)
+ {
+ mActivePanel = panel;
+ }
+ else
+ {
+ panel->getRootFolder()->clearSelection();
+ }
+ }
+ }
+ onSelectionChange(items, user_action);
+}
+
+LLInventoryPanel* LLPanelOutfitsInventory::getActivePanel()
+{
+ return mActivePanel;
+}
+