diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llui/lltabcontainer.cpp | 54 |
1 files changed, 50 insertions, 4 deletions
diff --git a/linden/indra/llui/lltabcontainer.cpp b/linden/indra/llui/lltabcontainer.cpp index 61cfde4..44940ae 100644 --- a/linden/indra/llui/lltabcontainer.cpp +++ b/linden/indra/llui/lltabcontainer.cpp | |||
@@ -77,7 +77,8 @@ LLTabContainerCommon::LLTabContainerCommon( | |||
77 | mCallbackUserdata( callback_userdata ), | 77 | mCallbackUserdata( callback_userdata ), |
78 | mTitleBox(NULL), | 78 | mTitleBox(NULL), |
79 | mTopBorderHeight(LLPANEL_BORDER_WIDTH), | 79 | mTopBorderHeight(LLPANEL_BORDER_WIDTH), |
80 | mTabPosition(pos) | 80 | mTabPosition(pos), |
81 | mLockedTabCount(0) | ||
81 | { | 82 | { |
82 | setMouseOpaque(FALSE); | 83 | setMouseOpaque(FALSE); |
83 | } | 84 | } |
@@ -142,6 +143,13 @@ void LLTabContainerCommon::addPlaceholder(LLPanel* child, const LLString& label) | |||
142 | addTabPanel(child, label, FALSE, NULL, NULL, 0, TRUE); | 143 | addTabPanel(child, label, FALSE, NULL, NULL, 0, TRUE); |
143 | } | 144 | } |
144 | 145 | ||
146 | void LLTabContainerCommon::lockTabs() | ||
147 | { | ||
148 | // count current tabs and ensure no new tabs get | ||
149 | // inserted between them | ||
150 | mLockedTabCount = getTabCount(); | ||
151 | } | ||
152 | |||
145 | void LLTabContainerCommon::removeTabPanel(LLPanel* child) | 153 | void LLTabContainerCommon::removeTabPanel(LLPanel* child) |
146 | { | 154 | { |
147 | BOOL has_focus = gFocusMgr.childHasKeyboardFocus(this); | 155 | BOOL has_focus = gFocusMgr.childHasKeyboardFocus(this); |
@@ -164,6 +172,10 @@ void LLTabContainerCommon::removeTabPanel(LLPanel* child) | |||
164 | break; | 172 | break; |
165 | } | 173 | } |
166 | } | 174 | } |
175 | |||
176 | // make sure we don't have more locked tabs than we have tabs | ||
177 | mLockedTabCount = llmin(getTabCount(), mLockedTabCount); | ||
178 | |||
167 | if (mCurrentTabIdx >= (S32)mTabList.size()) | 179 | if (mCurrentTabIdx >= (S32)mTabList.size()) |
168 | { | 180 | { |
169 | mCurrentTabIdx = mTabList.size()-1; | 181 | mCurrentTabIdx = mTabList.size()-1; |
@@ -526,6 +538,15 @@ void LLTabContainerCommon::setTabPanelFlashing(LLPanel* child, BOOL state ) | |||
526 | } | 538 | } |
527 | } | 539 | } |
528 | 540 | ||
541 | void LLTabContainerCommon::setTabImage(LLPanel* child, std::string img_name) | ||
542 | { | ||
543 | LLTabTuple* tuple = getTabByPanel(child); | ||
544 | if( tuple ) | ||
545 | { | ||
546 | tuple->mButton->setImageOverlay(img_name, LLFontGL::RIGHT); | ||
547 | } | ||
548 | } | ||
549 | |||
529 | void LLTabContainerCommon::setTitle(const LLString& title) | 550 | void LLTabContainerCommon::setTitle(const LLString& title) |
530 | { | 551 | { |
531 | if (mTitleBox) | 552 | if (mTitleBox) |
@@ -687,12 +708,12 @@ void LLTabContainerCommon::insertTuple(LLTabTuple * tuple, eInsertionPoint inser | |||
687 | { | 708 | { |
688 | case START: | 709 | case START: |
689 | // insert the new tab in the front of the list | 710 | // insert the new tab in the front of the list |
690 | mTabList.insert(mTabList.begin(), tuple); | 711 | mTabList.insert(mTabList.begin() + mLockedTabCount, tuple); |
691 | break; | 712 | break; |
692 | case RIGHT_OF_CURRENT: | 713 | case RIGHT_OF_CURRENT: |
693 | // insert the new tab after the current tab | 714 | // insert the new tab after the current tab (but not before mLockedTabCount) |
694 | { | 715 | { |
695 | tuple_list_t::iterator current_iter = mTabList.begin() + mCurrentTabIdx + 1; | 716 | tuple_list_t::iterator current_iter = mTabList.begin() + llmax(mLockedTabCount, mCurrentTabIdx + 1); |
696 | mTabList.insert(current_iter, tuple); | 717 | mTabList.insert(current_iter, tuple); |
697 | } | 718 | } |
698 | break; | 719 | break; |
@@ -1249,6 +1270,7 @@ void LLTabContainer::draw() | |||
1249 | for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) | 1270 | for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) |
1250 | { | 1271 | { |
1251 | LLTabTuple* tuple = *iter; | 1272 | LLTabTuple* tuple = *iter; |
1273 | |||
1252 | tuple->mButton->translate( left - tuple->mButton->getRect().mLeft, 0 ); | 1274 | tuple->mButton->translate( left - tuple->mButton->getRect().mLeft, 0 ); |
1253 | left += tuple->mButton->getRect().getWidth(); | 1275 | left += tuple->mButton->getRect().getWidth(); |
1254 | 1276 | ||
@@ -1596,3 +1618,27 @@ BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDrag | |||
1596 | 1618 | ||
1597 | return LLView::handleDragAndDrop(x, y, mask, drop, type, cargo_data, accept, tooltip); | 1619 | return LLView::handleDragAndDrop(x, y, mask, drop, type, cargo_data, accept, tooltip); |
1598 | } | 1620 | } |
1621 | |||
1622 | void LLTabContainer::setTabImage(LLPanel* child, std::string image_name) | ||
1623 | { | ||
1624 | LLTabTuple* tuple = getTabByPanel(child); | ||
1625 | if( tuple ) | ||
1626 | { | ||
1627 | tuple->mButton->setImageOverlay(image_name, LLFontGL::RIGHT); | ||
1628 | |||
1629 | const LLFontGL* fontp = gResMgr->getRes( LLFONT_SANSSERIF_SMALL ); | ||
1630 | // remove current width from total tab strip width | ||
1631 | mTotalTabWidth -= tuple->mButton->getRect().getWidth(); | ||
1632 | |||
1633 | S32 image_overlay_width = tuple->mButton->getImageOverlay().notNull() ? | ||
1634 | tuple->mButton->getImageOverlay()->getWidth(0) : | ||
1635 | 0; | ||
1636 | tuple->mButton->reshape(llclamp(fontp->getWidth(tuple->mButton->getLabelSelected()) + TAB_PADDING + image_overlay_width, mMinTabWidth, mMaxTabWidth), | ||
1637 | tuple->mButton->getRect().getHeight()); | ||
1638 | // add back in button width to total tab strip width | ||
1639 | mTotalTabWidth += tuple->mButton->getRect().getWidth(); | ||
1640 | |||
1641 | // tabs have changed size, might need to scroll to see current tab | ||
1642 | updateMaxScrollPos(); | ||
1643 | } | ||
1644 | } \ No newline at end of file | ||