Skip to content
Snippets Groups Projects
Commit 7199c9cc authored by Paul Guslisty's avatar Paul Guslisty
Browse files

EXT-3232 Refactoring: Improved the way of horizontal alignment of button's...

EXT-3232 Refactoring: Improved the way of horizontal alignment of button's image overlay. Now mLeftHPad/mRightHPad is used instead of mImageOverlayLeftPad and mImageOverlayRightPad. Also mImgOverlayLabelSpace/imgoverlay_label_space members was added to button.(h/xml) to define space between image overlay and button's label

--HG--
branch : product-engine
parent 9bf24a72
No related branches found
No related tags found
No related merge requests found
...@@ -85,6 +85,7 @@ LLButton::Params::Params() ...@@ -85,6 +85,7 @@ LLButton::Params::Params()
image_right_pad("image_right_pad"), image_right_pad("image_right_pad"),
image_top_pad("image_top_pad"), image_top_pad("image_top_pad"),
image_bottom_pad("image_bottom_pad"), image_bottom_pad("image_bottom_pad"),
imgoverlay_label_space("imgoverlay_label_space", 1),
label_color("label_color"), label_color("label_color"),
label_color_selected("label_color_selected"), // requires is_toggle true label_color_selected("label_color_selected"), // requires is_toggle true
label_color_disabled("label_color_disabled"), label_color_disabled("label_color_disabled"),
...@@ -148,6 +149,7 @@ LLButton::LLButton(const LLButton::Params& p) ...@@ -148,6 +149,7 @@ LLButton::LLButton(const LLButton::Params& p)
mImageOverlayRightPad(p.image_right_pad), mImageOverlayRightPad(p.image_right_pad),
mImageOverlayTopPad(p.image_top_pad), mImageOverlayTopPad(p.image_top_pad),
mImageOverlayBottomPad(p.image_bottom_pad), mImageOverlayBottomPad(p.image_bottom_pad),
mImgOverlayLabelSpace(p.imgoverlay_label_space),
mIsToggle(p.is_toggle), mIsToggle(p.is_toggle),
mScaleImage(p.scale_image), mScaleImage(p.scale_image),
mDropShadowedText(p.label_shadow), mDropShadowedText(p.label_shadow),
...@@ -783,9 +785,9 @@ void LLButton::draw() ...@@ -783,9 +785,9 @@ void LLButton::draw()
switch(mImageOverlayAlignment) switch(mImageOverlayAlignment)
{ {
case LLFontGL::LEFT: case LLFontGL::LEFT:
text_left += overlay_width + 1; text_left += overlay_width + mImgOverlayLabelSpace;
mImageOverlay->draw( mImageOverlay->draw(
mImageOverlayLeftPad, mLeftHPad,
center_y - (overlay_height / 2), center_y - (overlay_height / 2),
overlay_width, overlay_width,
overlay_height, overlay_height,
...@@ -800,9 +802,9 @@ void LLButton::draw() ...@@ -800,9 +802,9 @@ void LLButton::draw()
overlay_color); overlay_color);
break; break;
case LLFontGL::RIGHT: case LLFontGL::RIGHT:
text_right -= overlay_width + 1; text_right -= overlay_width + mImgOverlayLabelSpace;
mImageOverlay->draw( mImageOverlay->draw(
getRect().getWidth() - mImageOverlayRightPad - overlay_width, getRect().getWidth() - mRightHPad - overlay_width,
center_y - (overlay_height / 2), center_y - (overlay_height / 2),
overlay_width, overlay_width,
overlay_height, overlay_height,
......
...@@ -112,6 +112,11 @@ class LLButton ...@@ -112,6 +112,11 @@ class LLButton
Optional<S32> image_top_pad; Optional<S32> image_top_pad;
Optional<S32> image_bottom_pad; Optional<S32> image_bottom_pad;
/**
* Space between image_overlay and label
*/
Optional<S32> imgoverlay_label_space;
// callbacks // callbacks
Optional<CommitCallbackParam> click_callback, // alias -> commit_callback Optional<CommitCallbackParam> click_callback, // alias -> commit_callback
mouse_down_callback, mouse_down_callback,
...@@ -333,6 +338,11 @@ class LLButton ...@@ -333,6 +338,11 @@ class LLButton
S32 mImageOverlayTopPad; S32 mImageOverlayTopPad;
S32 mImageOverlayBottomPad; S32 mImageOverlayBottomPad;
/*
* Space between image_overlay and label
*/
S32 mImgOverlayLabelSpace;
F32 mHoverGlowStrength; F32 mHoverGlowStrength;
F32 mCurGlowStrength; F32 mCurGlowStrength;
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
image_right_pad="0" image_right_pad="0"
image_top_pad="0" image_top_pad="0"
image_bottom_pad="0" image_bottom_pad="0"
imgoverlay_label_space="1"
label_color="ButtonLabelColor" label_color="ButtonLabelColor"
label_color_selected="ButtonLabelSelectedColor" label_color_selected="ButtonLabelSelectedColor"
label_color_disabled="ButtonLabelDisabledColor" label_color_disabled="ButtonLabelDisabledColor"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment