summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llcheckboxctrl.cpp30
-rw-r--r--indra/llui/lllayoutstack.cpp2
-rw-r--r--indra/llui/lltextbase.cpp2
-rw-r--r--indra/llui/lltextbox.cpp4
-rw-r--r--indra/llui/lltextbox.h2
-rw-r--r--indra/llui/llview.cpp4
6 files changed, 35 insertions, 9 deletions
diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp
index 6a51c4240b..08da599ef2 100644
--- a/indra/llui/llcheckboxctrl.cpp
+++ b/indra/llui/llcheckboxctrl.cpp
@@ -187,10 +187,32 @@ void LLCheckBoxCtrl::clear()
void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent)
{
- S32 label_top = mLabel->getRect().mTop;
- mLabel->reshapeToFitText();
+ LLRect rect = getRect();
+ S32 delta_width = width - rect.getWidth();
+ S32 delta_height = height - rect.getHeight();
- LLRect label_rect = mLabel->getRect();
+ if (delta_width || delta_height)
+ {
+ // adjust our rectangle
+ rect.mRight = getRect().mLeft + width;
+ rect.mTop = getRect().mBottom + height;
+ setRect(rect);
+ }
+
+ // reshapeToFitText reshapes label to minimal size according to last bounding box
+ // it will work fine in case of decrease of space, but if we get more space or text
+ // becomes longer, label will fail to grow so reinit label's dimentions.
+
+ static LLUICachedControl<S32> llcheckboxctrl_hpad("UICheckboxctrlHPad", 0);
+ LLRect label_rect = mLabel->getRect();
+ S32 new_width = getRect().getWidth() - label_rect.mLeft - llcheckboxctrl_hpad;
+ label_rect.mRight = label_rect.mLeft + new_width;
+ mLabel->setRect(label_rect);
+
+ S32 label_top = label_rect.mTop;
+ mLabel->reshapeToFitText(TRUE);
+
+ label_rect = mLabel->getRect();
if (label_top != label_rect.mTop && mWordWrap == WRAP_DOWN)
{
// reshapeToFitText uses LLView::reshape() which always reshapes
@@ -210,6 +232,8 @@ void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent)
llmax(btn_rect.getWidth(), label_rect.mRight - btn_rect.mLeft),
llmax(label_rect.mTop - btn_rect.mBottom, btn_rect.getHeight()));
mButton->setShape(btn_rect);
+
+ updateBoundingRect();
}
//virtual
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 4aae1e374b..29a156e933 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -166,7 +166,7 @@ void LLLayoutPanel::setVisible( BOOL visible )
void LLLayoutPanel::reshape( S32 width, S32 height, BOOL called_from_parent /*= TRUE*/ )
{
- if (width == getRect().getWidth() && height == getRect().getHeight()) return;
+ if (width == getRect().getWidth() && height == getRect().getHeight() && !LLView::sForceReshape) return;
if (!mIgnoreReshape && mAutoResize == false)
{
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 83b851eed2..fc1301351d 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -1148,7 +1148,7 @@ BOOL LLTextBase::handleToolTip(S32 x, S32 y, MASK mask)
void LLTextBase::reshape(S32 width, S32 height, BOOL called_from_parent)
{
- if (width != getRect().getWidth() || height != getRect().getHeight())
+ if (width != getRect().getWidth() || height != getRect().getHeight() || LLView::sForceReshape)
{
bool scrolled_to_bottom = mScroller ? mScroller->isAtBottom() : false;
diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp
index 0afd32f332..134afc005b 100644
--- a/indra/llui/lltextbox.cpp
+++ b/indra/llui/lltextbox.cpp
@@ -163,13 +163,13 @@ BOOL LLTextBox::setTextArg( const std::string& key, const LLStringExplicit& text
}
-void LLTextBox::reshapeToFitText()
+void LLTextBox::reshapeToFitText(BOOL called_from_parent)
{
reflow();
S32 width = getTextPixelWidth();
S32 height = getTextPixelHeight();
- reshape( width + 2 * mHPad, height + 2 * mVPad, FALSE );
+ reshape( width + 2 * mHPad, height + 2 * mVPad, called_from_parent );
}
diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h
index 061d2dd23d..c3e3b61912 100644
--- a/indra/llui/lltextbox.h
+++ b/indra/llui/lltextbox.h
@@ -60,7 +60,7 @@ public:
void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; }
void setClickedCallback( boost::function<void (void*)> cb, void* userdata = NULL );
- void reshapeToFitText();
+ void reshapeToFitText(BOOL called_from_parent = FALSE);
S32 getTextPixelWidth();
S32 getTextPixelHeight();
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 593c8b12fc..4a990cea81 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -1387,7 +1387,9 @@ void LLView::reshape(S32 width, S32 height, BOOL called_from_parent)
S32 delta_x = child_rect.mLeft - viewp->getRect().mLeft;
S32 delta_y = child_rect.mBottom - viewp->getRect().mBottom;
viewp->translate( delta_x, delta_y );
- if (child_rect.getWidth() != viewp->getRect().getWidth() || child_rect.getHeight() != viewp->getRect().getHeight())
+ if (child_rect.getWidth() != viewp->getRect().getWidth()
+ || child_rect.getHeight() != viewp->getRect().getHeight()
+ || sForceReshape)
{
viewp->reshape(child_rect.getWidth(), child_rect.getHeight());
}