Merge with main repo
commit
2e86084a15
|
|
@ -1192,69 +1192,6 @@ void LLSideTray::reshape(S32 width, S32 height, BOOL called_from_parent)
|
|||
arrange();
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate tab with "panel_name" panel
|
||||
* if no such tab - return false, otherwise true.
|
||||
* TODO* In some cases a pointer to a panel of
|
||||
* a specific class may be needed so this method
|
||||
* would need to use templates.
|
||||
*/
|
||||
LLPanel* LLSideTray::showPanel (const std::string& panel_name, const LLSD& params)
|
||||
{
|
||||
LLPanel* new_panel = NULL;
|
||||
|
||||
// Look up the tab in the list of detached tabs.
|
||||
child_vector_const_iter_t child_it;
|
||||
for ( child_it = mDetachedTabs.begin(); child_it != mDetachedTabs.end(); ++child_it)
|
||||
{
|
||||
new_panel = openChildPanel(*child_it, panel_name, params);
|
||||
if (new_panel) break;
|
||||
}
|
||||
|
||||
// Look up the tab in the list of attached tabs.
|
||||
for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it)
|
||||
{
|
||||
new_panel = openChildPanel(*child_it, panel_name, params);
|
||||
if (new_panel) break;
|
||||
}
|
||||
|
||||
return new_panel;
|
||||
}
|
||||
|
||||
void LLSideTray::hidePanel(const std::string& panel_name)
|
||||
{
|
||||
LLPanel* panelp = getPanel(panel_name);
|
||||
if (panelp)
|
||||
{
|
||||
if(isTabAttached(panel_name))
|
||||
{
|
||||
collapseSideBar();
|
||||
}
|
||||
else
|
||||
{
|
||||
LLFloaterReg::hideInstance("side_bar_tab", panel_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LLSideTray::togglePanel(LLPanel* &sub_panel, const std::string& panel_name, const LLSD& params)
|
||||
{
|
||||
if(!sub_panel)
|
||||
return;
|
||||
|
||||
// If a panel is visible and attached to Side Tray (has LLSideTray among its ancestors)
|
||||
// it should be toggled off by collapsing Side Tray.
|
||||
if (sub_panel->isInVisibleChain() && sub_panel->hasAncestor(this))
|
||||
{
|
||||
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.
|
||||
|
|
@ -1287,6 +1224,96 @@ LLPanel *findChildPanel(LLPanel *panel, const std::string& name, bool recurse)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate tab with "panel_name" panel
|
||||
* if no such tab - return false, otherwise true.
|
||||
* TODO* In some cases a pointer to a panel of
|
||||
* a specific class may be needed so this method
|
||||
* would need to use templates.
|
||||
*/
|
||||
LLPanel* LLSideTray::showPanel (const std::string& panel_name, const LLSD& params)
|
||||
{
|
||||
LLPanel* new_panel = NULL;
|
||||
|
||||
// Look up the tab in the list of detached tabs.
|
||||
child_vector_const_iter_t child_it;
|
||||
for ( child_it = mDetachedTabs.begin(); child_it != mDetachedTabs.end(); ++child_it)
|
||||
{
|
||||
new_panel = openChildPanel(*child_it, panel_name, params);
|
||||
if (new_panel) break;
|
||||
}
|
||||
|
||||
// Look up the tab in the list of attached tabs.
|
||||
for ( child_it = mTabs.begin(); child_it != mTabs.end(); ++child_it)
|
||||
{
|
||||
new_panel = openChildPanel(*child_it, panel_name, params);
|
||||
if (new_panel) break;
|
||||
}
|
||||
|
||||
return new_panel;
|
||||
}
|
||||
|
||||
bool LLSideTray::hidePanel(const std::string& panel_name)
|
||||
{
|
||||
bool panelHidden = false;
|
||||
|
||||
LLPanel* panelp = getPanel(panel_name);
|
||||
|
||||
if (panelp)
|
||||
{
|
||||
LLView* parentp = panelp->getParent();
|
||||
|
||||
// Collapse the side bar if the panel or the panel's parent is an attached tab
|
||||
if (isTabAttached(panel_name) || (parentp && isTabAttached(parentp->getName())))
|
||||
{
|
||||
collapseSideBar();
|
||||
panelHidden = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
panelHidden = LLFloaterReg::hideInstance("side_bar_tab", panel_name);
|
||||
|
||||
if (!panelHidden)
|
||||
{
|
||||
// Look up the panel in the list of detached tabs.
|
||||
for (child_vector_const_iter_t child_it = mDetachedTabs.begin(); child_it != mDetachedTabs.end(); ++child_it)
|
||||
{
|
||||
LLPanel *detached_panel = dynamic_cast<LLPanel*>(*child_it);
|
||||
|
||||
if (detached_panel)
|
||||
{
|
||||
// Hide this detached panel if it is a parent of our panel
|
||||
if (findChildPanel(detached_panel, panel_name, true) != NULL)
|
||||
{
|
||||
panelHidden = LLFloaterReg::hideInstance("side_bar_tab", detached_panel->getName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return panelHidden;
|
||||
}
|
||||
|
||||
void LLSideTray::togglePanel(LLPanel* &sub_panel, const std::string& panel_name, const LLSD& params)
|
||||
{
|
||||
if(!sub_panel)
|
||||
return;
|
||||
|
||||
// If a panel is visible and attached to Side Tray (has LLSideTray among its ancestors)
|
||||
// it should be toggled off by collapsing Side Tray.
|
||||
if (sub_panel->isInVisibleChain() && sub_panel->hasAncestor(this))
|
||||
{
|
||||
LLSideTray::getInstance()->collapseSideBar();
|
||||
}
|
||||
else
|
||||
{
|
||||
LLSideTray::getInstance()->showPanel(panel_name, params);
|
||||
}
|
||||
}
|
||||
|
||||
LLPanel* LLSideTray::getPanel(const std::string& panel_name)
|
||||
{
|
||||
// Look up the panel in the list of detached tabs.
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ public:
|
|||
*/
|
||||
LLPanel* showPanel (const std::string& panel_name, const LLSD& params = LLSD());
|
||||
|
||||
void hidePanel (const std::string& panel_name);
|
||||
bool hidePanel (const std::string& panel_name);
|
||||
|
||||
/**
|
||||
* Toggling Side Tray tab which contains "sub_panel" child of "panel_name" panel.
|
||||
|
|
|
|||
Loading…
Reference in New Issue