Newer
Older
btn->setToolTip( tooltip );
btn->setScaleImage(TRUE);
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
// Try to squeeze in a bit more text
btn->setLeftHPad( 4 );
btn->setRightHPad( 2 );
btn->setHAlign(LLFontGL::LEFT);
btn->setTabStop(FALSE);
if (indent)
{
btn->setLeftHPad(indent);
}
if( mTabPosition == TOP )
{
btn->setFollowsTop();
}
else
{
btn->setFollowsBottom();
}
LLTabTuple* tuple = new LLTabTuple( this, child, btn, on_tab_clicked, userdata );
btn->setCallbackUserData( tuple );
addChild( btn, 0 );
addChild( child, 1 );
insertTuple(tuple, insertion_point);
}
updateMaxScrollPos();
if( select )
{
selectLastTab();
}
}
void LLTabContainer::removeTabPanel(LLPanel* child)
{
// Adjust the total tab width.
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
{
LLTabTuple* tuple = *iter;
if( tuple->mTabPanel == child )
{
mTotalTabWidth -= tuple->mButton->getRect().getWidth();
break;
}
}
LLTabContainerCommon::removeTabPanel(child);
}
void LLTabContainer::setPanelTitle(S32 index, const LLString& title)
{
if (index >= 0 && index < (S32)mTabList.size())
{
LLTabTuple* tuple = mTabList[index];
LLButton* tab_button = tuple->mButton;
const LLFontGL* fontp = gResMgr->getRes( LLFONT_SANSSERIF_SMALL );
mTotalTabWidth -= tab_button->getRect().getWidth();
tab_button->reshape(llclamp(fontp->getWidth(title) + TAB_PADDING + tuple->mPadding, mMinTabWidth, mMaxTabWidth), tab_button->getRect().getHeight());
mTotalTabWidth += tab_button->getRect().getWidth();
tab_button->setLabelSelected(title);
tab_button->setLabelUnselected(title);
}
updateMaxScrollPos();
}
void LLTabContainer::updateMaxScrollPos()
{
S32 tab_space = 0;
S32 available_space = 0;
tab_space = mTotalTabWidth;
available_space = mRect.getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + TABCNTR_TAB_H_PAD);
if( tab_space > available_space )
{
Josh Bell
committed
S32 available_width_with_arrows = mRect.getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + TABCNTR_ARROW_BTN_SIZE + TABCNTR_ARROW_BTN_SIZE + 1);
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
// subtract off reserved portion on left
available_width_with_arrows -= TABCNTR_TAB_PARTIAL_WIDTH;
S32 running_tab_width = 0;
mMaxScrollPos = mTabList.size();
for(tuple_list_t::reverse_iterator tab_it = mTabList.rbegin(); tab_it != mTabList.rend(); ++tab_it)
{
running_tab_width += (*tab_it)->mButton->getRect().getWidth();
if (running_tab_width > available_width_with_arrows)
{
break;
}
mMaxScrollPos--;
}
// in case last tab doesn't actually fit on screen, make it the last scrolling position
mMaxScrollPos = llmin(mMaxScrollPos, (S32)mTabList.size() - 1);
}
else
{
mMaxScrollPos = 0;
mScrollPos = 0;
}
if (mScrollPos > mMaxScrollPos)
{
mScrollPos = mMaxScrollPos;
}
}
void LLTabContainer::commitHoveredButton(S32 x, S32 y)
{
Josh Bell
committed
if (hasMouseCapture())
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
{
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
{
LLTabTuple* tuple = *iter;
tuple->mButton->setVisible( TRUE );
S32 local_x = x - tuple->mButton->getRect().mLeft;
S32 local_y = y - tuple->mButton->getRect().mBottom;
if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible())
{
tuple->mButton->onCommit();
}
}
}
}
void LLTabContainer::setMinTabWidth(S32 width)
{
mMinTabWidth = width;
}
void LLTabContainer::setMaxTabWidth(S32 width)
{
mMaxTabWidth = width;
}
S32 LLTabContainer::getMinTabWidth() const
{
return mMinTabWidth;
}
S32 LLTabContainer::getMaxTabWidth() const
{
return mMaxTabWidth;
}
BOOL LLTabContainer::selectTab(S32 which)
{
if (which >= (S32)mTabList.size()) return FALSE;
if (which < 0) return FALSE;
//if( gFocusMgr.childHasKeyboardFocus( this ) )
//{
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
//}
LLTabTuple* selected_tuple = mTabList[which];
if (!selected_tuple)
{
return FALSE;
}
if (mTabList[which]->mButton->getEnabled())
{
mCurrentTabIdx = which;
S32 i = 0;
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
{
LLTabTuple* tuple = *iter;
BOOL is_selected = ( tuple == selected_tuple );
tuple->mTabPanel->setVisible( is_selected );
// tuple->mTabPanel->setFocus(is_selected); // not clear that we want to do this here.
tuple->mButton->setToggleState( is_selected );
// RN: this limits tab-stops to active button only, which would require arrow keys to switch tabs
tuple->mButton->setTabStop( is_selected );
if( is_selected && mMaxScrollPos > 0)
{
// Make sure selected tab is within scroll region
if( i < mScrollPos )
{
mScrollPos = i;
}
else
{
Josh Bell
committed
S32 available_width_with_arrows = mRect.getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + TABCNTR_ARROW_BTN_SIZE + TABCNTR_ARROW_BTN_SIZE + 1);
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
S32 running_tab_width = tuple->mButton->getRect().getWidth();
S32 j = i - 1;
S32 min_scroll_pos = i;
if (running_tab_width < available_width_with_arrows)
{
while (j >= 0)
{
LLTabTuple* other_tuple = mTabList[j];
running_tab_width += other_tuple->mButton->getRect().getWidth();
if (running_tab_width > available_width_with_arrows)
{
break;
}
j--;
}
min_scroll_pos = j + 1;
}
mScrollPos = llclamp(mScrollPos, min_scroll_pos, i);
mScrollPos = llmin(mScrollPos, mMaxScrollPos);
}
}
i++;
}
if( selected_tuple->mOnChangeCallback )
{
selected_tuple->mOnChangeCallback( selected_tuple->mUserData, false );
}
return TRUE;
}
else
{
return FALSE;
}
}
void LLTabContainer::draw()
{
S32 target_pixel_scroll = 0;
S32 cur_scroll_pos = mScrollPos;
if (cur_scroll_pos > 0)
{
Josh Bell
committed
S32 available_width_with_arrows = mRect.getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + TABCNTR_ARROW_BTN_SIZE + TABCNTR_ARROW_BTN_SIZE + 1);
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
{
if (cur_scroll_pos == 0)
{
break;
}
target_pixel_scroll += (*iter)->mButton->getRect().getWidth();
cur_scroll_pos--;
}
// Show part of the tab to the left of what is fully visible
target_pixel_scroll -= TABCNTR_TAB_PARTIAL_WIDTH;
// clamp so that rightmost tab never leaves right side of screen
target_pixel_scroll = llmin(mTotalTabWidth - available_width_with_arrows, target_pixel_scroll);
}
mScrollPosPixels = (S32)lerp((F32)mScrollPosPixels, (F32)target_pixel_scroll, LLCriticalDamp::getInterpolant(0.08f));
if( getVisible() )
{
BOOL has_scroll_arrows = (mMaxScrollPos > 0) || (mScrollPosPixels > 0);
Josh Bell
committed
mJumpLeftArrowBtn->setVisible( has_scroll_arrows );
mJumpRightArrowBtn->setVisible( has_scroll_arrows );
mLeftArrowBtn->setVisible( has_scroll_arrows );
mRightArrowBtn->setVisible( has_scroll_arrows );
// Set the leftmost position of the tab buttons.
Josh Bell
committed
S32 left = LLPANEL_BORDER_WIDTH + (has_scroll_arrows ? (TABCNTR_ARROW_BTN_SIZE * 2) : TABCNTR_TAB_H_PAD);
left -= mScrollPosPixels;
// Hide all the buttons
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
{
LLTabTuple* tuple = *iter;
tuple->mButton->setVisible( FALSE );
}
LLPanel::draw();
// if tabs are hidden, don't draw them and leave them in the invisible state
if (!mTabsHidden)
// Show all the buttons
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
{
LLTabTuple* tuple = *iter;
tuple->mButton->setVisible( TRUE );
}
// Draw some of the buttons...
LLRect clip_rect = getLocalRect();
if (has_scroll_arrows)
// ...but clip them.
clip_rect.mLeft = mLeftArrowBtn->getRect().mRight;
clip_rect.mRight = mRightArrowBtn->getRect().mLeft;
S32 max_scroll_visible = mTabList.size() - mMaxScrollPos + mScrollPos;
S32 idx = 0;
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
{
LLTabTuple* tuple = *iter;
tuple->mButton->translate( left - tuple->mButton->getRect().mLeft, 0 );
left += tuple->mButton->getRect().getWidth();
if( tuple->mButton->getFlashing() )
{
mLeftArrowBtn->setFlashing( TRUE );
}
else
if( max_scroll_visible < idx )
if( tuple->mButton->getFlashing() )
{
mRightArrowBtn->setFlashing( TRUE );
}
LLUI::pushMatrix();
{
LLUI::translate((F32)tuple->mButton->getRect().mLeft, (F32)tuple->mButton->getRect().mBottom, 0.f);
tuple->mButton->draw();
}
LLUI::popMatrix();
idx++;
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
}
}
mLeftArrowBtn->setFlashing(FALSE);
mRightArrowBtn->setFlashing(FALSE);
}
}
void LLTabContainer::setRightTabBtnOffset(S32 offset)
{
mRightArrowBtn->translate( -offset - mRightTabBtnOffset, 0 );
mRightTabBtnOffset = offset;
updateMaxScrollPos();
}
BOOL LLTabContainer::handleMouseDown( S32 x, S32 y, MASK mask )
{
BOOL handled = FALSE;
BOOL has_scroll_arrows = (mMaxScrollPos > 0);
if (has_scroll_arrows)
Josh Bell
committed
{
if (mJumpLeftArrowBtn->getRect().pointInRect(x, y))
{
S32 local_x = x - mJumpLeftArrowBtn->getRect().mLeft;
S32 local_y = y - mJumpLeftArrowBtn->getRect().mBottom;
handled = mJumpLeftArrowBtn->handleMouseDown(local_x, local_y, mask);
}
if (mJumpRightArrowBtn->getRect().pointInRect(x, y))
{
S32 local_x = x - mJumpRightArrowBtn->getRect().mLeft;
S32 local_y = y - mJumpRightArrowBtn->getRect().mBottom;
handled = mJumpRightArrowBtn->handleMouseDown(local_x, local_y, mask);
}
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
if (mLeftArrowBtn->getRect().pointInRect(x, y))
{
S32 local_x = x - mLeftArrowBtn->getRect().mLeft;
S32 local_y = y - mLeftArrowBtn->getRect().mBottom;
handled = mLeftArrowBtn->handleMouseDown(local_x, local_y, mask);
}
else if (mRightArrowBtn->getRect().pointInRect(x, y))
{
S32 local_x = x - mRightArrowBtn->getRect().mLeft;
S32 local_y = y - mRightArrowBtn->getRect().mBottom;
handled = mRightArrowBtn->handleMouseDown(local_x, local_y, mask);
}
}
if (!handled)
{
handled = LLPanel::handleMouseDown( x, y, mask );
}
if (mTabList.size() > 0)
{
LLTabTuple* firsttuple = mTabList[0];
Josh Bell
committed
LLRect tab_rect(has_scroll_arrows ? mLeftArrowBtn->getRect().mRight : mJumpLeftArrowBtn->getRect().mLeft,
Josh Bell
committed
has_scroll_arrows ? mRightArrowBtn->getRect().mLeft : mJumpRightArrowBtn->getRect().mRight,
firsttuple->mButton->getRect().mBottom );
if( tab_rect.pointInRect( x, y ) )
{
LLButton* tab_button = mTabList[getCurrentPanelIndex()]->mButton;
Josh Bell
committed
gFocusMgr.setMouseCapture(this);
}
}
return handled;
}
BOOL LLTabContainer::handleHover( S32 x, S32 y, MASK mask )
{
BOOL handled = FALSE;
BOOL has_scroll_arrows = (mMaxScrollPos > 0);
if (has_scroll_arrows)
Josh Bell
committed
{
if (mJumpLeftArrowBtn->getRect().pointInRect(x, y))
{
S32 local_x = x - mJumpLeftArrowBtn->getRect().mLeft;
S32 local_y = y - mJumpLeftArrowBtn->getRect().mBottom;
handled = mJumpLeftArrowBtn->handleHover(local_x, local_y, mask);
}
if (mJumpRightArrowBtn->getRect().pointInRect(x, y))
{
S32 local_x = x - mJumpRightArrowBtn->getRect().mLeft;
S32 local_y = y - mJumpRightArrowBtn->getRect().mBottom;
handled = mJumpRightArrowBtn->handleHover(local_x, local_y, mask);
}
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
if (mLeftArrowBtn->getRect().pointInRect(x, y))
{
S32 local_x = x - mLeftArrowBtn->getRect().mLeft;
S32 local_y = y - mLeftArrowBtn->getRect().mBottom;
handled = mLeftArrowBtn->handleHover(local_x, local_y, mask);
}
else if (mRightArrowBtn->getRect().pointInRect(x, y))
{
S32 local_x = x - mRightArrowBtn->getRect().mLeft;
S32 local_y = y - mRightArrowBtn->getRect().mBottom;
handled = mRightArrowBtn->handleHover(local_x, local_y, mask);
}
}
if (!handled)
{
handled = LLPanel::handleHover(x, y, mask);
}
commitHoveredButton(x, y);
return handled;
}
BOOL LLTabContainer::handleMouseUp( S32 x, S32 y, MASK mask )
{
BOOL handled = FALSE;
BOOL has_scroll_arrows = (mMaxScrollPos > 0);
if (has_scroll_arrows)
{
Josh Bell
committed
if (mJumpLeftArrowBtn->getRect().pointInRect(x, y))
{
S32 local_x = x - mJumpLeftArrowBtn->getRect().mLeft;
S32 local_y = y - mJumpLeftArrowBtn->getRect().mBottom;
handled = mJumpLeftArrowBtn->handleMouseUp(local_x, local_y, mask);
}
if (mJumpRightArrowBtn->getRect().pointInRect(x, y))
{
S32 local_x = x - mJumpRightArrowBtn->getRect().mLeft;
S32 local_y = y - mJumpRightArrowBtn->getRect().mBottom;
handled = mJumpRightArrowBtn->handleMouseUp(local_x, local_y, mask);
}
if (mLeftArrowBtn->getRect().pointInRect(x, y))
{
S32 local_x = x - mLeftArrowBtn->getRect().mLeft;
S32 local_y = y - mLeftArrowBtn->getRect().mBottom;
handled = mLeftArrowBtn->handleMouseUp(local_x, local_y, mask);
}
else if (mRightArrowBtn->getRect().pointInRect(x, y))
{
S32 local_x = x - mRightArrowBtn->getRect().mLeft;
S32 local_y = y - mRightArrowBtn->getRect().mBottom;
handled = mRightArrowBtn->handleMouseUp(local_x, local_y, mask);
}
}
if (!handled)
{
handled = LLPanel::handleMouseUp( x, y, mask );
}
commitHoveredButton(x, y);
LLPanel* cur_panel = getCurrentPanel();
Josh Bell
committed
if (hasMouseCapture())
{
if (cur_panel)
{
if (!cur_panel->focusFirstItem(FALSE))
{
// if nothing in the panel gets focus, make sure the new tab does
// otherwise the last tab might keep focus
mTabList[getCurrentPanelIndex()]->mButton->setFocus(TRUE);
}
}
Josh Bell
committed
gFocusMgr.setMouseCapture(NULL);
}
return handled;
}
BOOL LLTabContainer::handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_rect )
{
BOOL handled = LLPanel::handleToolTip( x, y, msg, sticky_rect );
{
LLTabTuple* firsttuple = mTabList[0];
BOOL has_scroll_arrows = (mMaxScrollPos > 0);
LLRect clip(
Josh Bell
committed
has_scroll_arrows ? mJumpLeftArrowBtn->getRect().mRight : mJumpLeftArrowBtn->getRect().mLeft,
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
firsttuple->mButton->getRect().mTop,
has_scroll_arrows ? mRightArrowBtn->getRect().mLeft : mRightArrowBtn->getRect().mRight,
0 );
if( clip.pointInRect( x, y ) )
{
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
{
LLTabTuple* tuple = *iter;
tuple->mButton->setVisible( TRUE );
S32 local_x = x - tuple->mButton->getRect().mLeft;
S32 local_y = y - tuple->mButton->getRect().mBottom;
handled = tuple->mButton->handleToolTip( local_x, local_y, msg, sticky_rect );
if( handled )
{
break;
}
}
}
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
{
LLTabTuple* tuple = *iter;
tuple->mButton->setVisible( FALSE );
}
}
return handled;
}
BOOL LLTabContainer::handleKeyHere(KEY key, MASK mask, BOOL called_from_parent)
{
if (!getEnabled()) return FALSE;
if (!gFocusMgr.childHasKeyboardFocus(this)) return FALSE;
BOOL handled = FALSE;
Don Kjer
committed
if (key == KEY_LEFT && mask == MASK_ALT)
Don Kjer
committed
else if (key == KEY_RIGHT && mask == MASK_ALT)
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
{
selectNextTab();
handled = TRUE;
}
if (handled)
{
if (getCurrentPanel())
{
getCurrentPanel()->setFocus(TRUE);
}
}
if (!gFocusMgr.childHasKeyboardFocus(getCurrentPanel()))
{
// if child has focus, but not the current panel, focus
// is on a button
switch(key)
{
case KEY_UP:
if (getTabPosition() == BOTTOM && getCurrentPanel())
{
getCurrentPanel()->setFocus(TRUE);
}
handled = TRUE;
break;
case KEY_DOWN:
if (getTabPosition() == TOP && getCurrentPanel())
{
getCurrentPanel()->setFocus(TRUE);
}
handled = TRUE;
break;
case KEY_LEFT:
selectPrevTab();
handled = TRUE;
break;
case KEY_RIGHT:
selectNextTab();
handled = TRUE;
break;
default:
break;
}
}
return handled;
}
// virtual
LLXMLNodePtr LLTabContainer::getXML(bool save_children) const
{
LLXMLNodePtr node = LLTabContainerCommon::getXML();
node->createChild("tab_position", TRUE)->setStringValue((mTabPosition == TOP ? "top" : "bottom"));
return node;
}
BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType type, void* cargo_data, EAcceptance *accept, LLString &tooltip)
{
BOOL has_scroll_arrows = (mMaxScrollPos > 0);
if( mDragAndDropDelayTimer.getElapsedTimeF32() > SCROLL_DELAY_TIME )
if (has_scroll_arrows)
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
if (mJumpLeftArrowBtn->getRect().pointInRect(x, y))
{
S32 local_x = x - mJumpLeftArrowBtn->getRect().mLeft;
S32 local_y = y - mJumpLeftArrowBtn->getRect().mBottom;
mJumpLeftArrowBtn->handleHover(local_x, local_y, mask);
}
if (mJumpRightArrowBtn->getRect().pointInRect(x, y))
{
S32 local_x = x - mJumpRightArrowBtn->getRect().mLeft;
S32 local_y = y - mJumpRightArrowBtn->getRect().mBottom;
mJumpRightArrowBtn->handleHover(local_x, local_y, mask);
}
if (mLeftArrowBtn->getRect().pointInRect(x, y))
{
S32 local_x = x - mLeftArrowBtn->getRect().mLeft;
S32 local_y = y - mLeftArrowBtn->getRect().mBottom;
mLeftArrowBtn->handleHover(local_x, local_y, mask);
}
else if (mRightArrowBtn->getRect().pointInRect(x, y))
{
S32 local_x = x - mRightArrowBtn->getRect().mLeft;
S32 local_y = y - mRightArrowBtn->getRect().mBottom;
mRightArrowBtn->handleHover(local_x, local_y, mask);
}
for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter)
LLTabTuple* tuple = *iter;
tuple->mButton->setVisible( TRUE );
S32 local_x = x - tuple->mButton->getRect().mLeft;
S32 local_y = y - tuple->mButton->getRect().mBottom;
if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible())
{
tuple->mButton->onCommit();
mDragAndDropDelayTimer.stop();
}
}
}
return LLView::handleDragAndDrop(x, y, mask, drop, type, cargo_data, accept, tooltip);
}
void LLTabContainer::setTabImage(LLPanel* child, std::string image_name, const LLColor4& color)
{
LLTabTuple* tuple = getTabByPanel(child);
if( tuple )
{
tuple->mButton->setImageOverlay(image_name, LLFontGL::RIGHT, color);
const LLFontGL* fontp = gResMgr->getRes( LLFONT_SANSSERIF_SMALL );
// remove current width from total tab strip width
mTotalTabWidth -= tuple->mButton->getRect().getWidth();
S32 image_overlay_width = tuple->mButton->getImageOverlay().notNull() ?
tuple->mButton->getImageOverlay()->getImage()->getWidth(0) :
0;
tuple->mPadding = image_overlay_width;
tuple->mButton->reshape(llclamp(fontp->getWidth(tuple->mButton->getLabelSelected()) + TAB_PADDING + tuple->mPadding, mMinTabWidth, mMaxTabWidth),
tuple->mButton->getRect().getHeight());
// add back in button width to total tab strip width
mTotalTabWidth += tuple->mButton->getRect().getWidth();
// tabs have changed size, might need to scroll to see current tab
updateMaxScrollPos();
}