(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)

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
frosch 11 years ago
parent d7c43bbc20
commit e3a0337951

@ -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;
}
}

Loading…
Cancel
Save