summaryrefslogtreecommitdiff
path: root/indra/llui/lltabcontainer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/lltabcontainer.cpp')
-rw-r--r--indra/llui/lltabcontainer.cpp28
1 files changed, 17 insertions, 11 deletions
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 5e0985c79c..7c9aa42e5f 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -1258,7 +1258,6 @@ void LLTabContainer::removeTabPanel(LLPanel* child)
bool has_focus = gFocusMgr.childHasKeyboardFocus(this);
- // If the tab being deleted is the selected one, select a different tab.
for(std::vector<LLTabTuple*>::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
{
LLTabTuple* tuple = *iter;
@@ -1296,6 +1295,7 @@ void LLTabContainer::removeTabPanel(LLPanel* child)
// make sure we don't have more locked tabs than we have tabs
mLockedTabCount = llmin(getTabCount(), mLockedTabCount);
+ // If the tab being deleted is the selected one, select a different tab.
if (mCurrentTabIdx >= (S32)mTabList.size())
{
mCurrentTabIdx = static_cast<S32>(mTabList.size()) - 1;
@@ -1723,7 +1723,7 @@ void LLTabContainer::reshapeTuple(LLTabTuple* tuple)
{
S32 image_overlay_width = 0;
- if(mCustomIconCtrlUsed)
+ if (mCustomIconCtrlUsed)
{
LLCustomButtonIconCtrl* button = dynamic_cast<LLCustomButtonIconCtrl*>(tuple->mButton);
LLIconCtrl* icon_ctrl = button ? button->getIconCtrl() : NULL;
@@ -2173,12 +2173,22 @@ S32 LLTabContainer::getTotalTabWidth() const
void LLTabContainer::setTabVisibility( LLPanel const *aPanel, bool aVisible )
{
- for( tuple_list_t::const_iterator itr = mTabList.begin(); itr != mTabList.end(); ++itr )
+ S32 num_tabs = S32(mTabList.size());
+ for (S32 i = 0; i < num_tabs; ++i)
{
- LLTabTuple const *pTT = *itr;
- if( pTT->mTabPanel == aPanel )
+ LLTabTuple* tuple = mTabList[i];
+ if( tuple->mTabPanel == aPanel )
{
- pTT->mVisible = aVisible;
+ if (tuple->mVisible != aVisible)
+ {
+ tuple->mVisible = aVisible;
+ if (aVisible)
+ {
+ this->selectTab(i);
+ this->setVisible(true);
+ }
+ updateMaxScrollPos();
+ }
break;
}
}
@@ -2194,11 +2204,7 @@ void LLTabContainer::setTabVisibility( LLPanel const *aPanel, bool aVisible )
break;
}
}
-
- if( foundTab )
- this->setVisible( true );
- else
- this->setVisible( false );
+ this->setVisible( foundTab );
updateMaxScrollPos();
}