diff options
author | Richard Nelson <richard@lindenlab.com> | 2011-09-26 19:48:27 -0700 |
---|---|---|
committer | Richard Nelson <richard@lindenlab.com> | 2011-09-26 19:48:27 -0700 |
commit | cc56958452b8c10e1de176edb1924179ad04768a (patch) | |
tree | 35e1cac245cd298f147304be2ed58628953f9eb9 /indra/llui/llbutton.cpp | |
parent | f56bf69dfed63d8b7d5d8994c0c3cafced803a0f (diff) |
initial support for switching between icons only and icons + text
Diffstat (limited to 'indra/llui/llbutton.cpp')
-rw-r--r-- | indra/llui/llbutton.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 6c08ec7431..06781f1bdf 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -989,11 +989,27 @@ void LLButton::resize(LLUIString label) // get current btn length S32 btn_width =getRect().getWidth(); // check if it need resize - if (mAutoResize == TRUE) + if (mAutoResize) { - if (btn_width - (mRightHPad + mLeftHPad) < label_width) + S32 min_width = label_width + mLeftHPad + mRightHPad; + if (mImageOverlay) { - setRect(LLRect( getRect().mLeft, getRect().mTop, getRect().mLeft + label_width + mLeftHPad + mRightHPad , getRect().mBottom)); + switch(mImageOverlayAlignment) + { + case LLFontGL::LEFT: + case LLFontGL::RIGHT: + min_width += mImageOverlay->getWidth() + mImgOverlayLabelSpace; + break; + case LLFontGL::HCENTER: + break; + default: + // draw nothing + break; + } + } + if (btn_width < min_width) + { + reshape(min_width, getRect().getHeight()); } } } |