comparison console/libgnt/gntbox.c @ 13953:8b2306c64efa

[gaim-migrate @ 16501] Minor adjustments to the packing of child widgets in a box. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 17 Jul 2006 04:30:50 +0000
parents 25be562aaca8
children c9509bd42d7a
comparison
equal deleted inserted replaced
13952:841a5ffbfee4 13953:8b2306c64efa
171 if (maxh < h) 171 if (maxh < h)
172 maxh = h; 172 maxh = h;
173 if (maxw < w) 173 if (maxw < w)
174 maxw = w; 174 maxw = w;
175 } 175 }
176 176
177 if (box->homogeneous) 177 for (iter = box->list; iter; iter = iter->next)
178 { 178 {
179 for (iter = box->list; iter; iter = iter->next) 179 int w, h;
180 { 180 GntWidget *wid = GNT_WIDGET(iter->data);
181 gnt_widget_set_size(GNT_WIDGET(iter->data), maxw, maxh); 181
182 } 182 gnt_widget_get_size(wid, &w, &h);
183 } 183
184 else 184 if (box->homogeneous)
185 {
186 for (iter = box->list; iter; iter = iter->next)
187 { 185 {
188 if (box->vertical) 186 if (box->vertical)
189 { 187 h = maxh;
190 int h;
191 gnt_widget_get_size(GNT_WIDGET(iter->data), NULL, &h);
192 gnt_widget_set_size(GNT_WIDGET(iter->data), maxw, h);
193 }
194 else 188 else
195 { 189 w = maxw;
196 int w; 190 }
197 gnt_widget_get_size(GNT_WIDGET(iter->data), &w, NULL); 191 if (box->fill)
198 gnt_widget_set_size(GNT_WIDGET(iter->data), w, maxh); 192 {
199 } 193 if (box->vertical)
200 } 194 w = maxw;
195 else
196 h = maxh;
197 }
198
199 gnt_widget_set_size(wid, w, h);
201 } 200 }
202 201
203 reposition_children(widget); 202 reposition_children(widget);
204 } 203 }
205 204
493 GntBox *box = GNT_BOX(widget); 492 GntBox *box = GNT_BOX(widget);
494 493
495 box->homogeneous = homo; 494 box->homogeneous = homo;
496 box->vertical = vert; 495 box->vertical = vert;
497 box->pad = 1; 496 box->pad = 1;
497 box->fill = TRUE;
498 gnt_widget_set_take_focus(widget, TRUE); 498 gnt_widget_set_take_focus(widget, TRUE);
499 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW); 499 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW);
500 if (vert) 500 if (vert)
501 box->alignment = GNT_ALIGN_LEFT; 501 box->alignment = GNT_ALIGN_LEFT;
502 else 502 else
667 gnt_screen_resize_widget(wid, width, height); 667 gnt_screen_resize_widget(wid, width, height);
668 find_focusable_widget(box); 668 find_focusable_widget(box);
669 } 669 }
670 } 670 }
671 671
672 void gnt_box_set_fill(GntBox *box, gboolean fill)
673 {
674 box->fill = fill;
675 }
676