From cc56958452b8c10e1de176edb1924179ad04768a Mon Sep 17 00:00:00 2001 From: Richard Nelson Date: Mon, 26 Sep 2011 19:48:27 -0700 Subject: initial support for switching between icons only and icons + text --- indra/llui/llbutton.cpp | 22 +++++++++++++++++++--- 1 file 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()); } } } -- cgit v1.2.3