summaryrefslogtreecommitdiff
path: root/indra/llui/lltabcontainer.cpp
diff options
context:
space:
mode:
authorPaul Guslisty <pguslisty@productengine.com>2010-01-27 14:16:37 +0200
committerPaul Guslisty <pguslisty@productengine.com>2010-01-27 14:16:37 +0200
commit8ea2c7a37380162ba2926bd23a01583023884408 (patch)
tree05e2c1a000562e06e79c25e02ffac84b6a47bdad /indra/llui/lltabcontainer.cpp
parenta5180babefa3f81de5321a9d6d5148ef1bd8e03a (diff)
Implemeted normal Sub-Task EXT - 2753 (Implement Avatar icons on IM multifloater tabs)
--HG-- branch : product-engine
Diffstat (limited to 'indra/llui/lltabcontainer.cpp')
-rw-r--r--indra/llui/lltabcontainer.cpp75
1 files changed, 34 insertions, 41 deletions
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 43c44f2253..dcb3542e18 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -1373,6 +1373,8 @@ BOOL LLTabContainer::setTab(S32 which)
{
LLTabTuple* tuple = *iter;
BOOL is_selected = ( tuple == selected_tuple );
+ tuple->mButton->setUseEllipses(TRUE);
+ tuple->mButton->setHAlign(LLFontGL::LEFT);
tuple->mTabPanel->setVisible( is_selected );
// tuple->mTabPanel->setFocus(is_selected); // not clear that we want to do this here.
tuple->mButton->setToggleState( is_selected );
@@ -1478,63 +1480,54 @@ void LLTabContainer::setTabPanelFlashing(LLPanel* child, BOOL state )
void LLTabContainer::setTabImage(LLPanel* child, std::string image_name, const LLColor4& color)
{
- static LLUICachedControl<S32> tab_padding ("UITabPadding", 0);
LLTabTuple* tuple = getTabByPanel(child);
if( tuple )
{
- tuple->mButton->setImageOverlay(image_name, LLFontGL::RIGHT, color);
-
- if (!mIsVertical)
- {
- // 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->setRightHPad(6);
- tuple->mButton->reshape(llclamp(mFont->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();
- }
+ tuple->mButton->setImageOverlay(image_name, LLFontGL::LEFT, color);
+ reshape_tuple(tuple);
}
}
void LLTabContainer::setTabImage(LLPanel* child, const LLUUID& image_id, const LLColor4& color)
{
- static LLUICachedControl<S32> tab_padding ("UITabPadding", 0);
LLTabTuple* tuple = getTabByPanel(child);
if( tuple )
{
- tuple->mButton->setImageOverlay(image_id, LLFontGL::RIGHT, color);
+ tuple->mButton->setImageOverlay(image_id, LLFontGL::LEFT, color);
+ reshape_tuple(tuple);
+ }
+}
- if (!mIsVertical)
- {
- // remove current width from total tab strip width
- mTotalTabWidth -= tuple->mButton->getRect().getWidth();
+void LLTabContainer::reshape_tuple(LLTabTuple* tuple)
+{
+ static LLUICachedControl<S32> tab_padding ("UITabPadding", 0);
+ static LLUICachedControl<S32> image_left_padding ("UIButtonImageLeftPadding", 4);
+ static LLUICachedControl<S32> image_right_padding ("UIButtonImageRightPadding", 4);
+ static LLUICachedControl<S32> image_top_padding ("UIButtonImageTopPadding", 2);
+ static LLUICachedControl<S32> image_bottom_padding ("UIButtonImageBottomPadding", 2);
- S32 image_overlay_width = tuple->mButton->getImageOverlay().notNull() ?
- tuple->mButton->getImageOverlay()->getImage()->getWidth(0) :
- 0;
+ if (!mIsVertical)
+ {
+ tuple->mButton->setImageOverlayLeftPad(image_left_padding);
+ tuple->mButton->setImageOverlayRightPad(image_right_padding);
+ tuple->mButton->setImageOverlayTopPad(image_top_padding);
+ tuple->mButton->setImageOverlayBottomPad(image_bottom_padding);
- tuple->mPadding = image_overlay_width;
+ // remove current width from total tab strip width
+ mTotalTabWidth -= tuple->mButton->getRect().getWidth();
- tuple->mButton->setRightHPad(6);
- tuple->mButton->reshape(llclamp(mFont->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();
+ S32 image_overlay_width = tuple->mButton->getImageOverlay().notNull() ?
+ tuple->mButton->getImageOverlay()->getImage()->getWidth(0) : 0;
- // tabs have changed size, might need to scroll to see current tab
- updateMaxScrollPos();
- }
+ tuple->mPadding = image_overlay_width;
+
+ tuple->mButton->reshape(llclamp(mFont->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();
}
}