Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_tree2.c ewl_view.h Log Message: - you can set a callback on your view to return a new view for an expansion point. similar to how the models work =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_tree2.c,v retrieving revision 1.71 retrieving revision 1.72 diff -u -3 -r1.71 -r1.72 --- ewl_tree2.c 26 Mar 2007 02:21:56 -0000 1.71 +++ ewl_tree2.c 27 Mar 2007 01:53:40 -0000 1.72 @@ -15,7 +15,7 @@ static void ewl_tree2_build_tree(Ewl_Tree2 *tree); static void ewl_tree2_build_tree_rows(Ewl_Tree2 *tree, - Ewl_Model *model, void *data, + Ewl_Model *model, Ewl_View *view, void *data, int colour, Ewl_Widget *parent, int hidden); static void ewl_tree2_cb_header_changed(Ewl_Widget *w, void *ev, @@ -668,14 +668,17 @@ DRETURN(DLEVEL_STABLE); ewl_container_reset(EWL_CONTAINER(tree->rows)); - ewl_tree2_build_tree_rows(tree, model, mvc_data, 0, tree->rows, FALSE); + ewl_tree2_build_tree_rows(tree, model, + ewl_mvc_view_get(EWL_MVC(tree)), mvc_data, + 0, tree->rows, FALSE); DLEAVE_FUNCTION(DLEVEL_STABLE); } static void -ewl_tree2_build_tree_rows(Ewl_Tree2 *tree, Ewl_Model *model, void *data, - int colour, Ewl_Widget *parent, int hidden) +ewl_tree2_build_tree_rows(Ewl_Tree2 *tree, Ewl_Model *model, Ewl_View *view, + void *data, int colour, Ewl_Widget *parent, + int hidden) { int i = 0, row_count = 0; unsigned int column; @@ -696,6 +699,7 @@ EWL_TREE2_NODE(node)->row_num = i; ewl_mvc_model_set(EWL_MVC(node), model); ewl_mvc_data_set(EWL_MVC(node), data); + ewl_mvc_view_set(EWL_MVC(node), view); ewl_container_child_append(EWL_CONTAINER(parent), node); if (!hidden) ewl_widget_show(node); @@ -716,8 +720,7 @@ /* do the current branch */ for (column = 0; column < tree->columns; column ++) - ewl_tree2_column_build(EWL_ROW(row), model, - ewl_mvc_view_get(EWL_MVC(tree)), + ewl_tree2_column_build(EWL_ROW(row), model, view, data, i, column, node); /* check if this is an expansion point */ @@ -1019,17 +1022,22 @@ if (model->expansion.data && !node->built_children) { Ewl_Model *tmp_model = NULL; + Ewl_View *view, *tmp_view = NULL; void *tmp_data; tmp_data = model->expansion.data(data, node->row_num); if (model->expansion.model) - tmp_model = model->expansion.model(data, - node->row_num); - + tmp_model = model->expansion.model(data, node->row_num); if (!tmp_model) tmp_model = model; - ewl_tree2_build_tree_rows(EWL_TREE2(node->tree), tmp_model, - tmp_data, 0, EWL_WIDGET(node), FALSE); + view = ewl_mvc_view_get(EWL_MVC(node)); + if (view->expansion) + tmp_view = view->expansion(data, node->row_num); + if (!tmp_view) tmp_view = view; + + ewl_tree2_build_tree_rows(EWL_TREE2(node->tree), tmp_model, + tmp_view, tmp_data, 0, + EWL_WIDGET(node), FALSE); node->built_children = TRUE; } =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/lib/ewl_view.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- ewl_view.h 26 Mar 2007 02:21:56 -0000 1.14 +++ ewl_view.h 27 Mar 2007 01:53:40 -0000 1.15 @@ -54,7 +54,7 @@ * A typedef to shorten the definition of the view_expansion_view_fetch * callbacks. */ -typedef Ewl_View *(*Ewl_View_Expansion_View_Fetch)(void *data, int column); +typedef Ewl_View *(*Ewl_View_Expansion_View_Fetch)(void *data, int row); /** * @brief The view function pointers ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs