Enlightenment CVS committal Author : pfritz Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_freebox.c Log Message: respect the alignment of the children =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_freebox.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -3 -r1.19 -r1.20 --- ewl_freebox.c 19 Apr 2007 15:26:18 -0000 1.19 +++ ewl_freebox.c 23 Apr 2007 16:05:53 -0000 1.20 @@ -334,9 +334,10 @@ { Ewl_Container *c; Ewl_Widget *child; - int max_pos, largest_size = 0, cur_pos = 0, cur_align; + int max_pos, cur_pos = 0, cur_align; int base_pos, start_pos, pad = 0, *x, *y; int *stable_dir, *grow_dir, child_h, child_w; + int *column_sizes, *col_size; void (*pref_inner)(Ewl_Object *obj, int size); int (*current_pos)(Ewl_Object *obj); @@ -384,28 +385,59 @@ cur_align = base_pos; c = EWL_CONTAINER(fb); + + /* determine the column sizes first */ + col_size = column_sizes = NEW(int, ecore_dlist_nodes(c->children) + 1); + *col_size = 0; + + ecore_dlist_goto_first(c->children); + while ((child = ecore_dlist_next(c->children))) + { + if (!VISIBLE(child)) continue; + ewl_object_minimum_size_get(EWL_OBJECT(child), + &child_w, &child_h); + + /* past end of widget, wrap */ + if ((cur_align + *stable_dir) > max_pos) + { + cur_align = base_pos; + cur_pos += *col_size + pad; + *(++col_size) = 0; + } + + *col_size = MAX(*col_size, *grow_dir); + cur_align += *stable_dir + pad; + } + + /* reset the start values */ + cur_pos = start_pos; + cur_align = base_pos; + col_size = column_sizes; + + /* and now place the children */ ecore_dlist_goto_first(c->children); while ((child = ecore_dlist_next(c->children))) { if (!VISIBLE(child)) continue; - ewl_object_current_size_get(EWL_OBJECT(child), + ewl_object_minimum_size_get(EWL_OBJECT(child), &child_w, &child_h); /* past end of widget, wrap */ if ((cur_align + *stable_dir) > max_pos) { cur_align = base_pos; - cur_pos += largest_size + pad; - largest_size = 0; + cur_pos += *col_size + pad; + col_size++; } - if (*grow_dir > largest_size) - largest_size = *grow_dir; + *grow_dir = *col_size; ewl_object_place(EWL_OBJECT(child), *x, *y, child_w, child_h); cur_align += *stable_dir + pad; } - pref_inner(EWL_OBJECT(fb), cur_pos - start_pos + largest_size + pad); + pref_inner(EWL_OBJECT(fb), cur_pos - start_pos + *col_size + pad); + + FREE(column_sizes); DLEAVE_FUNCTION(DLEVEL_STABLE); } ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs