Newer
Older
1001
1002
1003
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
// 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())
{
LLButton* tab_button = mTabList[index]->mButton;
const LLFontGL* fontp = gResMgr->getRes( LLFONT_SANSSERIF_SMALL );
mTotalTabWidth -= tab_button->getRect().getWidth();
tab_button->reshape(llclamp(fontp->getWidth(title) + TAB_PADDING, 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);
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
// 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())
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
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
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
{
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 ) )
//{
// gFocusMgr.setKeyboardFocus( NULL, NULL );
//}
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);
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
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);
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
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();
// 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...
LLGLEnable scissor_test(has_scroll_arrows ? GL_SCISSOR_TEST : GL_FALSE);
if( has_scroll_arrows )
{
// ...but clip them.
S32 x1 = mLeftArrowBtn->getRect().mRight;
S32 y1 = 0;
S32 x2 = mRightArrowBtn->getRect().mLeft;
S32 y2 = 1;
if (mTabList.size() > 0)
{
y2 = mTabList[0]->mButton->getRect().mTop;
}
LLUI::setScissorRegionLocal(LLRect(x1, y2, x2, y1));
}
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;
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
tuple->mButton->translate( left - tuple->mButton->getRect().mLeft, 0 );
left += tuple->mButton->getRect().getWidth();
if( idx < mScrollPos )
{
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++;
}
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);
}
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
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);
gFocusMgr.setKeyboardFocus(tab_button, NULL);
}
}
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);
}
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
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 );
if (!handled && mTabList.size() > 0 && getVisible() && pointInView( x, y ) )
{
LLTabTuple* firsttuple = mTabList[0];
BOOL has_scroll_arrows = (mMaxScrollPos > 0);
LLRect clip(
Josh Bell
committed
has_scroll_arrows ? mJumpLeftArrowBtn->getRect().mRight : mJumpLeftArrowBtn->getRect().mLeft,
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
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)
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
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
{
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)
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
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);
}
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
void LLTabContainer::setTabImage(LLPanel* child, std::string image_name)
{
LLTabTuple* tuple = getTabByPanel(child);
if( tuple )
{
tuple->mButton->setImageOverlay(image_name, LLFontGL::RIGHT);
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()->getWidth(0) :
0;
tuple->mButton->reshape(llclamp(fontp->getWidth(tuple->mButton->getLabelSelected()) + TAB_PADDING + image_overlay_width, 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();
}