Changeset - r20691:da1b985e95ff
[Not reviewed]
master
0 1 0
frosch - 11 years ago 2013-08-18 17:04:13
frosch@openttd.org
(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)
1 file changed with 6 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/widget.cpp
Show inline comments
 
@@ -1247,17 +1247,18 @@ void NWidgetHorizontal::AssignSizePositi
 
	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;
 
	}
 
}
 

	
0 comments (0 inline, 0 general)