summaryrefslogtreecommitdiff
path: root/indra/llui/llcheckboxctrl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llcheckboxctrl.cpp')
-rw-r--r--indra/llui/llcheckboxctrl.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp
index 0c524cd470..3d32157406 100644
--- a/indra/llui/llcheckboxctrl.cpp
+++ b/indra/llui/llcheckboxctrl.cpp
@@ -81,6 +81,17 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const LLCheckBoxCtrl::Params& p)
// must be big enough to hold all children
setUseBoundingRect(TRUE);
+ // Label (add a little space to make sure text actually renders)
+ const S32 FUDGE = 10;
+ S32 text_width = mFont->getWidth( p.label ) + FUDGE;
+ S32 text_height = llround(mFont->getLineHeight());
+ LLRect label_rect;
+ label_rect.setOriginAndSize(
+ llcheckboxctrl_hpad + llcheckboxctrl_btn_size + llcheckboxctrl_spacing,
+ llcheckboxctrl_vpad + 1, // padding to get better alignment
+ text_width + llcheckboxctrl_hpad,
+ text_height );
+
// *HACK Get rid of this with SL-55508...
// this allows blank check boxes and radio boxes for now
std::string local_label = p.label;
@@ -90,6 +101,7 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const LLCheckBoxCtrl::Params& p)
}
LLTextBox::Params tbparams = p.label_text;
+ tbparams.rect(label_rect);
tbparams.initial_value(local_label);
if (p.font.isProvided())
{
@@ -99,17 +111,6 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const LLCheckBoxCtrl::Params& p)
mLabel = LLUICtrlFactory::create<LLTextBox> (tbparams);
addChild(mLabel);
- S32 text_width = mLabel->getTextBoundingRect().getWidth();
- S32 text_height = llround(mFont->getLineHeight());
- LLRect label_rect;
- label_rect.setOriginAndSize(
- llcheckboxctrl_hpad + llcheckboxctrl_btn_size + llcheckboxctrl_spacing,
- llcheckboxctrl_vpad + 1, // padding to get better alignment
- text_width + llcheckboxctrl_hpad,
- text_height );
- mLabel->setShape(label_rect);
-
-
// Button
// Note: button cover the label by extending all the way to the right.
LLRect btn_rect;
@@ -189,7 +190,8 @@ void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent)
static LLUICachedControl<S32> llcheckboxctrl_vpad ("UICheckboxctrlVPad", 0);
static LLUICachedControl<S32> llcheckboxctrl_btn_size ("UICheckboxctrlBtnSize", 0);
- S32 text_width = mLabel->getTextBoundingRect().getWidth();
+ const S32 FUDGE = 10;
+ S32 text_width = mFont->getWidth( mLabel->getText() ) + FUDGE;
S32 text_height = llround(mFont->getLineHeight());
LLRect label_rect;
label_rect.setOriginAndSize(
@@ -197,7 +199,7 @@ void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent)
llcheckboxctrl_vpad,
text_width,
text_height );
- mLabel->setShape(label_rect);
+ mLabel->setRect(label_rect);
LLRect btn_rect;
btn_rect.setOriginAndSize(
@@ -205,7 +207,7 @@ void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent)
llcheckboxctrl_vpad,
llcheckboxctrl_btn_size + llcheckboxctrl_spacing + text_width,
llmax( text_height, llcheckboxctrl_btn_size() ) );
- mButton->setShape( btn_rect );
+ mButton->setRect( btn_rect );
LLUICtrl::reshape(width, height, called_from_parent);
}