diff options
Diffstat (limited to 'indra/newview/llsidetray.cpp')
-rw-r--r-- | indra/newview/llsidetray.cpp | 56 |
1 files changed, 30 insertions, 26 deletions
diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index d1236b948e..50c47e293e 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -46,7 +46,7 @@ #include "llaccordionctrltab.h" #include "llfloater.h" //for gFloaterView -#include "lliconctrl.h"//for Home tab icon +#include "lliconctrl.h"//for OpenClose tab icon #include "llsidetraypanelcontainer.h" #include "llwindow.h"//for SetCursor #include "lltransientfloatermgr.h" @@ -214,7 +214,7 @@ LLPanel* LLSideTrayTab::getPanel() LLSideTrayTab* LLSideTrayTab::createInstance () { LLSideTrayTab::Params tab_params; - tab_params.tab_title("Home"); + tab_params.tab_title("openclose"); LLSideTrayTab* tab = LLUICtrlFactory::create<LLSideTrayTab>(tab_params); return tab; @@ -389,9 +389,8 @@ void LLSideTray::createButtons () std::string name = sidebar_tab->getName(); - // The "home" button will open/close the whole panel, this will need to - // change if the home screen becomes its own tab. - if (name == "sidebar_home") + // The "OpenClose" button will open/close the whole panel + if (name == "sidebar_openclose") { mCollapseButton = createButton("",sidebar_tab->mImage,sidebar_tab->getTabTitle(), boost::bind(&LLSideTray::onToggleCollapse, this)); @@ -427,7 +426,6 @@ void LLSideTray::processTriState () void LLSideTray::onTabButtonClick(string name) { LLSideTrayTab* side_bar = getTab(name); - if(side_bar == mActiveTab) { processTriState (); @@ -443,7 +441,7 @@ void LLSideTray::onToggleCollapse() if(mCollapsed) { expandSideBar(); - selectTabByName("sidebar_home"); + //selectTabByName("sidebar_openclose"); } else collapseSideBar(); @@ -534,11 +532,11 @@ void LLSideTray::collapseSideBar() } } - // Home tab doesn't put its button in mTabButtons - LLSideTrayTab* home_tab = getTab("sidebar_home"); - if (home_tab) + // OpenClose tab doesn't put its button in mTabButtons + LLSideTrayTab* openclose_tab = getTab("sidebar_openclose"); + if (openclose_tab) { - mCollapseButton->setImageOverlay( home_tab->mImage ); + mCollapseButton->setImageOverlay( openclose_tab->mImage ); } //mActiveTab->setVisible(FALSE); reflectCollapseChange(); @@ -549,10 +547,10 @@ void LLSideTray::collapseSideBar() void LLSideTray::expandSideBar() { mCollapsed = false; - LLSideTrayTab* home_tab = getTab("sidebar_home"); - if (home_tab) + LLSideTrayTab* openclose_tab = getTab("sidebar_openclose"); + if (openclose_tab) { - mCollapseButton->setImageOverlay( home_tab->mImageSelected ); + mCollapseButton->setImageOverlay( openclose_tab->mImageSelected ); } LLSD key;//empty mActiveTab->onOpen(key); @@ -641,15 +639,29 @@ LLPanel* LLSideTray::showPanel (const std::string& panel_name, const LLSD& para return NULL; } +void LLSideTray::togglePanel(LLPanel* &sub_panel, const std::string& panel_name, const LLSD& params) +{ + if(!sub_panel) + return; + + if (sub_panel->isInVisibleChain()) + { + LLSideTray::getInstance()->collapseSideBar(); + } + else + { + LLSideTray::getInstance()->showPanel(panel_name, params); + } +} + // This is just LLView::findChildView specialized to restrict the search to LLPanels. // Optimization for EXT-4068 to avoid searching down to the individual item level // when inventories are large. -LLPanel *findChildPanel(LLPanel *panel, const std::string& name, bool recurse, S32& count) +LLPanel *findChildPanel(LLPanel *panel, const std::string& name, bool recurse) { for (LLView::child_list_const_iter_t child_it = panel->beginChild(); child_it != panel->endChild(); ++child_it) { - count++; LLPanel *child_panel = dynamic_cast<LLPanel*>(*child_it); if (!child_panel) continue; @@ -661,11 +673,10 @@ LLPanel *findChildPanel(LLPanel *panel, const std::string& name, bool recurse, S for (LLView::child_list_const_iter_t child_it = panel->beginChild(); child_it != panel->endChild(); ++child_it) { - count++; LLPanel *child_panel = dynamic_cast<LLPanel*>(*child_it); if (!child_panel) continue; - LLPanel *found_panel = findChildPanel(child_panel,name,recurse,count); + LLPanel *found_panel = findChildPanel(child_panel,name,recurse); if (found_panel) { return found_panel; @@ -677,16 +688,9 @@ LLPanel *findChildPanel(LLPanel *panel, const std::string& name, bool recurse, S LLPanel* LLSideTray::getPanel(const std::string& panel_name) { - static S32 max_count = 0; - S32 count = 0; for ( child_vector_const_iter_t child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it) { - LLPanel *panel = findChildPanel(*child_it,panel_name,true,count); - if (count > max_count) - { - max_count = count; - llwarns << "max_count " << max_count << llendl; - } + LLPanel *panel = findChildPanel(*child_it,panel_name,true); if(panel) { return panel; |