summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-08-18 17:04:13 +0000
committerfrosch <frosch@openttd.org>2013-08-18 17:04:13 +0000
commite3a03379519bf1de67623660dd24609a482cd533 (patch)
tree879e5462cdac25e1568adc4f01e491463e183497 /src
parentd7c43bbc20eeafa7d3642a0e2916beb47a8ef257 (diff)
downloadopenttd-e3a03379519bf1de67623660dd24609a482cd533.tar.xz
(svn r25729) -Fix [FS#5686]: If the child widgets of a NWidgetHorizontal container do not fill the complete container, align them according to text direction. (sbr)
Diffstat (limited to 'src')
-rw-r--r--src/widget.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/widget.cpp b/src/widget.cpp
index 710e8f3c5..9d6406c3b 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -1247,17 +1247,18 @@ void NWidgetHorizontal::AssignSizePosition(SizingType sizing, uint x, uint y, ui
assert(num_changing_childs == 0);
/* Third loop: Compute position and call the child. */
- uint position = 0; // Place to put next child relative to origin of the container.
- NWidgetBase *child_wid = rtl ? this->tail : this->head;
+ uint position = rtl ? this->current_x : 0; // Place to put next child relative to origin of the container.
+ NWidgetBase *child_wid = this->head;
while (child_wid != NULL) {
uint child_width = child_wid->current_x;
- uint child_x = x + position + (rtl ? child_wid->padding_right : child_wid->padding_left);
+ uint child_x = x + position + (rtl ? -child_width - child_wid->padding_left : child_wid->padding_left);
uint child_y = y + child_wid->padding_top;
child_wid->AssignSizePosition(sizing, child_x, child_y, child_width, child_wid->current_y, rtl);
- position += child_width + child_wid->padding_right + child_wid->padding_left;
+ uint padded_child_width = child_width + child_wid->padding_right + child_wid->padding_left;
+ position += rtl ? -padded_child_width : padded_child_width;
- child_wid = rtl ? child_wid->prev : child_wid->next;
+ child_wid = child_wid->next;
}
}