summaryrefslogtreecommitdiff
path: root/indra/llui/llbutton.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llbutton.cpp')
-rw-r--r--indra/llui/llbutton.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 9ce8ce8d55..4944ed4fe7 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -81,6 +81,10 @@ LLButton::Params::Params()
image_pressed_selected("image_pressed_selected"),
image_overlay("image_overlay"),
image_overlay_alignment("image_overlay_alignment", std::string("center")),
+ image_left_pad("image_left_pad"),
+ image_right_pad("image_right_pad"),
+ image_top_pad("image_top_pad"),
+ image_bottom_pad("image_bottom_pad"),
label_color("label_color"),
label_color_selected("label_color_selected"), // requires is_toggle true
label_color_disabled("label_color_disabled"),
@@ -140,6 +144,10 @@ LLButton::LLButton(const LLButton::Params& p)
mImageOverlay(p.image_overlay()),
mImageOverlayColor(p.image_overlay_color()),
mImageOverlayAlignment(LLFontGL::hAlignFromName(p.image_overlay_alignment)),
+ mImageOverlayLeftPad(p.image_left_pad),
+ mImageOverlayRightPad(p.image_right_pad),
+ mImageOverlayTopPad(p.image_top_pad),
+ mImageOverlayBottomPad(p.image_bottom_pad),
mIsToggle(p.is_toggle),
mScaleImage(p.scale_image),
mDropShadowedText(p.label_shadow),
@@ -763,6 +771,12 @@ void LLButton::draw()
center_x++;
}
+ S32 text_width_delta = overlay_width + 1;
+ // if image paddings set, they should participate in scaling process
+ S32 image_size_delta = mImageOverlayTopPad + mImageOverlayBottomPad;
+ overlay_width = overlay_width - image_size_delta;
+ overlay_height = overlay_height - image_size_delta;
+
// fade out overlay images on disabled buttons
LLColor4 overlay_color = mImageOverlayColor.get();
if (!enabled)
@@ -774,8 +788,8 @@ void LLButton::draw()
switch(mImageOverlayAlignment)
{
case LLFontGL::LEFT:
- text_left += overlay_width + 1;
- text_width -= overlay_width + 1;
+ text_left += overlay_width + mImageOverlayRightPad + 1;
+ text_width -= text_width_delta;
mImageOverlay->draw(
mLeftHPad,
center_y - (overlay_height / 2),
@@ -792,8 +806,8 @@ void LLButton::draw()
overlay_color);
break;
case LLFontGL::RIGHT:
- text_right -= overlay_width + 1;
- text_width -= overlay_width + 1;
+ text_right -= overlay_width + mImageOverlayLeftPad+ 1;
+ text_width -= text_width_delta;
mImageOverlay->draw(
getRect().getWidth() - mRightHPad - overlay_width,
center_y - (overlay_height / 2),